# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
979271 | Zicrus | 버섯 세기 (IOI20_mushrooms) | C++17 | 0 ms | 344 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#include "mushrooms.h"
using namespace std;
typedef long long ll;
int kVal, kA, kB;
void get(vector<ll> &m, int a, int b) {
ll sol = use_machine({kA, a, kB, b});
m[a] = (sol >> 1) ^ kVal;
m[b] = (sol & 1) ^ kVal;
}
int count_mushrooms(int n) {
vector<ll> m(n, 0);
m[0] = 1;
ll sol01 = use_machine({0, 1});
ll sol02;
if (n <= 2) {
if (sol01 == 0) m[1] = 1;
goto end; // Hello
}
sol02 = use_machine({0, 2});
if (sol01 == 0) m[1] = 1;
if (sol02 == 0) m[2] = 1;
if (sol01 == 0) {
kVal = 1;
kA = 0; kB = 1;
}
else if (sol02 == 0) {
kVal = 1;
kA = 0; kB = 2;
}
else {
kVal = 0;
kA = 1; kB = 2;
}
for (ll i = 3; i < n-1; i += 2) {
get(m, i, i+1);
}
if (!(n & 1)) {
get(m, n-2, n-1);
}
end:
ll res = 0;
for (auto &e : m) {
res += e;
}
return res;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |