답안 #879965

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
879965 2023-11-28T12:12:29 Z AlexMoysi Fountain (eJOI20_fountain) C++14
컴파일 오류
0 ms 0 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;                int r = R;        while(V>0 && r<N)        {            if(Res[r].diameter > Res[R].diameter)            {                V-=Res[r].volume;                R=r;            }            r++;            }        R++;       if(r == N)            R = 0;                cout<<R<<endl;    }        return 0;}

Compilation message

fountain.cpp:1:20: warning: extra tokens at end of #include directive
    1 | #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;                int r = R;        while(V>0 && r<N)        {            if(Res[r].diameter > Res[R].diameter)            {                V-=Res[r].volume;                R=r;            }            r++;            }        R++;       if(r == N)            R = 0;                cout<<R<<endl;    }        return 0;}
      |                    ^
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/10/../../../x86_64-linux-gnu/crt1.o: in function `_start':
(.text+0x24): undefined reference to `main'
collect2: error: ld returned 1 exit status