#include <bits/stdc++.h>
#define ll long long
using namespace std;
int main() {
int N;
cin >> N;
vector<int> X;
for (int i = 0; i < N; i++) {
int Xi;
cin >> Xi;
X.push_back(Xi);
}
vector<int> L;
for (int i = 0; i < N; i++) {
int Li;
cin >> Li;
L.push_back(Li);
}
int ans = 0;
sort(X.begin(),X.end());
ll currLevel = 0;
ll cap = L.back();
vector<int>::iterator p = X.begin();
while ((currLevel <= cap)&&(p!=X.end())) {
ans++;
currLevel += *p;
p++;
}
cout << ans << endl;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
403 ms |
5236 KB |
Output is correct |
2 |
Correct |
416 ms |
5224 KB |
Output is correct |
3 |
Correct |
381 ms |
5240 KB |
Output is correct |
4 |
Correct |
419 ms |
5252 KB |
Output is correct |
5 |
Correct |
383 ms |
5344 KB |
Output is correct |
6 |
Correct |
352 ms |
5352 KB |
Output is correct |
7 |
Correct |
358 ms |
5280 KB |
Output is correct |
8 |
Correct |
376 ms |
5308 KB |
Output is correct |
9 |
Correct |
375 ms |
5324 KB |
Output is correct |
10 |
Correct |
350 ms |
5216 KB |
Output is correct |
11 |
Correct |
335 ms |
5316 KB |
Output is correct |
12 |
Correct |
341 ms |
5304 KB |
Output is correct |
13 |
Correct |
322 ms |
5316 KB |
Output is correct |
14 |
Correct |
321 ms |
5404 KB |
Output is correct |
15 |
Correct |
354 ms |
5320 KB |
Output is correct |
16 |
Correct |
337 ms |
5232 KB |
Output is correct |
17 |
Correct |
348 ms |
5312 KB |
Output is correct |
18 |
Correct |
343 ms |
5324 KB |
Output is correct |
19 |
Correct |
357 ms |
5240 KB |
Output is correct |
20 |
Correct |
365 ms |
5304 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |