QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#66523 | #5089. 环覆盖 | sunzh | 0 | 240ms | 69120kb | C++14 | 1.6kb | 2022-12-08 20:54:55 | 2022-12-08 20:54:59 |
Judging History
answer
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/hash_policy.hpp>
#include<bits/stdc++.h>
#define PII pair<int,int>
#define mp make_pair
#define fi first
#define se second
#define pb push_back
using ll = long long;
using namespace std;
using namespace __gnu_pbds;
inline int read(){
int x=0,f=1;char c=getchar();while(!isdigit(c)){if(c=='-')f=-1;c=getchar();}
while(isdigit(c)){x=(x<<3)+(x<<1)+(c^48);c=getchar();}
return f==-1?~x+1:x;
}
int n,m;
PII e[1100];
short s[1<<25];
int st[26];
int cnt[1100];
ll f[1100],g[1100];
ll ans[1100];
const int mod=1e9+7;
inline int qpow(int x,int k=mod-2){
int res=1;
while(k){ if(k&1) res=1ll*res*x%mod; x=1ll*x*x%mod; k>>=1;}
return res;
}
int main(){
n=read(),m=read();
for(int i=1;i<=m;++i){
e[i].fi=read(),e[i].se=read();
--e[i].fi;--e[i].se;
st[e[i].fi]|=(1<<e[i].se);
st[e[i].se]|=(1<<e[i].fi);
}
++cnt[0];
for(int i=1;i<(1<<n);++i){
int t=__builtin_ctz(i);
s[i]=s[i^(1<<t)]+__builtin_popcount(st[t])-2*__builtin_popcount(st[t]&i);
// printf("s[%d]=%d\n",i,s[i]);
++cnt[s[i]];
}
f[0]=1;
for(int i=1;i<=m;++i){
for(int j=i;j>=1;--j) (f[j]+=f[j-1])%=mod;
}
for(int i=0;i<=m;++i){
// for(int j=0;j<=m;++j) printf("%d ",f[j]);printf("\n");
for(int j=0;j<=m;++j) ans[j]+=1ll*cnt[i]*f[j]%mod;
if(i==m) break ;
for(int j=m;j>0;--j) g[j-1]=f[j],(f[j-1]+=mod-g[j-1])%=mod;
// for(int j=0;j<m;++j) printf("%d ",g[j]);printf("\n");
for(int j=0;j<m;++j) f[j]=g[j];f[m]=0;
for(int j=m;j>0;--j) (f[j]+=mod-f[j-1])%=mod;
}
int inv=qpow(qpow(2),n);
for(int i=0;i<=m;++i) printf("%d ",(1ll*ans[i]*inv%mod+mod)%mod);
}
Details
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 0
Wrong Answer
Test #1:
score: 5
Accepted
time: 0ms
memory: 3632kb
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: 3700kb
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: -5
Wrong Answer
time: 6ms
memory: 5832kb
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 417655999 0 417655999 0 417655999 0 417655999 0 417655999 0
result:
wrong answer 11th numbers differ - expected: '0', found: '417655999'
Subtask #2:
score: 0
Skipped
Dependency #1:
0%
Subtask #3:
score: 0
Wrong Answer
Test #31:
score: 15
Accepted
time: 232ms
memory: 68988kb
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:
1 0 0 6 14 39 85 198 451 995 2173 4284 8230 15397 26870 44452 69519 101666 139154 177420 209814 230374 234537 220150 189837 150703 109969 72996 43834 23885 11788 5232 2064 716 224 62 12 1 0 0 0 0 0 0 0 0
result:
ok 46 numbers
Test #32:
score: 0
Accepted
time: 240ms
memory: 69120kb
input:
25 45 1 6 1 11 1 13 1 14 2 9 2 10 2 20 2 22 3 17 3 21 3 22 4 14 4 20 4 24 5 19 5 20 6 9 6 18 7 23 8 14 8 24 9 10 9 21 10 11 10 14 10 18 11 22 12 20 13 16 14 16 14 20 15 23 16 25 17 19 17 23 18 22 18 23 19 21 19 23 19 25 20 22 21 23 22 24 23 25 24 25
output:
1 0 0 6 14 31 74 181 468 1135 2360 4843 9830 18434 32404 53472 82502 119104 159718 198544 228314 241907 235810 210693 172196 128583 87316 53963 30130 14876 6560 2582 833 218 46 4 0 0 0 0 0 0 0 0 0 0
result:
ok 46 numbers
Test #33:
score: -15
Wrong Answer
time: 238ms
memory: 68988kb
input:
25 45 1 11 1 12 1 17 2 11 2 13 2 15 3 19 4 7 4 12 4 16 4 21 5 16 5 25 6 14 6 15 6 21 6 22 6 25 7 15 7 23 8 11 8 16 8 18 9 11 10 11 10 16 11 23 11 25 12 19 12 21 12 25 13 18 13 20 14 18 15 20 16 17 16 20 17 22 18 22 19 24 20 21 21 24 22 24 23 25 24 25
output:
1 0 0 2 13 21 78 161 382 908 1931 4128 8119 15293 26845 44666 70215 102467 140124 177415 209314 230772 234200 219453 189104 149762 109859 73038 43967 24329 12045 5368 2138 735 230 57 11 1 0 0 417655999 0 0 0 0 0
result:
wrong answer 41st numbers differ - expected: '0', found: '417655999'
Subtask #4:
score: 0
Skipped
Dependency #2:
0%
Subtask #5:
score: 0
Skipped
Dependency #4:
0%