QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#611692 | #7514. Clique Challenge | Dungeon_master | TL | 764ms | 7768kb | C++14 | 954b | 2024-10-04 22:08:54 | 2024-10-04 22:08:54 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
#define N 1005
int n,m;
struct node{
int next,to;
}edge[N*2];
int head[N],cnt=0;
void addedge(int u,int v){
edge[++cnt].next=head[u];
head[u]=cnt;
edge[cnt].to=v;
}
int mod=1e9+7;
inline int read(){
int a=0,f=1;
char c=getchar();
while(c<'0'||c>'9'){
if(c=='-')f=-1;
c=getchar();
}
while(c>='0'&&c<='9'){
a=a*10+c-'0';
c=getchar();
}
return a*f;
}
int b[N],ccs=0,ans=0;
int ls[N][N];
void dfs(int u){
if(u>n)
return;
for(int i=u;i<=n;i++){
bool f=1;
for(int j=1;j<=ccs;j++)
if(ls[b[j]][i]==0){
f=0;
break;
}
if(f==1){
ans++,ans%=mod,b[++ccs]=i;
dfs(i+1);
ccs--;
}
}
}
int main(){
n=read(),m=read();
for(int i=1;i<=m;i++){
int u=read(),v=read();
addedge(u,v);
addedge(v,u);
ls[u][v]=ls[v][u]=1;
}
for(int i=1;i<=n;i++)
ls[i][0]=ls[0][i]=1;
dfs(1);
printf("%d\n",ans);
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3796kb
input:
3 2 1 2 2 3
output:
5
result:
ok single line: '5'
Test #2:
score: 0
Accepted
time: 0ms
memory: 3904kb
input:
3 3 1 2 1 3 2 3
output:
7
result:
ok single line: '7'
Test #3:
score: 0
Accepted
time: 2ms
memory: 7768kb
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: 0
Accepted
time: 764ms
memory: 7768kb
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:
6621319
result:
ok single line: '6621319'
Test #5:
score: -100
Time Limit Exceeded
input:
1000 1000 840 251 559 572 77 993 857 254 176 77 30 423 838 251 862 466 920 254 254 593 593 423 780 575 487 865 952 176 480 77 351 487 620 390 231 496 423 761 993 385 383 390 220 620 862 805 920 838 77 339 838 231 691 384 930 251 840 77 593 993 838 930 176 761 383 761 480 487 251 383 295 390 289 808 ...
output:
6403686