Submission #40415

# Submission time Handle Problem Language Result Execution time Memory
40415 2018-02-01T12:22:35 Z Pajaraja Pipes (CEOI15_pipes) C++14
10 / 100
3458 ms 65536 KB
#include <bits/stdc++.h>
using namespace std;
vector<int> g[100007];
int d[100007],minx[100007];
void dfs(int s,int du,int f)
{
	minx[s]=du;
	d[s]=du;
	for(int i=0;i<g[s].size();i++) if(f!=g[s][i])
	{
		if(d[g[s][i]]==-1)
		{
			dfs(g[s][i],du+1,s);
			if(minx[g[s][i]] > du) printf("%d %d\n",s,g[s][i]);
			minx[s]=min(minx[s],minx[g[s][i]]);
		}
		else minx[s]=min(minx[s],d[g[s][i]]); 
	}
}
int main()
{
	int n,m;
	fill(d,d+100007,-1);
	scanf("%d%d",&n,&m);
	for(int i=0;i<m;i++)
	{
		int t1,t2;
		scanf("%d%d",&t1,&t2);
		g[t1].push_back(t2);
		g[t2].push_back(t1);
	}
	for(int i=1;i<=n;i++) if(d[i]==-1) dfs(i,0,-1);
}

Compilation message

pipes.cpp: In function 'void dfs(int, int, int)':
pipes.cpp:9:15: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int i=0;i<g[s].size();i++) if(f!=g[s][i])
              ~^~~~~~~~~~~~
pipes.cpp: In function 'int main()':
pipes.cpp:24: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:28:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d%d",&t1,&t2);
   ~~~~~^~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 4 ms 2992 KB Output is correct
2 Incorrect 4 ms 3072 KB Wrong number of edges
# Verdict Execution time Memory Grader output
1 Correct 8 ms 3504 KB Output is correct
2 Incorrect 8 ms 3328 KB Wrong number of edges
# Verdict Execution time Memory Grader output
1 Correct 168 ms 11068 KB Output is correct
2 Correct 153 ms 10544 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 297 ms 14544 KB Output is correct
2 Runtime error 355 ms 18960 KB Memory limit exceeded (if you are sure your verdict is not MLE, please contact us)
# Verdict Execution time Memory Grader output
1 Runtime error 620 ms 25180 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 1092 ms 30544 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 1953 ms 52220 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 2391 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 3112 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 3458 ms 65536 KB Execution killed with signal 9 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -