| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 306617 | daniel920712 | Counting Mushrooms (IOI20_mushrooms) | C++14 | 11 ms | 384 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 <vector>
#include <math.h>
using namespace std;
vector < int > A,B;
vector < int > temp;
int count_mushrooms(int N)
{
int k=floor(sqrt(2*N)),ans=0,x=0,y=0,i,now;
for(i=1;i<=k;i++)
{
temp.clear();
temp.push_back(0);
temp.push_back(i);
if(use_machine(temp))
{
x++;
B.push_back(i);
}
else
{
y++;
A.push_back(i);
}
}
if(x>=y)
{
now=k+1;
while(now<N)
{
temp.clear();
for(auto i:B)
{
temp.push_back(i);
if(now<N)
{
temp.push_back(now);
now++;
}
}
ans+=(use_machine(temp)+1)/2;
}
}
else
{
now=k+1;
while(now<N)
{
temp.clear();
for(auto i:A)
{
temp.push_back(i);
if(now<N)
{
temp.push_back(now);
now++;
}
}
ans+=(temp.size()-y-(use_machine(temp)+1)/2);
}
}
ans+=y;
return ans+1;
}
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
