# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1080215 | Muhammad_Aneeq | Counting Mushrooms (IOI20_mushrooms) | C++17 | 8 ms | 600 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 <vector>
#include <iostream>
using namespace std;
int use_machine(vector<int> x);
int count_mushrooms(int n)
{
vector<int>sz[2]={};
sz[0].push_back(0);
int mx=88;
for (int i=1;i<n;i++)
{
sz[use_machine({0,i})].push_back(i);
if (sz[0].size()>=mx||sz[1].size()>=mx)
break;
}
if (sz[1].size()>sz[0].size())
swap(sz[0],sz[1]);
int cnt[2]={};
cnt[0]=sz[0].size();
for (int i=sz[0].size()+sz[1].size();i<n;i+=mx)
{
vector<int>qu;
int f=min(i+mx,n)-i;
for (int j=i;j<min(i+mx,n);j++)
{
qu.push_back(j);
qu.push_back(sz[0][j-i]);
}
int x=use_machine(qu);
cnt[0]+=f-(x+1)/2;
}
cnt[1]=n-cnt[0];
if (sz[0][0]==0)
return cnt[0];
return cnt[1];
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |