제출 #1234011

#제출 시각아이디문제언어결과실행 시간메모리
1234011walizamaneeCounting Mushrooms (IOI20_mushrooms)C++20
91.50 / 100
3 ms456 KiB
#include<bits/stdc++.h> #include "mushrooms.h" using namespace std; int count_mushrooms(int n) { vector<int> one , two , m; int lol , ek , dui; one.clear(); two.clear(); int here = 1; one.push_back(0); for( int z = 1; z < min( 3 , n ); z++ ) { m.clear(); m = {0 , here}; lol = use_machine(m); if( lol == 1 ){ two.push_back(here); here++; } else{ one.push_back(here); here++; } } int typ = 0; if( (int)two.size() == 2 ) { swap( one , two ); typ = 1; } while( here + 1 < min(n , 113) ) { m.clear(); m.push_back(here); m.push_back(one[0]); m.push_back(here + 1); m.push_back(one[1]); int lel = use_machine(m); if( (lel & 1) > 0 ) two.push_back(here); else one.push_back(here); if( (lel & 2) > 0 ) two.push_back(here + 1); else one.push_back(here + 1); here += 2; } if( typ == 1 ) swap( one , two ); ek = one.size(); dui = two.size(); while( here < n ) { if( one.size() >= two.size() ) { if( one.size() == 1 ) { m.clear(); m = {0 , here}; lol = use_machine(m); if( lol == 1 ){ two.push_back(here); dui++; here++; } else{ one.push_back(here); here++; ek++; } } else{ m.clear(); m.push_back(0); for( int z = 1; z < (int)one.size(); z++ ) { if( here < n - 1 ) { m.push_back(here); here++; } m.push_back(one[z]); } m.push_back(here); here++; lol = use_machine(m); if( lol % 2 == 0 ) { one.push_back(here - 1); ek++; } else{ lol--; two.push_back(here - 1); dui++; } lol = lol / 2; dui += lol; ek = (here - dui); } } else{ m.clear(); m.push_back(two[0]); for( int z = 1; z < (int)two.size(); z++ ) { if( here < n - 1 ) { m.push_back(here); here++; } m.push_back(two[z]); } m.push_back(here); here++; lol = use_machine(m); if( lol % 2 == 0 ) { two.push_back(here - 1); dui++; } else{ lol--; one.push_back(here - 1); ek++; } lol = lol / 2; ek += lol; dui = (here - ek); } } cerr << ek << " " << dui << "\n"; return ek; }
#Verdict Execution timeMemoryGrader output
Fetching results...