Submission #346037

#TimeUsernameProblemLanguageResultExecution timeMemory
346037tamaritoCounting Mushrooms (IOI20_mushrooms)C++14
0 / 100
13 ms364 KiB
#include "mushrooms.h"

int count_mushrooms(int n) {
    int answer = 0;
    for (int i = 0; i < n; i += 2) {
        if (i == n - 1) {
            if (use_machine({0, i}) == 0) {
                answer++;
            }
            break;
        }
        if (use_machine({i, i + 1}) == 1) {
            answer++;
        } else {
            if (use_machine({0, i, i + 1}) == 0) {
               answer += 2;
            }
        }
    }
    return answer;
}
#Verdict Execution timeMemoryGrader output
Fetching results...