Submission #739072

# Submission time Handle Problem Language Result Execution time Memory
739072 2023-05-09T20:25:50 Z kirakaminski968 Pipes (CEOI15_pipes) C++17
10 / 100
1742 ms 65536 KB
#include <bits/stdc++.h>
using namespace std;
void dfs(int u, int p, vector<int> &num, vector<int> &low, int timer, vector<vector<int>> &g){
	low[u] = num[u] = ++timer;
	for(int v : g[u]){
		if(!num[v]){
			dfs(v, u, num, low, timer, g);
			if(low[v] > num[u]) cout << u+1 << " " << v+1 << "\n";
			low[u] = min(low[u], low[v]);
		}
		else if(v != p) low[u] = min(low[u], num[v]);
	}
}

int main(){
    ios_base::sync_with_stdio(0); cin.tie(0);
    int N,M; cin >> N >> M;
	vector<vector<int>> g(N);
	for(int i = 0;i<M;++i){
        int a,b; cin >> a >> b; --a; --b;
        g[a].push_back(b); g[b].push_back(a);
	}
	vector<int> num(N),low(N);
	for(int i = 0; i < N; i++)
		if(!num[i]) dfs(i, -1, num, low, 0,g);
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Incorrect 0 ms 320 KB Wrong number of edges
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 4 ms 1108 KB Output is correct
2 Incorrect 4 ms 724 KB Wrong number of edges
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 112 ms 14204 KB Output is correct
2 Correct 115 ms 13252 KB Output is correct
# Verdict Execution time Memory Grader output
1 Runtime error 187 ms 21936 KB Memory limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 364 ms 40060 KB Memory limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 581 ms 52380 KB Memory limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 936 ms 65536 KB Memory limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1212 ms 65536 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1532 ms 65536 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1742 ms 65536 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -