제출 #424123

#제출 시각아이디문제언어결과실행 시간메모리
424123Supersonic버섯 세기 (IOI20_mushrooms)C++14
25 / 100
144 ms244 KiB
#include "mushrooms.h" #include <bits/stdc++.h> using namespace std; int count_mushrooms(int n) { vector<int> a={0}; vector<int> b;int c=1; while(a.size()<2&&b.size()<2&&c<n){ int k=use_machine({0,c}); if(k==1)b.push_back(c);else a.push_back(c); c++; } int ca=a.size(),cb=b.size(); if(c==n)return ca; if(a.size()==2){ //cerr<<a[0]<<':'<<a[1]<<endl; while(c<n-1){ cb+=(use_machine({a[0],c,a[1],c+1})+1)/2;c+=2; } if(c<n)cb+=use_machine({a[0],c}); return n-cb; } else { while(c<n-1){ ca+=(use_machine({b[0],c,b[1],c+1})+1)/2;c+=2; } if(c<n)ca+=use_machine({b[0],c}); return ca; } exit(1); }
#Verdict Execution timeMemoryGrader output
Fetching results...