Submission #436625

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
4366252021-06-24 17:04:40frodakcinCounting Mushrooms (IOI20_mushrooms)C++17
85.61 / 100
11 ms440 KiB
#include "mushrooms.h"
#include <cstdio>
int count_mushrooms(int n)
{
std::vector<int> m, a, b;
a.push_back(0);
int i=1;
if(n > 1000)
{
if(use_machine({0, i})==0)
a.push_back(i); else b.push_back(i);
++i;
if(use_machine({0, i})==0)
a.push_back(i); else b.push_back(i);
++i;
bool swapped=0;
if(a.size() < b.size())
std::swap(a,b), swapped=1;
for(int j=0;j<20;++j)
{
int v = use_machine({a[0], i, a[1], i+1});
if(v&1) b.push_back(i+1); else a.push_back(i+1);
if(v&2) b.push_back(i); else a.push_back(i);
i+=2;
}
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#Verdict Execution timeMemoryGrader output
Fetching results...