Submission #1302768

#TimeUsernameProblemLanguageResultExecution timeMemory
1302768sano버섯 세기 (IOI20_mushrooms)C++20
0 / 100
1 ms332 KiB
#include "mushrooms.h" #include <iostream> #include <set> #define vec vector #define For(i, n) for(int i = 0; i < n; i++) using namespace std; void vypis(vec<int>&x){ for(auto i : x) cerr << i << ' '; cout << endl; return; } int count_mushrooms(int n) { vec<int> odp(n, 0); vec<int> mo; vec<int> p(2, 0); mo = {0, 1}; int x = use_machine(mo); if(n == 2){ if(x == 0) return 2; return 1; } odp[1] = x; mo = {1, 2}; x = use_machine(mo); if(x == 1) odp[2] = 1 - odp[1]; else odp[2] = odp[1]; int typ = 0; if(p[1] >= 2){ typ = 1; } mo.clear(); For(i, 3){ if(odp[i] == typ && mo.size() < 2) mo.push_back(i); } vypis(mo); for (int i = 3; i < n; i+=2) { vec<int> nm; nm.push_back(mo[0]); nm.push_back(i); nm.push_back(mo[1]); if(i+1 < n) nm.push_back(i+1); x = use_machine(nm); if((x % 2) == 1){ odp[i+1] = 1 - typ; } else{ odp[i+1] = typ; } if(x > 1){ odp[i] = 1 - typ; } else{ odp[i] = typ; } } For(i, n){ p[odp[i]]++; } return p[0]; }
#Verdict Execution timeMemoryGrader output
Fetching results...