Submission #432718

#TimeUsernameProblemLanguageResultExecution timeMemory
432718MOUF_MAHMALATCounting Mushrooms (IOI20_mushrooms)C++14
0 / 100
1 ms200 KiB
#include "mushrooms.h"
#include<bits/stdc++.h>
using namespace std;
typedef int ll;
ll ans=1,x;
int count_mushrooms(int n)
{
    for(ll i=1;i<n;i+=2)
    {
        x=use_machine({i,0,i+1});
        if(x==0)
            ans+=2;
        else if(x==1)
            ans++;
    }
    if(n%2==0)
    ans+=1^use_machine({0,n-1});
    return ans;
}
#Verdict Execution timeMemoryGrader output
Fetching results...