QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#697249#5089. 环覆盖DaiRuiChen0070 0ms0kbC++171.0kb2024-11-01 12:26:592024-11-01 12:27:02

Judging History

你现在查看的是最新测评结果

  • [2024-11-01 12:27:02]
  • 评测
  • 测评结果:0
  • 用时:0ms
  • 内存:0kb
  • [2024-11-01 12:26:59]
  • 提交

answer

#include<bits/stdc++.h>
#define ll long long
#define pc(x) __builtin_popcount(x)
using namespace std;
const int MOD=1e9+7,i2=(MOD+1)/2;
int n,m,e[30];
ll cnt[305],ans[305],g[305],C[305][305];
char f[1<<25];
signed main() {
	freopen("even.in","r",stdin);
	freopen("even.out","w",stdout);
	scanf("%d%d",&n,&m);
	for(int i=0;i<=m;++i) for(int j=C[i][0]=1;j<=i;++j) C[i][j]=(C[i-1][j]+C[i-1][j-1])%MOD;
	for(int i=0,u,v;i<m;++i) {
		scanf("%d%d",&u,&v),--u,--v;
		e[u]|=1<<v,e[v]|=1<<u;
	}
	for(int i=0;i<n;++i) {
		for(int s=0;s<(1<<i);++s) {
			f[s|1<<i]=f[s]+pc(e[i])-2*pc(e[i]&s);
		}
	}
	for(int s=0;s<(1<<n);++s) ++cnt[f[s]];
	for(int i=0;i<=m;++i) g[i]=C[m][i];
	for(int i=0;i<=m;++i) {
		for(int j=0;j<=m;++j) {
			ans[j]=(ans[j]+g[j]*cnt[i])%MOD;
		}
		for(int j=1;j<=m;++j) g[j]=(g[j]+MOD-g[j-1])%MOD;
		for(int j=m;j>=1;--j) g[j]=(g[j]+MOD-g[j-1])%MOD;
	}
	ll inv=1;
	for(int i=1;i<=n;++i) inv=inv*i2%MOD;
	for(int i=0;i<=m;++i) printf("%lld ",ans[i]*inv%MOD); puts("");
	return 0;
}

詳細信息

Subtask #1:

score: 0
Dangerous Syscalls

Test #1:

score: 0
Dangerous Syscalls

input:

10 9
3 5
3 10
4 7
4 8
5 6
5 9
6 9
7 9
9 10

output:


result:


Subtask #2:

score: 0
Skipped

Dependency #1:

0%

Subtask #3:

score: 0
Dangerous Syscalls

Test #31:

score: 0
Dangerous Syscalls

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:


result:


Subtask #4:

score: 0
Skipped

Dependency #2:

0%

Subtask #5:

score: 0
Skipped

Dependency #4:

0%