Submission #432497

#TimeUsernameProblemLanguageResultExecution timeMemory
432497TryMaxCounting Mushrooms (IOI20_mushrooms)C++17
10 / 100
223 ms320 KiB
#include "mushrooms.h" #include <bits/stdc++.h> #ifdef LOCAL #include "stub.cpp" #endif // LOCAL #define f first #define s second #define pb push_back using namespace std; const int N = 2e5 + 10, C = 1; int a[N]; int count_mushrooms(int n){ int ans = 1; for(int i = 1; i < C; ++i){ if(i >= n) break; vector<int> x; x.pb(i - 1); x.pb(i); a[i] = a[i - 1] ^ use_machine(x); ans += (a[i] == 0); } for(int i = 1; i <= (n + C - 1) / C; ++i){ vector<int> x; for(int j = 0; j < min(n, C); ++j) if(a[j] == 0){ if(i * C + j >= n) break; x.pb(j), x.pb(i * C + j); } if(!x.empty()){ int cntb = (use_machine(x) + 1) / 2; ans += (min(n, (i + 1) * C) - i * C) - cntb; } // x.clear(); // for(int j = 0; j < min(n, C); ++j) // if(a[j] == 1){ // if(i * C + j >= n) // break; // x.pb(j), x.pb(i * C + j); // } // if(!x.empty()){ // int cnta = (use_machine(x) + 1) / 2; // ans += cnta; // } } return ans; } /* 3 0 1 1 1 2 4 0 1 0 0 3 2 */
#Verdict Execution timeMemoryGrader output
Fetching results...