Submission #346021

#TimeUsernameProblemLanguageResultExecution timeMemory
346021Ikkyu9541Counting Mushrooms (IOI20_mushrooms)C++17
10 / 100
239 ms644 KiB
#include "mushrooms.h"
#include <vector>
using namespace std;

int count_mushrooms(int n) {
	bool b[100005];
	int ans = 1;
	b[0] = 0;
	vector<int> a;
	a.push_back(0);
	a.push_back(0);

	for (int i = 1; i < n; i++){
		a[0] = i-1;	a[1] = i;
		int u = use_machine(a);
		if(u){
			b[i] = !b[i-1];
		}
		else{
			b[i] = b[i-1];
		}
		if(b[i] == 0) ans++;
	}
	return ans;
}
#Verdict Execution timeMemoryGrader output
Fetching results...