Submission #435482

#TimeUsernameProblemLanguageResultExecution timeMemory
435482CollypsoCounting Mushrooms (IOI20_mushrooms)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #define ll long long #define ld long double #define pii pair<int, int> #define pll pair<ll, ll> #define vt vector #define pb push_back #define all(x) (x).begin(), (x).end() #define sz(x) (int) (x).size() #pragma GCC optimize ("O3") #pragma GCC optimize ("O2") #define F first #define S second //#define endl '\n' //#define int long long using namespace std; int use_machine(vt<int> x); int subtask1(int n) { int ans = 1; for(int i = 1; i < n - 1; i += 2) { int tmp = use_machine({i + 1, 0, i}); if (tmp == 0) ans += 2; else if (tmp == 1) ans += 1; } if (n % 2 == 0) ans += !use_machine({0, n - 1}); return ans; } int count_mushrooms(int n) { if (n <= 452) return subtask1(n); for(int i = 0; i < n; i++) group[i] = i; merge_group(0, n - 1); int sum = 1; for(int i = 1, cur = 1; i < n; i++) { if (group[i] != i - 1) cur = !cur; sum += cur; } //for(int i = 0; i < n; i++) cout << group[i] << " "; //cout << endl; return sum; }

Compilation message (stderr)

mushrooms.cpp: In function 'int count_mushrooms(int)':
mushrooms.cpp:38:32: error: 'group' was not declared in this scope
   38 |     for(int i = 0; i < n; i++) group[i] = i;
      |                                ^~~~~
mushrooms.cpp:39:5: error: 'merge_group' was not declared in this scope
   39 |     merge_group(0, n - 1);
      |     ^~~~~~~~~~~
mushrooms.cpp:43:13: error: 'group' was not declared in this scope
   43 |         if (group[i] != i - 1) cur = !cur;
      |             ^~~~~