#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 time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
336 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
101 ms |
18040 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
336 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
336 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |