Submission #878111

# Submission time Handle Problem Language Result Execution time Memory
878111 2023-11-24T05:38:16 Z AndreasK Fountain (eJOI20_fountain) C++14
30 / 100
1500 ms 3560 KB
#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
1 Correct 0 ms 348 KB Output is correct
2 Correct 2 ms 348 KB Output is correct
3 Correct 2 ms 348 KB Output is correct
4 Correct 3 ms 348 KB Output is correct
5 Correct 4 ms 348 KB Output is correct
6 Correct 4 ms 472 KB Output is correct
7 Correct 5 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 1572 ms 3560 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 2 ms 348 KB Output is correct
3 Correct 2 ms 348 KB Output is correct
4 Correct 3 ms 348 KB Output is correct
5 Correct 4 ms 348 KB Output is correct
6 Correct 4 ms 472 KB Output is correct
7 Correct 5 ms 348 KB Output is correct
8 Execution timed out 1572 ms 3560 KB Time limit exceeded
9 Halted 0 ms 0 KB -