# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
15442 | myungwoo | 로봇 심판의 님 게임 (kriii3_F) | C++14 | 171 ms | 3708 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
typedef long long lld;
int N, M, K;
lld A[21], G[21];
lld lcmP[1<<16], lcmQ[1<<16], lcmPQ[1<<16]; int bitcnt[1<<16];
bool overP[1<<16], overQ[1<<16], overPQ[1<<16];
vector <lld> P, Q;
lld gcd(lld a, lld b){ return b ? gcd(b, a%b) : a; }
inline lld invalid(lld n)
{
lld ret = n;
for (int msk1=0;msk1<(1<<N);msk1++){
if (overP[msk1]) continue;
if (msk1) ret += (bitcnt[msk1] & 1 ? 1 : -1) * n / lcmP[msk1];
for (int msk2=0;msk2<(1<<M);msk2++){
int nmsk = (msk1 << M) | msk2;
if (overQ[msk2] || overPQ[nmsk]) continue;
if (msk1 + msk2) ret -= ((bitcnt[msk1] + bitcnt[msk2]) & 1 ? 1 : -1) * n / lcmPQ[nmsk];
}
}
return ret;
}
inline lld get_grundy(lld n)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |