Submission #1229582

#TimeUsernameProblemLanguageResultExecution timeMemory
1229582yixuan19Carnival (CEOI14_carnival)C++20
Compilation error
0 ms0 KiB
#include <iostream> using namespace std; int main(){ int N; cin >> N; vector<int> sol(N+1,0); cout<<2<<' '<<1<<' '<<2<<endl; int res; cin >> res; if (res == 2){ sol[1] = 1; sol[2] = 2; }else{ sol[1] = 1; sol[2] = 1; } // for (int i = 1; i <= N; ++i){ // cout<<sol[i]<<' '; // } // cout<<endl; vector<int> people; int num = 2; people.push_back(1); people.push_back(2); int memo = res; for (int i = 3; i <= N; ++i){ people.push_back(i); num++; cout<<num<<' '; for (int in: people){ cout<<in<<' '; } cout<<endl; cin >> res; if (res > memo){ sol[i] = res; memo = res; }else{ for (int j = 1; j < i-1; ++j){ cout<<2<<' '<<j<<' '<<i<<endl; cin >> res; if (res == 1){ sol[i] = sol[j]; break; } } } // for (int i = 1; i <= N; ++i){ // cout<<sol[i]<<' '; // } // cout<<endl; } cout<<0<<' '; for (int i = 1; i <= N; ++i){ cout<<sol[i]<<' '; } cout<<endl; }

Compilation message (stderr)

carnival.cpp: In function 'int main()':
carnival.cpp:9:5: error: 'vector' was not declared in this scope
    9 |     vector<int> sol(N+1,0);
      |     ^~~~~~
carnival.cpp:2:1: note: 'std::vector' is defined in header '<vector>'; did you forget to '#include <vector>'?
    1 | #include <iostream>
  +++ |+#include <vector>
    2 | 
carnival.cpp:9:12: error: expected primary-expression before 'int'
    9 |     vector<int> sol(N+1,0);
      |            ^~~
carnival.cpp:15:9: error: 'sol' was not declared in this scope
   15 |         sol[1] = 1;
      |         ^~~
carnival.cpp:18:9: error: 'sol' was not declared in this scope
   18 |         sol[1] = 1;
      |         ^~~
carnival.cpp:25:12: error: expected primary-expression before 'int'
   25 |     vector<int> people;
      |            ^~~
carnival.cpp:27:5: error: 'people' was not declared in this scope
   27 |     people.push_back(1);
      |     ^~~~~~
carnival.cpp:40:13: error: 'sol' was not declared in this scope
   40 |             sol[i] = res;
      |             ^~~
carnival.cpp:47:21: error: 'sol' was not declared in this scope
   47 |                     sol[i] = sol[j];
      |                     ^~~
carnival.cpp:60:15: error: 'sol' was not declared in this scope
   60 |         cout<<sol[i]<<' ';
      |               ^~~