QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#383976#5089. 环覆盖xlwang5 19ms5640kbC++142.5kb2024-04-09 19:29:372024-04-09 19:29:38

Judging History

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

  • [2024-04-09 19:29:38]
  • 评测
  • 测评结果:5
  • 用时:19ms
  • 内存:5640kb
  • [2024-04-09 19:29:37]
  • 提交

answer

#include<bits/stdc++.h>
#define fr(i,j,k) for(register int i=j;i<=k;++i)
#define rf(i,j,k) for(register int i=j;i>=k;--i)
#define foredge(i,j) for(register int i=head[j];i;i=e[i].nxt)
#define pb push_back
#define Times printf("Time:%.3lf\n",clock()/CLOCKS_PER_SEC)
using namespace std;
inline int read(){
	int x=0;
	bool f=0;
	char c=getchar();
	while(!isdigit(c)) f|=(c=='-'),c=getchar();
	while(isdigit(c)) x=(x<<3)+(x<<1)+(c^48),c=getchar();
	return f?-x:x;
}
inline void write(int x){
    if(x<0){putchar('-');x=-x;}
    if(x>9)write(x/10);
    putchar(x%10+'0');
}
inline void writeln(int x){write(x); puts("");}
inline void writepl(int x){write(x); putchar(' ');}
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
inline int randfind(int l,int r){return rnd()%(r-l+1)+l;}
//inline void init(){
//	int t=read();
//	while(t--) work();
//}
const int Maxn=30,Maxm=Maxn*Maxn,mod=1e9+7;
inline int ksm(int x,int y=mod-2){
    int sum=1;
    while(y){
        if(y&1) sum=1ll*sum*x%mod;
        y=y/2;x=1ll*x*x%mod;
    }
    return sum;
}
inline void add(int &x,int y){
    x+=y;if(x>=mod) x-=mod;
}
bitset<Maxm> st[Maxn],now;
int n,m;
int siz[Maxm];
inline void init(){
    n=read();m=read();
    fr(i,1,m){
        int x,y;
        x=read(),y=read();--x,--y;
        st[x][i-1]=1;st[y][i-1]=1;
    }
}
int N;
int id[(1<<20)+10];
int C[Maxn][Maxn];
int ans[Maxn];
inline void work(){
    C[0][0]=1;
    fr(i,1,m){
        C[i][0]=1;
        fr(j,1,i) C[i][j]=(C[i-1][j]+C[i-1][j-1])%mod;
    }
    // cout<<C[1][1]<<endl;
    N=(1<<n)-1;
    fr(i,1,n) id[1<<i]=i;
    fr(i,0,N){
        if(i){
            int A,B;
            A=(i-1)^((i-1)>>1);B=i^(i>>1);
            // cout<<A<<' '<<B<<endl;
            now^=st[id[A^B]];
        }
        // cout<<i<<' '<<now<<endl;
        // cout<<i<<' '<<now.count()<<endl;
        siz[now.count()]++;
    }
    // fr(i,0,m) cout<<i<<' '<<siz[i]<<endl;
    fr(i,0,m) fr(p1,0,m-i) fr(p2,0,i){
        if(p1&1) add(ans[p1+p2],mod-1ll*C[m-i][p1]*C[i][p2]%mod*siz[m-i]%mod);
        else add(ans[p1+p2],1ll*C[m-i][p1]*C[i][p2]%mod*siz[m-i]%mod);
    }
    // fr(i,0,m) cout<<i<<' '<<ans[i]<<endl;
    fr(i,0,m){
        int answer;
        answer=1ll*ans[i]*ksm(ksm(2,n))%mod;
        writepl(answer);
    }
}
signed main(){
	// freopen("input.in","r",stdin);
	// freopen("output.out","w",stdout);
    init();work();
    // printf("\nTIME:%.3lf",(double)clock()/CLOCKS_PER_SEC);
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 5
Accepted

Test #1:

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

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: 3624kb

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: 19ms
memory: 5584kb

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: 0ms
memory: 3568kb

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: 3792kb

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: 2ms
memory: 3704kb

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: 0ms
memory: 3532kb

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: 18ms
memory: 5640kb

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: 3528kb

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: 3692kb

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
Runtime Error

Dependency #1:

100%
Accepted

Test #11:

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

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
Runtime Error

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:


result:


Subtask #3:

score: 0
Runtime Error

Test #31:

score: 0
Runtime Error

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%