제출 #3169

#제출 시각UTC-0아이디문제언어결과실행 시간메모리
31692013-08-27 08:59:51myungwoo간선 파괴 (GA5_destroy)C++98
100 / 100
2176 ms3260 KiB
#include <stdio.h>
#define MAXN 707
#define MAXM 123460
int N,M,Q;
int mom[MAXN],prev[MAXM],next[MAXM];
bool fchk[MAXM],bchk[MAXM];
struct Edge{
Edge(int a=0,int b=0): a(a), b(b) {}
int a,b;
} edge[MAXM];
int _find(int n){ return mom[n]==n?n:(mom[n]=_find(mom[n])); }
int _union(int a,int b){ a = _find(a), b = _find(b); if (a != b){ mom[b] = a; return 1; } return 0; }
int main()
{
int i,k,s,e;
scanf("%d%d",&N,&M);
for (i=1;i<=M;i++) scanf("%d%d",&s,&e), edge[i] = Edge(s,e);
for (i=1;i<=N;i++) mom[i] = i;
for (i=1,k=0;i<=M;i++){
prev[i] = k;
if (_union(edge[i].a,edge[i].b)){
fchk[i] = 1;
k = i;
}
}
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...