Submission #991947

#TimeUsernameProblemLanguageResultExecution timeMemory
991947elesisGym Badges (NOI22_gymbadges)C++14
9 / 100
295 ms16212 KiB
#include <bits/stdc++.h> using namespace std; #define int long long #define ff first #define ss second #define pii pair<int,int> bool cmp(pii a ,pii b) { return a.ff < b.ff; } void solve() { int n; cin>>n; vector <int> x(n),l(n); vector <pii> a(n); for(int i=0;i<n;i++) { cin>>x[i]; a[i].ff = x[i]; } for(int i=0;i<n;i++) { cin>>l[i]; a[i].ss = l[i]; } sort(a.begin(),a.end()); int cur = 0; int ans = n; for(int i=0;i<n;i++) { if(cur>l[0]) { ans = i; break; } cur += a[i].ff; //cout << cur << " " << ans << "\n"; } cout << ans << "\n"; } signed main() { solve(); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...