답안 #128243

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
128243 2019-07-10T15:00:51 Z zeyad49 Pipes (CEOI15_pipes) C++17
10 / 100
5000 ms 61276 KB
#include <bits/stdc++.h>
using namespace std;
const int N=4000;
int n;
int cnt[N][N];
bool visited[N];
	 void dfs(int u) {
		visited[u] = true;
		for (int v = 0; v < n; v++)
			if (cnt[u][v] > 0 && !visited[v])
				dfs(v);
	}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(NULL);
    int m,u,v;
    cin>>n>>m;
		while (m-- > 0) {
		    cin>>u>>v;
		    u--;
		    v--;
			cnt[u][v]++;
			cnt[v][u]++;
		}
		for (int u = 0; u < n; u++)
			for (int v = u + 1; v < n; v++) {
				if (cnt[u][v] != 1)
					continue;
				cnt[u][v] = cnt[v][u] = 0;
				for(int i=0;i<n;i++)
				visited[i]=false;
				dfs(u);
				if (!visited[v])
					printf("%d %d\n", u + 1, v + 1);

				cnt[u][v] = cnt[v][u] = 1;
			}

}
	
	

    
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 760 KB Output is correct
2 Correct 4 ms 632 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Runtime error 7 ms 676 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 5020 ms 61276 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 6 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 6 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 6 ms 508 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 6 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 6 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 6 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 6 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -