제출 #576435

#제출 시각아이디문제언어결과실행 시간메모리
576435MrM7mdFountain (eJOI20_fountain)C++17
0 / 100
4 ms724 KiB
#include <bits/stdc++.h> using namespace std; #define int long long #define endl "\n" const int MOD = 1e9 + 7; pair<int,int> a[10000]; signed main(){ ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n,q; cin >> n>>q; for(int i=0;i<n;i++){ cin >> a[i].first>>a[i].second; } while(q--){ int r,v; cin >>r >> v; int cur=a[r-1].first; int ans; for(int i=r-1;i<n;i++){ if(a[i].first>=cur){ cur=a[i].first; v-=a[i].second; if(v<=0) { ans=i+1; break; } } } if(v>0)ans=0; cout<<ans<<endl; } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...