# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
871308 | andrei_boaca | 버섯 세기 (IOI20_mushrooms) | C++17 | 1 ms | 344 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>
//#include "stub.cpp"
using namespace std;
int lim=100;
int val[20005];
int count_mushrooms(int n)
{
int nra=1,nrb=0;
val[0]=1;
vector<int> v={0,1};
int x=use_machine(v);
if(x==1)
{
val[1]=2;
nrb++;
}
else
{
val[1]=1;
nra++;
}
if(n==2)
return nra;
v={0,2};
x=use_machine(v);
if(x==1)
{
val[2]=2;
nrb++;
}
else
{
val[2]=1;
nra++;
}
x=-1;
int y=-1;
for(int i=1;i<=2;i++)
if(val[i]==1)
{
x=0;
y=i;
break;
}
if(x==-1)
{
x=1;
y=2;
}
int poz=3;
while(max(nra,nrb)<lim&&poz<n)
{
if(poz+1<n)
{
int ans=use_machine({x,poz,y,poz+1});
if(x==0)
{
if(ans==0)
{
nra+=2;
val[poz]=1;
val[poz+1]=1;
}
if(ans==1)
{
nra++;
nrb++;
val[poz]=1;
val[poz+1]=2;
}
if(ans==2)
{
nra++;
nrb++;
val[poz]=2;
val[poz+1]=1;
}
if(ans==3)
{
nrb+=2;
val[poz]=2;
val[poz+1]=2;
}
}
else
{
if(ans==3)
{
nra+=2;
val[poz]=1;
val[poz+1]=1;
}
if(ans==2)
{
nra++;
nrb++;
val[poz]=1;
val[poz+1]=2;
}
if(ans==1)
{
nra++;
nrb++;
val[poz]=2;
val[poz+1]=1;
}
if(ans==0)
{
nrb+=2;
val[poz]=2;
val[poz+1]=2;
}
}
poz+=2;
}
else
{
v={0,poz};
int ans=use_machine(v);
if(ans==1)
{
val[poz]=2;
nrb++;
}
else
{
val[poz]=1;
nra++;
}
return nra;
}
}
return nra;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |