Submission #1007110

#TimeUsernameProblemLanguageResultExecution timeMemory
1007110spensaFountain (eJOI20_fountain)C++17
30 / 100
47 ms4948 KiB
#include <iostream> #include <vector> #include <set> using namespace std; typedef long long ll; const int MXN = 1e5 + 10 ; int cap[MXN] = {0}; int di[MXN] = {0}; int pscap[MXN] = {0}; int main(){ //faster io ios_base::sync_with_stdio(false); cin.tie(NULL); //subtask 2 int N, Q; cin>>N>>Q; for(int i=1; i<=N; i++) cin>>di[i]>>cap[i]; for(int i=1; i<=N; i++) pscap[i] = pscap[i-1] + cap[i]; while(Q--){ int R, V; cin>>R>>V; int idx = lower_bound(pscap + R, pscap + N + 1, (V + pscap[R-1])) - (pscap); if(idx>N) cout<<"0\n"; else cout<<idx<<"\n"; } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...