QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#376766#5089. 环覆盖nullptr_qwq5 66ms138564kbC++203.6kb2024-04-04 16:25:432024-04-04 16:25:43

Judging History

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

  • [2024-04-04 16:25:43]
  • 评测
  • 测评结果:5
  • 用时:66ms
  • 内存:138564kb
  • [2024-04-04 16:25:43]
  • 提交

answer

/*
 *                                                     __----~~~~~~~~~~~------___
 *                                    .  .   ~~//====......          __--~ ~~
 *                    -.            \_|//     |||\\  ~~~~~~::::... /~
 *                 ___-==_       _-~o~  \/    |||  \\            _/~~-
 *         __---~~~.==~||\=_    -_--~/_-~|-   |\\   \\        _/~
 *     _-~~     .=~    |  \\-_    '-~7  /-   /  ||    \      /
 *   .~       .~       |   \\ -_    /  /-   /   ||      \   /
 *  /  ____  /         |     \\ ~-_/  /|- _/   .||       \ /
 *  |~~    ~~|--~~~~--_ \     ~==-/   | \~--===~~        .\
 *           '         ~-|      /|    |-~\~~       __--~~
 *                       |-~~-_/ |    |   ~\_   _-~            /\
 *                            /  \     \__   \/~                \__
 *                        _--~ _/ | .-~~____--~-/                  ~~==.
 *                       ((->/~   '.|||' -_|    ~~-/ ,              . _||
 *                                  -_     ~\      ~~---l__i__i__i--~~_/
 *                                  _-~-__   ~)  \--______________--~~
 *                                //.-~~~-~_--~- |-------~~~~~~~~
 *                                       //.-~~~--\
 *                       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 *
 *                               神兽保佑            永无BUG
 */

#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define fi first
#define se second
#define inf 1e9
#define pii pair<int,int>
#define F(i,a,b) for(int i=a;i<=(b);i++)
#define dF(i,a,b) for(int i=a;i>=(b);i--)
#define wh(lzm) while(lzm--)
#define cmh(sjy) while(sjy--)
#define lowbit(x) (x&(-x))
#define HH printf("\n")
#define eb emplace_back
using namespace std;
int read(){
	int x=0,f=1;char c=getchar();
	while(c<'0'||c>'9'){if(c=='-') f=-1;c=getchar();}
	while(c>='0'&&c<='9') x=(x<<3)+(x<<1)+(c^48),c=getchar();
	return x*f;
}
const int mod=998244353,maxn=500005;
int qpow(int x,int y){
	int rt=1;
	for(;y;y>>=1,x=1ll*x*x%mod) if(y&1) rt=1ll*rt*x%mod;
	return rt;
}
void inc(int &x,int y){ x=(x+y>=mod)?(x+y-mod):(x+y); }
void dec(int &x,int y){ x=(x>=y)?(x-y):(x+mod-y); }
void mul(int &x,int y){ x=1ll*x*y%mod; }
int add(int x,int y){ return (x+y>=mod)?(x+y-mod):(x+y); }
int sub(int x,int y){ return (x>=y)?(x-y):(x+mod-y); }
int prod(int x,int y){ return 1ll*x*y%mod; }
void chkmax(int &x,int y){ x=max(x,y); }
void chkmin(int &x,int y){ x=min(x,y); }
int mypow(int x,int y,int Mod){
	x%=Mod; int rt=1;
	for(;y;y>>=1,x=(1ll*x*x)%Mod) if(y&1) rt=(1ll*rt*x)%Mod;
	return rt;
}
mt19937 rng(time(0));
int rd(int l,int r){ return rng()%(r-l+1)+l; }
namespace combi{
	int fac[maxn],inv[maxn];
	void init(int N){
		fac[0]=inv[0]=1;
		F(i,1,N) fac[i]=1ll*fac[i-1]*i%mod;
		inv[N]=qpow(fac[N],mod-2);
		dF(i,N-1,1) inv[i]=1ll*inv[i+1]*(i+1)%mod;
	}
	int C(int n,int m){
		if(m>n||n<0||m<0) return 0;
		return 1ll*fac[n]*inv[m]%mod*inv[n-m]%mod;
	}
}
using namespace combi;
int n,m,msk[30],mx,f[1<<25],cnt[30],ans[30];
signed main(){
	n=read(),m=read(),mx=(1<<n)-1,combi::init(4309);
    F(i,1,m){
    	int u=read()-1,v=read()-1;
    	msk[u]|=(1<<v),msk[v]|=(1<<u);
    }
    F(s,1,mx){
    	int u=__builtin_ctz(s);
    	f[s]=f[s^(1<<u)]+__builtin_popcount(msk[u]&s);
    }
    F(s,0,mx) cnt[f[s]+f[s^mx]]++;
    F(i,0,m) F(j,0,i) F(k,0,m-i){
    	int val=1ll*C(i,j)*C(m-i,k)%mod*cnt[i]%mod;
    	if(k&1) dec(ans[j+k],val);
    	else inc(ans[j+k],val);
    }
    int inv=qpow(qpow(2,n),mod-2);
    F(i,0,m) mul(ans[i],inv);
    F(i,0,m) printf("%d ",ans[i]);
}

详细

Subtask #1:

score: 5
Accepted

Test #1:

score: 5
Accepted
time: 1ms
memory: 7988kb

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
Accepted
time: 1ms
memory: 8116kb

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:

1 0 0 10 18 26 46 54 43 30 18 8 2 0 0 0 

result:

ok 16 numbers

Test #3:

score: 0
Accepted
time: 2ms
memory: 10336kb

input:

19 19
1 12
1 16
1 18
2 8
2 17
3 11
3 17
4 9
4 19
5 17
7 13
8 17
9 13
9 15
9 17
10 16
10 18
14 17
15 16

output:

1 0 0 1 1 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 

result:

ok 20 numbers

Test #4:

score: 0
Accepted
time: 1ms
memory: 5932kb

input:

7 14
1 3
1 4
1 7
2 3
2 5
2 6
2 7
3 4
3 5
3 7
4 7
5 6
5 7
6 7

output:

1 0 0 11 16 18 46 64 47 30 18 5 0 0 0 

result:

ok 15 numbers

Test #5:

score: 0
Accepted
time: 0ms
memory: 7900kb

input:

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

output:

1 0 0 0 0 1 0 0 0 0 

result:

ok 10 numbers

Test #6:

score: 0
Accepted
time: 1ms
memory: 8252kb

input:

15 14
2 9
2 10
3 5
3 10
3 12
3 14
4 6
5 10
5 15
6 9
6 15
7 11
7 13
9 15

output:

1 0 0 2 0 1 3 1 0 0 0 0 0 0 0 

result:

ok 15 numbers

Test #7:

score: 0
Accepted
time: 1ms
memory: 7992kb

input:

9 8
1 3
2 4
2 7
3 5
3 9
4 6
7 9
8 9

output:

1 0 0 0 0 0 0 0 0 

result:

ok 9 numbers

Test #8:

score: 0
Accepted
time: 0ms
memory: 11872kb

input:

19 18
1 5
1 9
1 15
2 4
2 11
2 15
3 6
3 8
3 17
4 19
5 12
6 13
6 15
8 10
8 15
9 19
12 17
13 16

output:

1 0 0 0 1 0 1 2 0 0 1 2 0 0 0 0 0 0 0 

result:

ok 19 numbers

Test #9:

score: 0
Accepted
time: 1ms
memory: 8120kb

input:

7 18
1 2
1 3
1 4
1 6
1 7
2 3
2 5
2 6
2 7
3 4
3 5
3 7
4 5
4 6
4 7
5 6
5 7
6 7

output:

1 0 0 20 51 108 278 528 711 760 660 468 293 156 54 8 0 0 0 

result:

ok 19 numbers

Test #10:

score: 0
Accepted
time: 1ms
memory: 7984kb

input:

10 15
1 6
2 4
2 6
2 9
2 10
3 5
3 8
3 9
3 10
4 5
4 8
5 8
5 10
7 9
8 9

output:

1 0 0 4 6 12 16 12 9 4 0 0 0 0 0 0 

result:

ok 16 numbers

Subtask #2:

score: 0
Wrong Answer

Dependency #1:

100%
Accepted

Test #11:

score: 15
Accepted
time: 0ms
memory: 7980kb

input:

10 22
1 2
1 3
1 4
1 6
1 8
1 9
2 3
2 4
2 5
2 7
2 8
2 10
3 8
3 10
4 7
4 8
5 7
5 10
6 10
7 9
8 10
9 10

output:

1 0 0 13 33 64 162 367 621 906 1216 1343 1215 988 682 353 146 58 20 4 0 0 0 

result:

ok 23 numbers

Test #12:

score: -15
Wrong Answer
time: 0ms
memory: 8060kb

input:

11 38
1 2
1 3
1 4
1 6
1 7
1 8
1 10
2 5
2 8
2 9
2 10
2 11
3 5
3 6
3 7
3 9
3 10
3 11
4 5
4 7
4 11
5 6
5 7
5 9
5 10
5 11
6 7
6 8
6 9
6 10
6 11
7 8
7 9
7 10
8 9
8 11
9 11
10 11

output:

997756930 979722241 714076161 415285301 320237794 640476000 978263759 46807171 871561454 191209181 922573841 960119840 385926403 194545633 198927174 461356917 91388297 504799419 819558442 75858556 895985312 915430016 25784967 83933454 508390039 582762097 728037507 834796874 329618531 737024524 18523...

result:

wrong answer 1st numbers differ - expected: '1', found: '997756930'

Subtask #3:

score: 0
Wrong Answer

Test #31:

score: 0
Wrong Answer
time: 66ms
memory: 138564kb

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:

882440461 322297546 359325195 180146181 467144902 738476243 699450263 732236081 508440799 452039026 112753892 411839266 531388562 235575979 835903646 780144956 765239535 504715784 667246020 159122587 907362917 92043760 372525058 727523212 581772059 422014195 175657316 819313400 742883094 79882245 51...

result:

wrong answer 1st numbers differ - expected: '1', found: '882440461'

Subtask #4:

score: 0
Skipped

Dependency #2:

0%

Subtask #5:

score: 0
Skipped

Dependency #4:

0%