답안 #1024798

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1024798 2024-07-16T10:30:08 Z vjudge1 Fountain (eJOI20_fountain) C++14
30 / 100
1500 ms 2164 KB
#include <bits/stdc++.h>

using namespace std;

int main()
{
    long long n,q;
    cin>>n>>q;
    pair<long long,long long> niza[n];
    for(long long i=0; i<n; i++)cin>>niza[i].first>>niza[i].second;
    for(long long i=0; i<q; i++)
    {
        long long r,v;
        cin>>r>>v;
        r--;
        v-=niza[r].second;
        if(v<=0)
        {
            cout<<r+1<<endl;
            continue;
        }
        long long last=niza[r].first;
        r++;
        while(v>0)
        {
            if(niza[r].first>last)
            {
                v-=niza[r].second;
                last=niza[r].first;
                if(v<=0)break;
            }
            r++;
            if(r==n)break;
        }
        if(r>=n)
        {
            cout<<0<<endl;
        }
        else
        {
            cout<<r+1<<endl;
        }
    }
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 2 ms 348 KB Output is correct
4 Correct 2 ms 348 KB Output is correct
5 Correct 4 ms 348 KB Output is correct
6 Correct 4 ms 348 KB Output is correct
7 Correct 4 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1572 ms 2164 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 2 ms 348 KB Output is correct
4 Correct 2 ms 348 KB Output is correct
5 Correct 4 ms 348 KB Output is correct
6 Correct 4 ms 348 KB Output is correct
7 Correct 4 ms 348 KB Output is correct
8 Execution timed out 1572 ms 2164 KB Time limit exceeded
9 Halted 0 ms 0 KB -