Submission #1007110

# Submission time Handle Problem Language Result Execution time Memory
1007110 2024-06-24T11:55:43 Z spensa Fountain (eJOI20_fountain) C++17
30 / 100
47 ms 4948 KB
#include <iostream>
#include <vector>
#include <set>
using namespace std;
typedef long long ll;

const int MXN = 1e5 + 10 ;
int cap[MXN] = {0};
int di[MXN] = {0};
int pscap[MXN] = {0};

int main(){
    //faster io
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    //subtask 2
    int N, Q;
    cin>>N>>Q;

    for(int i=1; i<=N; i++) cin>>di[i]>>cap[i];
    for(int i=1; i<=N; i++) pscap[i] = pscap[i-1] + cap[i];

    while(Q--){
        int R, V;
        cin>>R>>V;

        int idx = lower_bound(pscap + R, pscap + N + 1, (V + pscap[R-1])) - (pscap);
        if(idx>N) cout<<"0\n";
        else cout<<idx<<"\n";
    }
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 44 ms 4836 KB Output is correct
2 Correct 47 ms 4948 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -