답안 #464725

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
464725 2021-08-13T20:42:49 Z jurgis Fountain (eJOI20_fountain) C++14
30 / 100
1500 ms 4896 KB
#include <iostream>
#include <bits/stdc++.h>
using namespace std;

int main()
{
    int n, q;cin>>n>>q; int d[n+1], c[n+1], r[q], v[q];
    for(int i=1; i<=n; i++){
        cin>>d[i]>>c[i];
    }
    for(int i=0; i<q;i++){cin>>r[i]>>v[i];}
    for(int i =0;i <q; i++){
        int pab = r[i]; int paskd = d[r[i]];v[i] -= c[r[i]];
        while(pab!= n+1 && v[i] >0){

            if(paskd<d[pab]){
                //cout<<"alip";
                v[i] -= c[pab];
                paskd = d[pab];
            }
            //cout<<"pask d " <<paskd<<" "<<pab<<" v[i] "<<v[i]<<endl;
            if(v[i] >0){
                 pab++;
            }

        }
        if(pab ==n+1){cout<<0<<"\n";}
        else{cout<<pab<<"\n";}
    }
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 2 ms 204 KB Output is correct
4 Correct 2 ms 204 KB Output is correct
5 Correct 4 ms 332 KB Output is correct
6 Correct 4 ms 332 KB Output is correct
7 Correct 3 ms 332 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1584 ms 4896 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 2 ms 204 KB Output is correct
4 Correct 2 ms 204 KB Output is correct
5 Correct 4 ms 332 KB Output is correct
6 Correct 4 ms 332 KB Output is correct
7 Correct 3 ms 332 KB Output is correct
8 Execution timed out 1584 ms 4896 KB Time limit exceeded
9 Halted 0 ms 0 KB -