# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
588921 | LIF | Counting Mushrooms (IOI20_mushrooms) | C++14 | 122 ms | 464 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;
int count_mushrooms(int n) {
std::vector <int> m;
int aans = 1;
int pointer = 1;
bool check[200005];
for(int i=0;i<n;i++)
{
check[i] = false;
}
check[0] = true;
while(pointer+1<n)
{
m.push_back(pointer);
m.push_back(0);
m.push_back(pointer+1);
int ans = use_machine(m);
aans += (2-ans);
m.clear();
check[pointer] = true;
check[pointer+1] = true;
pointer += 2;
}
m.push_back(0);
for(int i=pointer-2;i<n;i++)
{
if(check[i] == false)
{
m.push_back(i);
if(use_machine(m) == 0)
{
aans++;
}
m.pop_back();
}
}
return aans;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |