Submission #424238

#TimeUsernameProblemLanguageResultExecution timeMemory
424238ApiramCounting Mushrooms (IOI20_mushrooms)C++14
0 / 100
1 ms200 KiB
#include "mushrooms.h"
#include<bits/stdc++.h>
using namespace std;
int solve (int left,int right){
	vector<int>arr;
	if (left>right)return 0;
	if (left==right){
		int a= use_machine({0,left});
		if (a==0)return 1;
		else return 0;
	}
	for (int i =left;i<right;++i){
		arr.push_back(i);
	}
	int mid = (left + right)>>1;
	int a= use_machine(arr);
	if (a==0){
		a=use_machine({0,left});
		if (a==0){
			return right - left +1;
		}
		else return 0;
	}
	else return solve(left,mid)+solve(mid,right);
}
int count_mushrooms(int n) {
	return solve(1,n);
}
#Verdict Execution timeMemoryGrader output
Fetching results...