# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
346061 | Chayanin_K | 버섯 세기 (IOI20_mushrooms) | C++17 | 1 ms | 364 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "mushrooms.h"
#include <bits/stdc++.h>
using namespace std;
int count_mushrooms(int n) {
vector <int> A, B, send;
int res, nowi = 1, cnta = 1, cnt = 0;
A.push_back(0);
while(nowi < n){
if(A.size() >= B.size()){
cnt = 0;
send.clear();
for(int x: A){
if(nowi >= n)
break;
send.push_back(x);
send.push_back(nowi);
nowi++;
cnt++;
}
res = use_machine(send);
if(res%2==1){
B.push_back(nowi-1);
}
else{
cnta += cnt - ((res+1) / 2);
A.push_back(nowi-1);
}
}
else{
send.clear();
for(int x: B){
if(nowi >= n)
break;
send.push_back(x);
send.push_back(nowi);
nowi++;
}
res = use_machine(send);
if(res%2==1){
A.push_back(nowi-1);
cnta += (res+1) / 2;
}
else{
B.push_back(nowi-1);
}
}
}
return cnta;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |