제출 #306690

#제출 시각아이디문제언어결과실행 시간메모리
306690ivan24버섯 세기 (IOI20_mushrooms)C++14
컴파일 에러
0 ms0 KiB
bool t = 0; if (byType[t].size() < 2){ t = 1; } ll res = use_machine(vi{x,byType[t][0],y,byType[t][1]}); add_type(x,(res&1) ? !t : t); add_type(y,(res&2) ? !t : t); } public: Solver(ll n): n(n), isChecked(n,0), type(n,-1), ctr(2,0), byType(2){ type[0] = 0; ctr[0]++; byType[0].push_back(0); } int solve(){ addOne(1); if (n > 2) addOne(2); for (ll i = 2; n > 2*i; i++){ addTwo(2*i-1,2*i); } if (n%2 == 1){ addOne(n-1); } return ctr[0]; } }; int count_mushrooms(int n) { Solver mySolver(n); return mySolver.solve(); }

컴파일 시 표준 에러 (stderr) 메시지

mushrooms.cpp:3:9: error: expected unqualified-id before 'if'
    3 |         if (byType[t].size() < 2){
      |         ^~
mushrooms.cpp:6:9: error: 'll' does not name a type
    6 |         ll res = use_machine(vi{x,byType[t][0],y,byType[t][1]});
      |         ^~
mushrooms.cpp:6:63: error: expected unqualified-id before ')' token
    6 |         ll res = use_machine(vi{x,byType[t][0],y,byType[t][1]});
      |                                                               ^
mushrooms.cpp:7:17: error: expected constructor, destructor, or type conversion before '(' token
    7 |         add_type(x,(res&1) ? !t : t);
      |                 ^
mushrooms.cpp:8:17: error: expected constructor, destructor, or type conversion before '(' token
    8 |         add_type(y,(res&2) ? !t : t);
      |                 ^
mushrooms.cpp:9:5: error: expected declaration before '}' token
    9 |     }
      |     ^
mushrooms.cpp:10:1: error: expected unqualified-id before 'public'
   10 | public:
      | ^~~~~~
mushrooms.cpp: In function 'int solve()':
mushrooms.cpp:18:9: error: 'addOne' was not declared in this scope
   18 |         addOne(1);
      |         ^~~~~~
mushrooms.cpp:19:13: error: 'n' was not declared in this scope
   19 |         if (n > 2) addOne(2);
      |             ^
mushrooms.cpp:20:14: error: 'll' was not declared in this scope
   20 |         for (ll i = 2; n > 2*i; i++){
      |              ^~
mushrooms.cpp:20:24: error: 'n' was not declared in this scope
   20 |         for (ll i = 2; n > 2*i; i++){
      |                        ^
mushrooms.cpp:20:30: error: 'i' was not declared in this scope
   20 |         for (ll i = 2; n > 2*i; i++){
      |                              ^
mushrooms.cpp:21:13: error: 'addTwo' was not declared in this scope
   21 |             addTwo(2*i-1,2*i);
      |             ^~~~~~
mushrooms.cpp:23:13: error: 'n' was not declared in this scope
   23 |         if (n%2 == 1){
      |             ^
mushrooms.cpp:26:16: error: 'ctr' was not declared in this scope
   26 |         return ctr[0];
      |                ^~~
mushrooms.cpp: At global scope:
mushrooms.cpp:28:1: error: expected declaration before '}' token
   28 | };
      | ^
mushrooms.cpp: In function 'int count_mushrooms(int)':
mushrooms.cpp:31:5: error: 'Solver' was not declared in this scope; did you mean 'solve'?
   31 |     Solver mySolver(n);
      |     ^~~~~~
      |     solve
mushrooms.cpp:32:12: error: 'mySolver' was not declared in this scope
   32 |     return mySolver.solve();
      |            ^~~~~~~~