#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
ll n,k;
cin>>n>>k;
vector<pair<ll,ll>> arr(n);
for (int i = 0; i < n; ++i)
{
cin>>arr[i].first;
}
for (int i = 0; i < n; ++i)
{
cin>>arr[i].second;
}
sort(arr.begin(), arr.end());
ll crr = 0;
int ans = 0;
for (int i = 0; i < n; ++i)
{
if (crr<arr[i].first) break;
ans++;
crr+=arr[i].second;
}
cout<<ans<<endl;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |