#include <bits/stdc++.h>
using namespace std;
#define int long long
#define mid (start+end)/2
#define faster ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
vector <pair<int,int>> v;
int pre[100005];
vector <int> ger;
int32_t main(){
faster
int n,m;cin>>n>>m;
for(int i=1;i<=n;i++){
int a,b;
cin>>a>>b;
pre[i]=pre[i-1]+b;
ger.push_back(pre[i]);
v.push_back({a,b});
}
while(m--){
int a,b;cin>>a>>b;
int de=pre[a]+b;
int c=upper_bound(ger.begin(),ger.end(),de)-ger.begin();
if(ger[c]>=de)cout<<c<<'\n';
else cout<<0<<'\n';
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
52 ms |
4144 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |