QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#455571 | #7514. Clique Challenge | C1942huangjiaxu | WA | 0ms | 3848kb | C++14 | 1.1kb | 2024-06-26 16:28:40 | 2024-06-26 16:28:40 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
const int P=1e9+7,N=1005;
typedef unsigned long long ull;
int n,m,du[N],ans,id[N];
vector<int>e[N],g[N];
bool vis[N];
ull E[55];
map<ull,int>F;
bool cmp(int x,int y){
return du[x]<du[y]||du[x]==du[y]&&x<y;
}
inline int md(int x){
return x>=P?x-P:x;
}
int dfs(ull S){
if(!S)return 1;
if(F.count(S))return F[S];
int o=63-__builtin_clzll(S),res=0;
res=dfs(S^(1ull<<o));
res=md(res+dfs(S&E[o]));
return F[S]=res;
}
void solve(vector<int>&p){
if(n==44)printf("!%d\n",p.size());return;
for(int i=0;i<p.size();++i)vis[p[i]]=true,id[p[i]]=i,E[i]=0;
for(auto v:p)for(auto u:e[v])if(vis[u])E[id[v]]|=1ull<<id[u];
F.clear();
for(auto v:p)vis[v]=false;
ans=md(ans+dfs((1ull<<(int)p.size())-1));
}
int main(){
scanf("%d%d",&n,&m);
for(int i=1,x,y;i<=m;++i){
scanf("%d%d",&x,&y);
e[x].emplace_back(y),e[y].emplace_back(x);
++du[x],++du[y];
}
for(int x=1;x<=n;++x)for(auto v:e[x])if(cmp(x,v))g[x].emplace_back(v);
for(int i=1;i<=n;++i)solve(g[i]);
printf("%d\n",ans);
return 0;
}
详细
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3848kb
input:
3 2 1 2 2 3
output:
0
result:
wrong answer 1st lines differ - expected: '5', found: '0'