답안 #878563

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
878563 2023-11-24T17:46:42 Z AlexMoysi Fountain (eJOI20_fountain) C++14
0 / 100
1500 ms 3692 KB
#include <iostream>
#include <vector>
using namespace std;

struct Reservoir
{
    int diameter, volume;
};

int main()
{
    int N, Q;
    
    cin>>N>>Q;
    
    vector<Reservoir> Res;
    Res.resize(N);
    
    for(size_t c=0; c<N; c++)
        cin>>Res[c].diameter>>Res[c].volume;
        
    for(size_t c=0; c<Q; c++)
    {
        int R, V;
        cin>>R>>V;
        R--;
        V-=Res[R].volume;
        
        while(V>0 && R<N-1)
        {
            if(Res[R+1].diameter > Res[R].diameter)
                V-=Res[R+1].volume;
            R++;    
        }
        R++;
        
        cout<<R%N<<endl;
    }    

    return 0;
}

Compilation message

fountain.cpp: In function 'int main()':
fountain.cpp:19:22: warning: comparison of integer expressions of different signedness: 'size_t' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   19 |     for(size_t c=0; c<N; c++)
      |                     ~^~
fountain.cpp:22:22: warning: comparison of integer expressions of different signedness: 'size_t' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   22 |     for(size_t c=0; c<Q; c++)
      |                     ~^~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1561 ms 3692 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -