Submission #306878

#TimeUsernameProblemLanguageResultExecution timeMemory
306878ivan24Counting Mushrooms (IOI20_mushrooms)C++14
Compilation error
0 ms0 KiB
); add_type(x,res); } bool addTwo(ll x, ll y){ 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 (type[n-1] == -1){ addOne(n-1); } } return ctr[0]; } }; int count_mushrooms(int n) { Solver mySolver(n); return mySolver.solve(); }

Compilation message (stderr)

mushrooms.cpp:1:1: error: expected unqualified-id before ')' token
    1 | );
      | ^
mushrooms.cpp:2:17: error: expected constructor, destructor, or type conversion before '(' token
    2 |         add_type(x,res);
      |                 ^
mushrooms.cpp:3:5: error: expected declaration before '}' token
    3 |     }
      |     ^
mushrooms.cpp:5:17: error: 'll' was not declared in this scope
    5 |     bool addTwo(ll x, ll y){
      |                 ^~
mushrooms.cpp:5:23: error: 'll' was not declared in this scope
    5 |     bool addTwo(ll x, ll y){
      |                       ^~
mushrooms.cpp:5:27: error: expression list treated as compound expression in initializer [-fpermissive]
    5 |     bool addTwo(ll x, ll y){
      |                           ^
mushrooms.cpp:14:1: error: expected unqualified-id before 'public'
   14 | public:
      | ^~~~~~
mushrooms.cpp: In function 'int solve()':
mushrooms.cpp:22:9: error: 'addOne' was not declared in this scope
   22 |         addOne(1);
      |         ^~~~~~
mushrooms.cpp:23:13: error: 'n' was not declared in this scope
   23 |         if (n > 2){
      |             ^
mushrooms.cpp:25:18: error: 'll' was not declared in this scope
   25 |             for (ll i = 2; n > 2*i; i++){
      |                  ^~
mushrooms.cpp:25:34: error: 'i' was not declared in this scope
   25 |             for (ll i = 2; n > 2*i; i++){
      |                                  ^
mushrooms.cpp:26:33: error: 'addTwo' cannot be used as a function
   26 |                 addTwo(2*i-1,2*i);
      |                                 ^
mushrooms.cpp:28:17: error: 'type' was not declared in this scope
   28 |             if (type[n-1] == -1){
      |                 ^~~~
mushrooms.cpp:32:16: error: 'ctr' was not declared in this scope
   32 |         return ctr[0];
      |                ^~~
mushrooms.cpp: At global scope:
mushrooms.cpp:34:1: error: expected declaration before '}' token
   34 | };
      | ^
mushrooms.cpp: In function 'int count_mushrooms(int)':
mushrooms.cpp:37:5: error: 'Solver' was not declared in this scope; did you mean 'solve'?
   37 |     Solver mySolver(n);
      |     ^~~~~~
      |     solve
mushrooms.cpp:38:12: error: 'mySolver' was not declared in this scope
   38 |     return mySolver.solve();
      |            ^~~~~~~~