# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1062153 | YassirSalama | Counting Mushrooms (IOI20_mushrooms) | C++17 | 141 ms | 956 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';
for(int i=2;i<n;i++){
vector<int> c={i-1,i};
if(mm(c)==0){
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... |