제출 #1185850

#제출 시각아이디문제언어결과실행 시간메모리
1185850islam_2010버섯 세기 (IOI20_mushrooms)C++20
10 / 100
52 ms420 KiB
#include <bits/stdc++.h>
#include "mushrooms.h"
using namespace std;

int count_mushrooms(int n) {
    int cnt = 1; 

    for (int i = 1; i + 1 < n; i += 2) {
        int res = use_machine({i, 0, i + 1});
        if (res == 0) {
            cnt += 2;
        } else if (res == 1) {
            int res2 = use_machine({0, i});
            if (res2 == 0) cnt++;
            else cnt++; 
        }
    }

    if (n % 2 == 0) {
        int res = use_machine({0, n - 1});
        if (res == 0) cnt++;
    }

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