Submission #1127414

#TimeUsernameProblemLanguageResultExecution timeMemory
1127414khanhphucscratchFountain (eJOI20_fountain)C++20
30 / 100
1595 ms1296 KiB
//Subtask 1 #include<bits/stdc++.h> using namespace std; int capacity[100005], diameter[100005]; int main() { ios_base::sync_with_stdio(false); cin.tie(0); int n, q; cin>>n>>q; for(int i = 1; i <= n; i++) cin>>diameter[i]>>capacity[i]; for(int test = 0; test < q; test++){ int v, r; cin>>r>>v; int last = -1; while(v > 0){ while(r <= n && diameter[r] <= last) r++; if(r > n) break; v -= capacity[r]; last = diameter[r]; //cout<<"A"<<r<<" "<<v<<endl; } if(v > 0) cout<<0<<'\n'; else cout<<r<<'\n'; } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...