답안 #54797

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
54797 2018-07-05T05:49:44 Z 김세빈(#1509) Pipes (CEOI15_pipes) C++11
0 / 100
3414 ms 65536 KB
#include <bits/stdc++.h>

using namespace std;

vector <int> V[101010];
int K[101010], T[101010];
bool chk[101010];
int n, m, cnt;

void dfs(int p)
{
	K[p] = ++cnt;
	
	for(auto t: V[p]){
		if(!K[t]) dfs(t);
	}
}

int dfs2(int p, int r)
{
	int ret, k, f;
	
	chk[p] = 1;
	f = 0;
	ret = k = K[p];
	
	for(auto t: V[p]){
		if(!chk[t]) ret = min(ret, dfs2(t, p));
		else if(t == r){
			if(f++) ret = min(ret, K[t]);
		}
		else ret = min(ret, K[t]);
	}
	
	if(ret == k && r != 0) printf("%d %d\n", p, r);
	
	return K[p] = ret;
}

int main()
{
	int i, a, b;
	
	scanf("%d%d", &n, &m);
	
	for(i=1;i<=m;i++){
		scanf("%d%d", &a, &b);
		V[a].push_back(b);
		V[b].push_back(a);
	}
/*	
	for(i=1;i<=n;i++){
		if(!K[i]) dfs(i);
	}
*/
/*	
	for(i=1;i<=n;i++){
		if(!chk[i]) dfs2(i, 0);
	}
*/	
	return 0;
}

Compilation message

pipes.cpp: In function 'int main()':
pipes.cpp:44:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d%d", &n, &m);
  ~~~~~^~~~~~~~~~~~~~~~
pipes.cpp:47:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d%d", &a, &b);
   ~~~~~^~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 4 ms 2688 KB Wrong number of edges
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 7 ms 2944 KB Wrong number of edges
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 147 ms 10464 KB Output is correct
2 Incorrect 141 ms 10104 KB Wrong number of edges
# 결과 실행 시간 메모리 Grader output
1 Correct 285 ms 13320 KB Output is correct
2 Runtime error 341 ms 18424 KB Memory limit exceeded (if you are sure your verdict is not MLE, please contact us)
# 결과 실행 시간 메모리 Grader output
1 Runtime error 548 ms 22984 KB Memory limit exceeded (if you are sure your verdict is not MLE, please contact us)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 994 ms 24440 KB Memory limit exceeded (if you are sure your verdict is not MLE, please contact us)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1710 ms 45380 KB Memory limit exceeded (if you are sure your verdict is not MLE, please contact us)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 2481 ms 57352 KB Memory limit exceeded (if you are sure your verdict is not MLE, please contact us)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 3029 ms 58868 KB Memory limit exceeded (if you are sure your verdict is not MLE, please contact us)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 3414 ms 65536 KB Execution killed with signal 9 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -