Submission #424241

#TimeUsernameProblemLanguageResultExecution timeMemory
424241ApiramCounting Mushrooms (IOI20_mushrooms)C++14
0 / 100
39 ms520 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+1,right); } int count_mushrooms(int n) { return solve(1,n-1)+1; }
#Verdict Execution timeMemoryGrader output
Fetching results...