Submission #423708

#TimeUsernameProblemLanguageResultExecution timeMemory
423708Mohammed_AtalahCounting Mushrooms (IOI20_mushrooms)C++17
25 / 100
139 ms552 KiB
#include "mushrooms.h"
#include <bits/stdc++.h>
using namespace std;


int count_mushrooms(int n) {

	vector<int> indices;
	for (int i = 0; i < n; i++) {
		indices.push_back(i);
	}


	if (use_machine(indices) == 0) {
		return n;
	}


	int bs = 0;
	for (int i = 1; i < n; i += 2) {
		if (i + 1 == n) {
			std::vector<int> v;
			v.push_back(0);
			v.push_back(i);
			if (use_machine(v) == 1) {
				bs++;
			}
			continue;
		}


		std::vector<int> v;
		v.push_back(i);
		v.push_back(0);
		v.push_back(i + 1);

		bs += use_machine(v);
	}
	return n - bs;

}
#Verdict Execution timeMemoryGrader output
Fetching results...