제출 #1183473

#제출 시각아이디문제언어결과실행 시간메모리
1183473inesfiCounting Mushrooms (IOI20_mushrooms)C++20
25 / 100
26 ms632 KiB
#include "mushrooms.h" #include<bits/stdc++.h> using namespace std; int count_mushrooms(int n) { int rep=n; vector<int> q1,q2; q1.push_back(0); q1.push_back(1); if (n%2==1){ rep-=use_machine({0,n-1}); n--; } for (int i=2;i<n;i+=2){ int val=use_machine({0,i}); if (val==0){ q1.push_back(i); q1.push_back(i+1); } else { q2.push_back(i); q2.push_back(i+1); } } if (q2.size()!=0){ int r2=use_machine(q2); rep-=q2.size()-(r2+1)/2; } int r1=use_machine(q1); rep-=(r1+1)/2; //cerr<<rep<<endl; return rep; /*std::vector<int> m; for (int i = 0; i < n; i++) m.push_back(i); int c1 = use_machine(m); m = {0, 1}; int c2 = use_machine(m); return c1+c2;*/ }
#Verdict Execution timeMemoryGrader output
Fetching results...