QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#725748 | #5089. 环覆盖 | hhoppitree | 0 | 82ms | 266012kb | C++17 | 1.2kb | 2024-11-08 19:45:17 | 2024-11-08 19:45:17 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
const int N = 25, M = 405, P = 1e9 + 7;
int G[N], ct[1 << N], f[1 << N], g[M], C[M][M];
signed main() {
int n, m; scanf("%d%d", &n, &m);
for (int i = C[0][0] = 1, x, y; i <= m; ++i) {
scanf("%d%d", &x, &y);
--x, --y, G[x] |= 1 << y, G[y] |= 1 << x;
for (int j = C[i][0] = 1; j <= i; ++j) {
C[i][j] = (C[i - 1][j - 1] + C[i - 1][j]) % P;
}
}
for (int i = 1; i < (1 << n); ++i) {
ct[i] = ct[i >> 1] + (i & 1);
}
g[0] = 1;
for (int i = 1; i < (1 << n); ++i) {
int t = 31 - __builtin_clz(i & -i);
f[i] = f[i ^ (i & -i)] - ct[G[t] & i] + ct[G[t] & ~i];
++g[f[i]];
}
int iv = 1;
for (int i = 1; i <= n; ++i) iv = (P + 1ll) / 2 * iv % P;
for (int i = 0; i <= m; ++i) {
int res = 0;
for (int j = 0; j <= m; ++j) {
for (int k = i + j - m; k <= j; ++k) {
res = (res + 1ll * ((k & 1) ? -g[j] : g[j]) * C[j][k] % P * C[m - j][i - k]) % P;
}
}
printf("%lld%c", (1ll * res * iv % P + P) % P, " \n"[i == m]);
}
return 0;
}
详细
Subtask #1:
score: 0
Wrong Answer
Test #1:
score: 5
Accepted
time: 0ms
memory: 3932kb
input:
10 9 3 5 3 10 4 7 4 8 5 6 5 9 6 9 7 9 9 10
output:
1 0 0 1 1 1 0 0 0 0
result:
ok 10 numbers
Test #2:
score: 0
Wrong Answer
time: 1ms
memory: 3872kb
input:
8 15 1 4 1 5 1 8 2 4 2 6 3 6 4 5 4 6 4 7 5 6 5 7 5 8 6 7 6 8 7 8
output:
506040896 137901358 304687331 10 18 26 46 54 43 30 18 8 2 0 0 0
result:
wrong answer 1st numbers differ - expected: '1', found: '506040896'
Subtask #2:
score: 0
Skipped
Dependency #1:
0%
Subtask #3:
score: 0
Wrong Answer
Test #31:
score: 0
Wrong Answer
time: 82ms
memory: 266012kb
input:
25 45 1 6 1 12 1 17 2 3 2 4 2 6 3 6 3 8 4 5 4 12 4 16 5 17 6 21 7 14 7 22 7 23 8 15 8 19 8 24 9 11 9 19 9 23 9 25 10 17 10 18 11 16 11 19 11 22 12 19 13 18 14 19 15 19 16 24 17 19 17 22 17 25 18 19 18 21 18 24 19 23 20 22 21 25 22 23 23 25 24 25
output:
288284964 658197360 390489931 664653278 846591785 538596613 140428346 544611922 515850372 197773816 288245596 300648046 468713847 587796279 936487814 184901612 19633902 610487454 327449076 372387683 850440279 137062601 808700096 595010203 651268962 245541029 632331452 761755877 353890140 782780646 4...
result:
wrong answer 1st numbers differ - expected: '1', found: '288284964'
Subtask #4:
score: 0
Skipped
Dependency #2:
0%
Subtask #5:
score: 0
Skipped
Dependency #4:
0%