Submission #421337

#TimeUsernameProblemLanguageResultExecution timeMemory
421337dxz05Counting Mushrooms (IOI20_mushrooms)C++14
0 / 100
1 ms200 KiB
#include "mushrooms.h"
#include <bits/stdc++.h>

using namespace std;

int count_mushrooms(int n) {
	int ans = 1;
	for (int i = 1; i < n; i += 2){
        vector<int> v = {0, i, i + 1};
        if (v.back() == n) v.pop_back();
        int x = use_machine(v);

        if (v.size() == 2){
            if (x == 0) ans++;
        } else {
            if (x == 0) ans += 2;
            if (x == 2) ans++;
        }

	}

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