QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#725741 | #5089. 环覆盖 | hhoppitree | 0 | 88ms | 266008kb | C++17 | 1.2kb | 2024-11-08 19:44:14 | 2024-11-08 19:44:15 |
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;
}
Details
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 0
Wrong Answer
Test #1:
score: 5
Accepted
time: 1ms
memory: 3764kb
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: 0ms
memory: 3924kb
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:
651634524 151774258 171874829 10 18 26 46 54 43 30 18 8 2 0 0 0
result:
wrong answer 1st numbers differ - expected: '1', found: '651634524'
Subtask #2:
score: 0
Skipped
Dependency #1:
0%
Subtask #3:
score: 0
Wrong Answer
Test #31:
score: 0
Wrong Answer
time: 88ms
memory: 266008kb
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:
17734375 492757788 53535509 780582656 832481941 905506909 671879484 948394600 138972078 770389405 551810450 816260713 393482709 438653451 741355463 401346551 940672398 341958553 407836546 881618108 416899004 751341448 296882931 425395458 415050592 786522117 787314245 944481814 90398936 267726621 714...
result:
wrong answer 1st numbers differ - expected: '1', found: '17734375'
Subtask #4:
score: 0
Skipped
Dependency #2:
0%
Subtask #5:
score: 0
Skipped
Dependency #4:
0%