#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=lower_bound(ger.begin(),ger.end(),de)-ger.begin();
if(c==n)cout<<0<<'\n';
else cout<<c<<'\n';
}
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
56 ms |
4212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |