# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
699186 | vjudge1 | Amusement Park (CEOI19_amusementpark) | C++17 | 1020 ms | 2648 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
/* ...... */
#include <bits/stdc++.h>
using namespace std;
#define inl inline
#define all(p) begin (p), end (p)
typedef long long ll;
using pint = pair <int, int>;
#define ctz __builtin_ctz
constexpr int N = 18, P = 998244353;
int n, m, x, y, e[N]; ll f[1<<N]; bool g[1<<N];
vector <pint> l1, l2;
int main () {
/* */
scanf ("%d%d", &n, &m); g[0] = 1;
for (int i = 1; i <= m; ++i)
scanf ("%d%d", &x, &y), --x, --y,
e[x] |= 1<<y, e[y] |= 1<<x;
for (int s = 1, msk; s < 1<<n; ++s)
x = ctz (s), msk = s ^ (1<<x),
g[s] = g[msk] && !(e[x] & msk);
for (int s = 0; s < 1<<n; ++s) {
(f[s] += g[s]) %= P; int sube = 0, msk;
for (x = 0; x < n; ++x)
if ((s >> x) & 1) sube |= e[x];
sube &= ((1<<n)-1) ^ s;
msk = sube; while (msk)
f[s | msk] += f[s] * g[msk] *
(P - 1 + (__builtin_parity (msk)<<1)) % P,
(--msk) &= sube;
}
printf ("%lld", f[(1<<n)-1] * m % P * (P+1ll>>1) % P);
return 0;
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |