#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 |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
344 KB |
Output is correct |
3 |
Correct |
0 ms |
344 KB |
Output is correct |
4 |
Correct |
0 ms |
344 KB |
Output is correct |
5 |
Correct |
2 ms |
344 KB |
Output is correct |
6 |
Incorrect |
6 ms |
612 KB |
Too many total array sizes as queries. |
7 |
Halted |
0 ms |
0 KB |
- |