# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
411657 | JUANDI321 | Counting Mushrooms (IOI20_mushrooms) | C++17 | 1 ms | 200 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 <iostream>
#include <vector>
using namespace std;
vector<int> x;
int count_mushrooms(int n)
{
int m = (n-1)%4;
long long A = 1;
for(int i = 1; i<n-m; i+=4)
{
x.push_back(i);
x.push_back(i+1);
x.push_back(i+2);
x.push_back(i+3);
int p = use_machine(x);
if(p == 0)
{
x.push_back(0);
int pp = use_machine(x);
if(pp == 0)A+=4;
}
if(p==1)
{
x.clear();
x.push_back(i+1);
x.push_back(0);
x.push_back(i+2);
int pp = use_machine(x);
if(pp == 2)A+=1;
if(pp == 1)A+=2;
if(pp == 0)A+=3;
}
if(p==2)
{
x.push_back(0);
int pp = use_machine(x);
if(pp == 2)A+=3;
}
if(p==3)A+=2;
}
x.clear();
x.push_back(0);
for(int i = n-m; i<n; i++)
{
x.push_back(i);
int p = use_machine(x);
if(p == 0)A++;
x.pop_back();
}
return A;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |