제출 #1317787

#제출 시각아이디문제언어결과실행 시간메모리
1317787hellodude2526Topical (NOI23_topical)C++20
33 / 100
215 ms15928 KiB
/* tourist orz dominater sir orz paras sir orz socho sir orz kshitij sir orz aryan maskara sir orz evenvalue orz aryan sir orz samik sir orz avighna sir orz sushil sir orz yash sir orz archit sir orz ola sir orz hashman sir orz hashman sir orz oviyan sir orz tiana chutiya */ #include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace std; using namespace __gnu_pbds; #define ordered_set tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> //variables and methods #define int long long #define endl '\n' const int INF = 1e18; //main method int32_t main() { ios::sync_with_stdio(false); cin.tie(nullptr); int n; cin>>n; int k; cin>>k; vector<pair<int, int>> modules(n); for (int i=0; i<n; i++) { cin>>modules[i].first; } for (int i=0; i<n; i++) { cin>>modules[i].second; } sort(modules.begin(), modules.end()); int p =0; int completed = 0; for (int i=0; i<n; i++) { if (p >= modules[i].first) { p+=modules[i].second; completed++; } else { break; } } cout<<completed; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...