Submission #1185720

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

using namespace std;

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



}
#Verdict Execution timeMemoryGrader output
Fetching results...