Submission #2880

# Submission time Handle Problem Language Result Execution time Memory
2880 2013-08-01T09:38:25 Z cki86201 간선 파괴 (GA5_destroy) C++
0 / 100
460 ms 2272 KB
#include<stdio.h>

//for 60point code;

int edge[550][550],V,E,r,l,q;
int check[550];

void DFS(int x)
{
	check[x]=q+1;
	int i;
	for(i=1;i<=V;i++){
		if(!check[i]&&edge[x][i]&&(edge[x][i]<l||edge[x][i]>r))DFS(i);
	}
}

void solve()
{
	int i,ret=0;
	for(i=1;i<=V;i++){
		if(check[i]!=q+1){ret++;DFS(i);}
	}
	printf("%d\n",ret);
}

int main()
{
	scanf("%d%d",&V,&E);
	int i;
	for(i=1;i<=E;i++){
		int x,y;
		scanf("%d%d",&x,&y);
		edge[x][y]=edge[y][x]=i;
	}
	scanf("%d",&q);
	while(q--){
		scanf("%d%d",&l,&r);
		solve();
	}
	return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 2272 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 460 ms 2272 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 0 ms 2268 KB SIGSEGV Segmentation fault
2 Halted 0 ms 0 KB -