Submission #484636

#TimeUsernameProblemLanguageResultExecution timeMemory
484636AmirElarbiCounting Mushrooms (IOI20_mushrooms)C++14
Compilation error
0 ms0 KiB
#include "mushrooms.h"
 
#include <bits/stdc++.h>
 
 
using namespace std;
 
 
 
int count_mushrooms(int n) {
    int X = 199;
    vi typ[2];
    for(int i = 1; i <= min(n-1,X); i++){
        typ[use_machine({0,i})].pb(i);
    }
    cnt = typ[0].size()+typ[1].size();
    for (int i = 200; i < n; i+=200)
    {
        vi a;
        for(int j = i; j < i+typ[0].size();j++){
            a.pb(typ[0][u]);
            a.pb(i);
        }
        int res = use_machine(a);
        if(typ[0].size() == 0)
            cnt += typ[0].size()-(res/2)-1;
        else {
            cnt += typ[0].size()-((res+1)/2);
        }
        a.clear();
        for(int j = i+typ[0].size(); j < i+200;j++){
            a.pb(j-i+typ[0].size());
            a.pb(j);
        }
        res = use_machine(a);
        if(typ[1].size() == 0)
            cnt += (res/2)-1;
        else {
            cnt += ((res+1)/2);
        }
    }
    return cnt;
 
}

Compilation message (stderr)

mushrooms.cpp: In function 'int count_mushrooms(int)':
mushrooms.cpp:12:5: error: 'vi' was not declared in this scope
   12 |     vi typ[2];
      |     ^~
mushrooms.cpp:14:9: error: 'typ' was not declared in this scope
   14 |         typ[use_machine({0,i})].pb(i);
      |         ^~~
mushrooms.cpp:16:5: error: 'cnt' was not declared in this scope; did you mean 'int'?
   16 |     cnt = typ[0].size()+typ[1].size();
      |     ^~~
      |     int
mushrooms.cpp:16:11: error: 'typ' was not declared in this scope
   16 |     cnt = typ[0].size()+typ[1].size();
      |           ^~~
mushrooms.cpp:19:11: error: expected ';' before 'a'
   19 |         vi a;
      |           ^~
      |           ;
mushrooms.cpp:21:13: error: 'a' was not declared in this scope
   21 |             a.pb(typ[0][u]);
      |             ^
mushrooms.cpp:21:25: error: 'u' was not declared in this scope
   21 |             a.pb(typ[0][u]);
      |                         ^
mushrooms.cpp:24:31: error: 'a' was not declared in this scope
   24 |         int res = use_machine(a);
      |                               ^