Submission #1185708

#TimeUsernameProblemLanguageResultExecution timeMemory
1185708islam_2010버섯 세기 (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 ans = 1;
    int i = 1;

    while (i + 1 < n) {
        int res = use_machine({0, i, i + 1});
        if (res == 0) {
            ans += 2;
        } else if (res == 1) {
            int r2 = use_machine({0, i});
            if (r2 == 0) ans++; 
            else ans++;        
        }
        i += 2;
    }

    if (i < n) {
        if (use_machine({0, i}) == 0) ans++;
    }

    return ans;
}
#Verdict Execution timeMemoryGrader output
Fetching results...