QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#697916 | #5089. 环覆盖 | ushg8877 | 0 | 0ms | 0kb | C++14 | 1.6kb | 2024-11-01 16:23:18 | 2024-11-01 16:23:25 |
answer
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define MP make_pair
#define Int bitset<305>
const int MAXN=305;
const int MOD=1e9+7;
Int o,e[25];
int n,m,t,id[MAXN];ll ans[MAXN],C[MAXN][MAXN],w[MAXN][MAXN],coef[MAXN];
ll ksm(ll a,int b){ll r=1;while(b){if(b&1)r=r*a%MOD;a=a*a%MOD,b>>=1;}return r;}
struct basis{
Int a[MAXN];
int rk(){
int ans=0;
for(int i=0;i<m;i++) ans+=(a[i].any());
return ans;
}
bool add(Int x){
for(int i=m-1;i>=0;i--) if(x[i]){
if(a[i].any()) x^=a[i];
else return a[i]=x,true;
}
return false;
}
void bf(){
int c=0;
for(int i=0;i<m;i++) if(a[i].any()) id[c++]=i;
auto dfs=[&](auto self,int u,Int s)->void{
if(u==c){
ans[s.count()]++;
return;
}
self(self,u+1,s);self(self,u+1,s^a[id[u]]);
};dfs(dfs,0,o);
}
void eras(){
for(int i=0;i<m;i++) if(a[i].any())
for(int j=i+1;j<m;j++) if(a[j][i]) a[j]^=a[i];
}
}B;
void output(){
t=(t+MOD-1)%(MOD-1);
for(int i=0;i<=m;i++) cout<<ans[i]%MOD*ksm(2,t)%MOD<<" \n"[i==m];
}
int main(){
ios::sync_with_stdio(false);
freopen("even.in","r",stdin);
freopen("even.out","w",stdout);
cin>>n>>m;
for(int i=0;i<m;i++){
int u,v;cin>>u>>v;
e[u][i]=e[v][i]=1;
}
for(int i=1;i<=n;i++) B.add(e[i]);
for(int i=0;i<MAXN;i++){
C[i][0]=1;
for(int j=1;j<=i;j++) C[i][j]=(C[i-1][j]+C[i-1][j-1])%MOD;
}
B.bf();swap(coef,ans);
t-=B.rk();
for(int i=0;i<=m;i++) for(int c=0;c<=m;c++){
for(int t=max(0,c+i-m);t<=min(c,i);t++)
w[i][c]+=(t&1?-1:1)*C[i][t]*C[m-i][c-t]%MOD;
w[i][c]=(w[i][c]%MOD+MOD)%MOD;
}
for(int i=0;i<=m;i++) for(int j=0;j<=m;j++) ans[j]+=w[i][j]*coef[i]%MOD;
output();
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%