Submission #1185702

#TimeUsernameProblemLanguageResultExecution timeMemory
1185702islam_2010Counting Mushrooms (IOI20_mushrooms)C++20
0 / 100
0 ms420 KiB
#include <bits/stdc++.h>
#include "mushrooms.h"

using namespace std;

int count_mushrooms(int n){
    int i = 1;
    int ans = 0;
    while (i+1 < n){
        int a = use_machine({0, i, i+1});
        if(i>=n){
            break;
        }
        if(a==0){
            i+=2;
            ans+=2;
        }else if(a==2){
            ans++;
            i+=2;
        }else {
            int b = use_machine({0, i});
            if(b==0){
                ans++;
            }i+=2;
        }
    }return ans;
}

#Verdict Execution timeMemoryGrader output
Fetching results...