제출 #48347

#제출 시각UTC-0아이디문제언어결과실행 시간메모리
483472018-05-11 18:26:26jeong게임 (IOI14_game)C++17
0 / 100
1080 ms544 KiB
#include <stdio.h>
#define N (1500)
int p[N], d[N], rd[N], e[N][N], m[N][N], nn;
void initialize(int n){
nn=n;
for(int i=0;i<n;i++){
p[i]=i,d[i]=rd[i]=n-1;
for(int j=0; j<n;j++)e[i][j]=i!=j,m[i][j]=0;
}
}
int find(int x){if(p[x] == x)return x;return p[x] = find(p[x]);}
void f(int x){
if(d[x] != 1)return;
for(int i=0; i<nn; i++)if(find(i) == x && rd[i]){
for(int j=0; j<nn; j++)if(e[i][j]){
int y = find(j);
d[y]--;rd[j]--;d[x]=rd[i]=0;
p[x]=y;
m[i][j]=m[j][i]=1;
if(m[i][j] || m[j][i])while(1);
e[i][j]=e[j][i]=0;
f(y);
break;
}
break;
}
}
int hasEdge(int u, int v){
if(m[u][v])return 1;
else if(e[u][v]==0)return 0;
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...