Submission #958952

# Submission time Handle Problem Language Result Execution time Memory
958952 2024-04-07T09:34:25 Z Cyber_Wolf Pipes (CEOI15_pipes) C++17
0 / 100
763 ms 65536 KB
#include <bits/stdc++.h>

using namespace std;

#define lg long long
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

const lg N = 1e5+5;

vector<lg> adj[N];
lg n,m, low[N], tin[N], tmp, id;

void dfs(lg src, lg par = -1)
{
	tin[src] = low[src] = ++tmp;
	for(auto it : adj[src])
	{
		if(it == par)
		{
			continue;
		}
		if(tin[it])
		{
			low[src] = min(low[src], tin[it]);
			continue;
		}
		dfs(it, src);
		low[src] = min(low[src], low[it]);
		if(low[it] > tin[src])
		{
			cout << it << ' ' << src << '\n';
		}
	}
	// cout << src << ' ' << low[src] << '\n';
}

int main()
{
	fastio;
	cin >> n >> m;
	for(int i = 0; i < m; i++)
	{
		lg u, v;
		cin >> u >> v;
		adj[u].push_back(v);
		adj[v].push_back(u);
	}
	for(int i = 1; i <= n; i++)
	{
		if(!tin[i])	dfs(i);
	}

    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 4184 KB Output is correct
2 Incorrect 1 ms 4184 KB Wrong number of edges
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 5 ms 5212 KB Output is correct
2 Incorrect 3 ms 4700 KB Wrong number of edges
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 86 ms 25476 KB Memory limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 170 ms 35668 KB Memory limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 302 ms 62624 KB Memory limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 496 ms 65536 KB Memory limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 692 ms 65536 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 742 ms 65536 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 763 ms 65536 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 730 ms 65536 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -