Submission #424236

#TimeUsernameProblemLanguageResultExecution timeMemory
424236ApiramCounting Mushrooms (IOI20_mushrooms)C++14
0 / 100
0 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; 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); }

Compilation message (stderr)

mushrooms.cpp: In function 'int solve(int, int)':
mushrooms.cpp:10:17: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   10 |  int mid = left + right >>1;
      |            ~~~~~^~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...