# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
601929 | yutabi | Counting Mushrooms (IOI20_mushrooms) | C++14 | 96 ms | 292 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;
#define pb push_back
#define MAX_INT 3
int count_mushrooms(int n)
{
vector <int> blue{0};
vector <int> red;
int i;
for(i=1;blue.size()<MAX_INT && red.size()<MAX_INT && i<n;i++)
{
int res=use_machine({0,i});
if(res==0)
{
blue.pb(i);
}
else
{
red.pb(i);
}
}
int ans=blue.size();
while(i<n)
{
vector <int> query;
for(int j=0;j<MAX_INT && i<n;j++,i++)
{
if(blue.size()==MAX_INT)
{
query.pb(blue[j]);
}
else
{
query.pb(red[j]);
}
query.pb(i);
}
int res=use_machine(query);
if(red.size()==MAX_INT)
{
ans+=(res+1)/2;
}
else
{
ans+=query.size()/2-(res+1)/2;
}
}
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |