Submission #620105

#TimeUsernameProblemLanguageResultExecution timeMemory
620105Jovan26Fountain (eJOI20_fountain)C++14
30 / 100
1581 ms4304 KiB
#include<iostream> using namespace std; int main(){ int n,q; cin>>n>>q; int d[n+1],c[n+1],r[q],v[q]; d[0]=0; c[0]=0; for(int i=1;i<=n;i++){ cin>>d[i]>>c[i]; } int p; for(int i=0;i<q;i++){ cin>>r[i]>>v[i]; p=0; for(int j=r[i];j<=n;j++){ if(d[j]>p){ v[i]-=c[j]; p=d[j]; } if(v[i]<=0) { cout<<j<<endl; break; } if(j==n){ cout<<0<<endl; break; } } } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...