제출 #601929

#제출 시각아이디문제언어결과실행 시간메모리
601929yutabi버섯 세기 (IOI20_mushrooms)C++14
25 / 100
96 ms292 KiB
#include "mushrooms.h" #include <bits/stdc++.h> using namespace std; #define pb push_back #define MAX_INT 3 int count_mushrooms(int n) { vector <int> blue{0}; vector <int> red; int i; for(i=1;blue.size()<MAX_INT && red.size()<MAX_INT && i<n;i++) { int res=use_machine({0,i}); if(res==0) { blue.pb(i); } else { red.pb(i); } } int ans=blue.size(); while(i<n) { vector <int> query; for(int j=0;j<MAX_INT && i<n;j++,i++) { if(blue.size()==MAX_INT) { query.pb(blue[j]); } else { query.pb(red[j]); } query.pb(i); } int res=use_machine(query); if(red.size()==MAX_INT) { ans+=(res+1)/2; } else { ans+=query.size()/2-(res+1)/2; } } return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...