# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
399097 | Antekb | 버섯 세기 (IOI20_mushrooms) | C++17 | 13 ms | 396 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>
#define st first
#define nd second
#define pb(x) push_back(x)
using namespace std;
int count_mushrooms(int n) {
vector<int> A, B, C(n-1);
A.pb(0);
iota(C.begin(), C.end(), 1);
int k=400;
for(int i=0; i<k && size(C); i++){
int c1 = use_machine({0, C.back()});
if(c1==1)B.pb(C.back());
else A.pb(C.back());
C.pop_back();
}
bool swa=0;
if(A.size()<B.size()){
swap(A, B);
swa=1;
}
int a=size(A),b=size(B);
while(C.size()){
int t=min(A.size(), C.size());
vector<int> V;
for(int i=0; i<t; i++){
V.pb(A[i]);
V.pb(C.back());
C.pop_back();
}
int c=use_machine(V);
b+=(c+1)/2;
a+=t-(c+1)/2;
}
if(swa)swap(a, b);
return a;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |