#include "mushrooms.h"
#include <bits/stdc++.h>
using namespace std;
int count_mushrooms(int n) {
if(n == 2) {
return 1-use_machine({0, 1});
}
int bb = n;
int ans=1;
int ss = use_machine({0, 1});
int tt = use_machine({0, 2});
ans+=1-ss;
ans+=1-tt;
vector<int> A, B;
A.push_back(0);
if(ss==0)
A.push_back(1);
else B.push_back(1);
if(tt==0)
A.push_back(2);
else B.push_back(2);
for(int i = 3;i<bb;i+=2) {
if(i + 1 < bb) {
if(A.size() > 2) {
int val = use_machine(vector{A[0], i, A[1], i+1});
if(val < 2) {
A.push_back(i);
}
else B.push_back(i);
if(val%2 == 0) {
A.push_back(i+1);
}
else B.push_back(i+1);
}
else {
int val = use_machine(vector{B[0], i, B[1], i+1});
if(val < 2) {
B.push_back(i);
}
else A.push_back(i);
if(val%2 == 0) {
B.push_back(i+1);
}
else A.push_back(i+1);
}
}
else {
int val = use_machine(vector{A[0], i});
if(val==0) {
A.push_back(i);
}
else B.push_back(i);
}
}
return A.size();
}
# |
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 |
0 ms |
344 KB |
Output is correct |
6 |
Partially correct |
4 ms |
452 KB |
Output is partially correct |
7 |
Partially correct |
40 ms |
780 KB |
Output is partially correct |
8 |
Partially correct |
38 ms |
548 KB |
Output is partially correct |
9 |
Incorrect |
45 ms |
540 KB |
Answer is not correct. |
10 |
Halted |
0 ms |
0 KB |
- |