답안 #783833

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
783833 2023-07-15T11:13:14 Z AndrijaM Fountain (eJOI20_fountain) C++14
0 / 100
100 ms 3956 KB
#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n,q;
    cin>>n>>q;
    vector<pair<int,int>>v;
    for(int i=0;i<n;i++)
    {
        int x,y;
        cin>>x>>y;
        v.push_back({x,y});
    }
    while(q--)
    {
        int x,y;
        cin>>x>>y;
        x--;
        if(n<=1005)
        {
            int d=v[x].first;///x-1
            y-=v[x].second;
            if(y>0)
            x++;
            if(y>0)
            while(true)
            {
                if(x>=n)
                {
                    break;
                }
                if(d<v[x].first)
                {
                    y-=v[x].second;
                    d=v[x].first;
                }
                if(y<=0)break;
                x++;
            }
            if(x>=n)x=0;
            if(x!=0)x++;
            cout<<x<<endl;
        }
    }
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 2 ms 212 KB Output is correct
3 Correct 3 ms 212 KB Output is correct
4 Incorrect 3 ms 308 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 100 ms 3956 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 2 ms 212 KB Output is correct
3 Correct 3 ms 212 KB Output is correct
4 Incorrect 3 ms 308 KB Output isn't correct
5 Halted 0 ms 0 KB -