제출 #1229587

#제출 시각아이디문제언어결과실행 시간메모리
1229587yixuan19사육제 (CEOI14_carnival)C++20
컴파일 에러
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{ bool found = false; for (int j = 1; j < i-1; ++j){ cout<<2<<' '<<j<<' '<<i<<endl; cin >> res; if (res == 1){ sol[i] = sol[j]; found = true; break; } } if (!found){ sol[i] = sol[i-1]; } } // 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; }

컴파일 시 표준 에러 (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:48:21: error: 'sol' was not declared in this scope
   48 |                     sol[i] = sol[j];
      |                     ^~~
carnival.cpp:54:17: error: 'sol' was not declared in this scope
   54 |                 sol[i] = sol[i-1];
      |                 ^~~
carnival.cpp:65:15: error: 'sol' was not declared in this scope
   65 |         cout<<sol[i]<<' ';
      |               ^~~