Submission #958963

# Submission time Handle Problem Language Result Execution time Memory
958963 2024-04-07T10:08:07 Z Cyber_Wolf Pipes (CEOI15_pipes) C++17
10 / 100
1431 ms 65536 KB
#include <bits/stdc++.h>

using namespace std;

#define lg int
#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;
	map<lg, lg> o;
	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]);
		o[it]++;
	}
	for(auto [a, b] : o)
	{
		if(b > 1)	continue;
		if(low[a] > tin[src])
		{
			cout << a << ' ' << 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 3416 KB Output is correct
2 Incorrect 1 ms 3164 KB Wrong number of edges
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 4 ms 4188 KB Output is correct
2 Incorrect 3 ms 3676 KB Wrong number of edges
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 79 ms 14588 KB Output is correct
2 Correct 87 ms 16140 KB Output is correct
# Verdict Execution time Memory Grader output
1 Runtime error 150 ms 20760 KB Memory limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 310 ms 36204 KB Memory limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 496 ms 47700 KB Memory limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 763 ms 65536 KB Memory limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1059 ms 65536 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1279 ms 65536 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1431 ms 65536 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -