Submission #125839

# Submission time Handle Problem Language Result Execution time Memory
125839 2019-07-06T12:46:56 Z wilwxk Pipes (CEOI15_pipes) C++14
0 / 100
2904 ms 65540 KB
#include <bits/stdc++.h>
using namespace std;

const int MAXN=1e5+5;
vector<int> g[MAXN];
int pre[MAXN], low[MAXN];
int n, m, tempo;

void dfs(int cur, int p) {
	pre[cur]=low[cur]=++tempo;
	for(auto viz : g[cur]) {
		if(viz==p) continue;
		if(!pre[viz]) dfs(viz, cur);
		low[cur]=min(low[cur], pre[viz]);
		low[cur]=min(low[cur], low[viz]);
		if(low[viz]==pre[viz]) printf("%d %d\n", cur, viz);
	}
	// printf("%d >> %d %d\n", cur, pre[cur], low[cur]);
}

int main() {
	scanf("%d %d", &n, &m);
	for(int i=1; i<=m; i++) {
		int a, b; scanf("%d %d", &a, &b);
		g[a].push_back(b); g[b].push_back(a);
	}

	for(int i=1; i<=n; i++) if(!pre[i]) dfs(i, i);

}

Compilation message

pipes.cpp: In function 'int main()':
pipes.cpp:22: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:24:18: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   int a, b; scanf("%d %d", &a, &b);
             ~~~~~^~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 2680 KB Wrong number of edges
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 10 ms 3324 KB Wrong number of edges
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 275 ms 20660 KB Memory limit exceeded (if you are sure your verdict is not MLE, please contact us)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 488 ms 31580 KB Memory limit exceeded (if you are sure your verdict is not MLE, please contact us)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 892 ms 54176 KB Memory limit exceeded (if you are sure your verdict is not MLE, please contact us)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1310 ms 65536 KB Memory limit exceeded (if you are sure your verdict is not MLE, please contact us)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 2326 ms 65536 KB Memory limit exceeded (if you are sure your verdict is not MLE, please contact us)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 2352 ms 65536 KB Execution killed with signal 9 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 2755 ms 65540 KB Execution killed with signal 9 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 2904 ms 65540 KB Execution killed with signal 9 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -