Submission #1220829

#TimeUsernameProblemLanguageResultExecution timeMemory
1220829brintonCounting Mushrooms (IOI20_mushrooms)C++20
10 / 100
51 ms628 KiB
#include "mushrooms.h"
#include <bits/stdc++.h>
using namespace std;
int count_mushrooms(int n) {
	vector<int> value{1};

	for (int i = 0; i+1 < n; i++){
		int type = use_machine({i,i+1});
		if(type == 0){
			// same;
			value.push_back(value.back());
		}else{
			value.push_back(1-value.back());
		}
	}
	int ans = accumulate(value.begin(),value.end(),0);
	return ans;
}
#Verdict Execution timeMemoryGrader output
Fetching results...