# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1062152 | YassirSalama | Counting Mushrooms (IOI20_mushrooms) | C++17 | 6 ms | 612 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "mushrooms.h"
#include<bits/stdc++.h>
using namespace std;
#define all(v) v.begin(),v.end()
#define mm use_machine
#define pb push_back
int count_mushrooms(int n) {
int ans=0;
string s;
s+='A';
int x=mm({0,1});
if(x) s+='B';
else s+='A';
vector<int> c;c.pb(0);c.pb(1);
for(int i=2;i<n;i++){
c.pb(i);
if(mm(c)==x){
s+=s.back();
}else{
int t=s.back()-'A';
t^=1;
x++;
s+=char(t+'A');
}
}
for(auto x:s){
ans+=x=='A';
}
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |