#include "mushrooms.h"
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define pb push_back
#define all(x) x.begin(), x.end()
#define allr(x) x.rbegin(). x.rend()
#define mp make_pair
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef complex<double> cd;
int solve(int a, int b, int i, int n){
if(i>=n) return 0;
if(i==n-1) return use_machine({a, i});
int val=use_machine({a, i, b, i+1});
int sum=0;
if(val&2) sum++;
if(val&1) sum++;
return sum+solve(a, b, i+2, n);
}
int count_mushrooms(int n) {
int temp=use_machine({0, 1});
int tot;
if(!temp) tot=solve(0, 1, 2, n);
else{
int cnt=2, comp=-1; tot=1;
for(;cnt+1<n;cnt+=2){
int curr=use_machine({1, cnt, cnt+1});
if(!curr) tot+=2;
if(curr==1){
tot+=use_machine({0, cnt});
comp=cnt+1;
cnt+=2;
break;
}
else{
tot++;
comp=cnt;
cnt+=2;
break;
}
}
tot+=solve(0, comp, cnt, n);
}
return n-tot;
}
# |
결과 |
실행 시간 |
메모리 |
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 |
1 ms |
344 KB |
Output is correct |
6 |
Partially correct |
7 ms |
344 KB |
Output is partially correct |
7 |
Partially correct |
48 ms |
344 KB |
Output is partially correct |
8 |
Partially correct |
68 ms |
344 KB |
Output is partially correct |
9 |
Partially correct |
60 ms |
344 KB |
Output is partially correct |
10 |
Partially correct |
73 ms |
344 KB |
Output is partially correct |
11 |
Partially correct |
57 ms |
344 KB |
Output is partially correct |
12 |
Partially correct |
64 ms |
344 KB |
Output is partially correct |
13 |
Incorrect |
70 ms |
344 KB |
Answer is not correct. |
14 |
Halted |
0 ms |
0 KB |
- |