이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
int main(){
int N,Q;
cin>>N>>Q;
int c;
pair <int,int> A[N];//diameter capacity
for (c=0;c<N;c++){
cin>>A[c].first>>A[c].second;
}
while (Q--){
int where,how_many;
cin>>where>>how_many;
where--;int mx=0;
int r;
int ans=0;
for (r=where;r<N;r++){
if (A[r].first>mx && ans==0){
mx=A[r].first;
how_many-=A[r].second;
if (how_many<=0){
ans=r+1;
break;}
}
}
cout<<ans<<endl;
}
return 0;}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |