QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#317242 | #7514. Clique Challenge | wangqingxian | WA | 27ms | 8712kb | C++20 | 2.6kb | 2024-01-28 18:35:24 | 2024-01-28 18:35:25 |
Judging History
answer
//#pragma GCC optimize(2)
#include<algorithm>
#include<stdlib.h>
#include<iostream>
#include<cassert>
#include<cstring>
#include<cstdlib>
#include<iomanip>
#include<vector>
#include<cstdio>
#include<random>
#include<bitset>
#include<queue>
#include<cmath>
#include<set>
#include<map>
//#include<bits/stdc++.h>
#define uint unsigned int
#define int long long
#define ll long long
#define ull unsigned long long
#define uint unsigned int
#define lll __int128
#define db double
#define ld long double
#define pii pair<int,int>
#define For(i,l,r) for(int i=(l);i<=(r);++i)
#define rof(i,r,l) for(int i=(r);i>=(l);--i)
#define mem0(a) memset(a,0,sizeof(a))
#define meminf(a) memset(a,0x3f,sizeof(a))
#define lowbit(t) (t&-t)
#define ckmax(a,b) a=max(a,b)
#define ckmin(a,b) a=min(a,b)
#define ppct(t) __builtin_popcount(t)
#define x1 xxx111
#define y1 yyy111
#define x2 xxx222
#define y2 yyy222
using namespace std;
const int N=1e3+10,M=1<<23,inf=1e18,mod=1e9+7;
int n,m;
int du[N];
bool e[N][N];
int edge[N];
vector<int>vec;
int f[M];
int ans=0;
signed main(){
ios::sync_with_stdio(false);
cin.tie(0);cout.tie(0);
cin>>n>>m;
For(i,1,n)e[i][i]=1;
For(i,1,m){
int u,v;
cin>>u>>v;
e[u][v]=e[v][u]=1;
++du[u];
++du[v];
}
For(x,1,n){
vec.clear();
For(y,1,n)
if((du[x]<du[y]||(du[x]==du[y]&&y<x))&&e[x][y])
vec.push_back(y);
int mid=vec.size()>>1,sz=vec.size();
For(i,0,sz-1){
edge[i]=0;
For(j,0,sz-1){
int x=vec[i],y=vec[j];
if(e[x][y])edge[i]|=(1<<j);
}
}
int full=(1<<sz)-1;
For(st,0,(1<<mid)-1){
int to=full;
For(i,0,mid-1){
if((st>>i)&1){
if((to&st)!=st)break;
to&=edge[i];
}
}
f[st]=(int)((to&st)==st);
}
For(i,0,mid-1){
For(st,0,(1<<mid)-1){
if((st>>i)&1){
f[st]=(f[st]+f[st^(1<<i)])%mod;
}
}
}
for(int st=0;st<=full;st+=(1<<mid)){
int to=full;
For(i,mid,sz-1){
if((st>>i)&1){
to&=edge[i];
if((to&st)!=st)break;
}
}
if((to&st)==st)ans=(ans+f[(to-st)&((1<<mid)-1)])%mod;
}
}
cout<<ans<<endl;
return 0;
}
/*
3 2
1 2
2 3
3 3
1 2
1 3
2 3
*/
詳細信息
Test #1:
score: 100
Accepted
time: 1ms
memory: 5604kb
input:
3 2 1 2 2 3
output:
5
result:
ok single line: '5'
Test #2:
score: 0
Accepted
time: 0ms
memory: 5732kb
input:
3 3 1 2 1 3 2 3
output:
7
result:
ok single line: '7'
Test #3:
score: 0
Accepted
time: 2ms
memory: 4616kb
input:
1000 100 446 789 167 547 254 777 777 185 33 446 777 847 185 877 757 167 72 383 847 446 254 478 959 185 757 446 847 959 959 167 757 847 747 757 446 167 989 757 547 777 33 747 33 254 254 843 33 547 446 980 877 205 185 72 980 959 33 205 877 757 33 847 478 843 757 478 167 877 72 789 877 959 980 478 167 ...
output:
1373
result:
ok single line: '1373'
Test #4:
score: -100
Wrong Answer
time: 27ms
memory: 8712kb
input:
1000 1000 770 105 219 498 686 498 343 534 15 591 919 588 149 588 298 915 551 523 710 116 105 637 523 991 343 476 145 420 604 588 254 120 551 421 476 298 900 710 915 343 445 421 986 867 445 588 219 356 919 105 584 875 991 604 776 919 588 254 919 421 356 348 105 551 15 113 919 15 356 523 343 155 770 9...
output:
2359740
result:
wrong answer 1st lines differ - expected: '6621319', found: '2359740'