#include "mushrooms.h"
using namespace std;
int x, y, q, l, c, ans;
vector <vector <int>> v(2);
vector <int> u;
int count_mushrooms(int n) {
v[0].push_back(0);
v[use_machine({ 0,1 })].push_back(1);
v[use_machine({ 0,2 })].push_back(2);
if (v[1].size() >= 2) x = 1;
for (int i = 3; i < min(n - 1, 201); i += 2) {
q = use_machine({ v[x][0], i, v[x][1], i + 1 });
v[(q / 2) ^ x].push_back(i);
v[(q % 2) ^ x].push_back(i + 1);
l = i + 2;
}
if (v[1].size() > v[0].size()) y = 1;
ans = v[0].size();
while (l < n) {
u = { v[y][0] };
c = 0;
while (l < n && c < 100) {
u.push_back(l++);
u.push_back(v[y][++c]);
}
q = use_machine(u) / 2;
ans += (y ? q : c - q);
}
return ans;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
336 KB |
Too large array for query. |
2 |
Halted |
0 ms |
0 KB |
- |