Submission #1136427

#TimeUsernameProblemLanguageResultExecution timeMemory
1136427MunkhturErdenebatFountain (eJOI20_fountain)C++20
0 / 100
32 ms1860 KiB
#include<bits/stdc++.h> #include<string.h> #include <algorithm> #include <stdlib.h> #define ll long long using namespace std; ll a,b,c,d,e,f,m,i,j,n,h,g,l,r,ka,p,t[1000005]; map<ll,ll> maa,mii,mee; vector<ll> vas,vis,vii; pair<ll,ll> fgh,k[1000005]; string x[1000]; int main(){ cin>>a>>b; for(i=1 ; i<=a ; i++){ cin>>k[i].first>>k[i].second; } k[a+1].first=100000000000; k[a+1].second=100000000000; if(a<=1000 && b<=2000){ while(b--){ cin>>c>>d; g=k[c].first; h=k[c].second; if(h>=d){ cout<<c<<endl; continue; } for(i=c+1 ; i<=a+1 ; i++){ if(k[i].first>g){ g=k[i].first; h-=k[i].second; } if(h<=0){ break; } } if(i==a+1){ cout<<0<<endl; continue; } cout<<i<<endl; } } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...