# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
2694 | ainta | 간선 파괴 (GA5_destroy) | C++98 | 1944 ms | 2060 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<stdio.h>
int n,m,b[700],e[700],Q,p[700],c;
struct Edge{
int a,b;
}E[123457];
void init(){
int i;
for(i=1;i<=n;i++)p[i]=i;
}
int find(int a){
if(a==p[a])return a;
return p[a]=find(p[a]);
}
int main(){
int i,j,x,y,R,bb,ee;
scanf("%d%d",&n,&m);
init();
for(i=0;i<m;i++){
scanf("%d%d",&E[i].a,&E[i].b);
x=find(E[i].a),y=find(E[i].b);
if(x!=y){
p[x]=y;
b[c++]=i;
}
}
init();
c=0;
for(i=m-1;i>=0;i--){
x=find(E[i].a),y=find(E[i].b);
if(x!=y){
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |