#include <bits/stdc++.h>
using namespace std;
#include "mushrooms.h"
#define pb push_back
int count_mushrooms(int n) {
int a=1;
int b=0;
vector<int> aa;
aa.pb(0);
vector<int> bb;
for (int i = 1; i < min(n,200); i++)
{
if(aa.size()==100||bb.size()==100) continue;
int cur=use_machine({i,0});
(cur==1 ? bb : aa).pb(i);
(cur==1 ? b : a)++;
}
int ans=a;
for (int i = 200; i < n; i+=99)
{
vector<int> cur;
int k=0;
for (int j = 0; j < min(n-i,99); ++j)
{
cur.pb((a>=b ? aa[k++] : bb[k++]));
cur.pb(i+j);
cur.pb((a>=b ? aa[k++] : bb[k++]));
}
int cnt=use_machine(cur);
ans+=(a>=b ? cnt/2 : cur.size()/2-cnt/2);
}
return a;
}
# |
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 |
Incorrect |
1 ms |
344 KB |
Answer is not correct. |
6 |
Halted |
0 ms |
0 KB |
- |