This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |