Submission #1116367

#TimeUsernameProblemLanguageResultExecution timeMemory
1116367giaanGym Badges (NOI22_gymbadges)C++14
0 / 100
101 ms18040 KiB
#include<bits/stdc++.h> #define int long long using namespace std; int n, dem = 0, dem1 = 0; pair<int, int> p[1000005]; signed main() { ios_base::sync_with_stdio(false); cin.tie(0); cin >> n; for(int i = 1; i <= n; i++){ cin >> p[i].first; } for(int i = 1; i <= n; i++){ cin >> p[i].second; } sort(p + 1, p + n + 1); for(int i = 1; i <= n; i++){ if(dem <= p[i].second){ dem += p[i].first; dem1++; cout << dem << '\n'; } } cout << dem1; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...