QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#455571#7514. Clique ChallengeC1942huangjiaxuWA 0ms3848kbC++141.1kb2024-06-26 16:28:402024-06-26 16:28:40

Judging History

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

  • [2024-06-26 16:28:40]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3848kb
  • [2024-06-26 16:28:40]
  • 提交

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;
}

Details

Tip: Click on the bar to expand more detailed information

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'