Submission #40420

# Submission time Handle Problem Language Result Execution time Memory
40420 2018-02-01T12:35:35 Z Pajaraja Pipes (CEOI15_pipes) C++14
10 / 100
708 ms 23316 KB
#include <bits/stdc++.h>
using namespace std;
vector<int> g[30007];
int d[30007],minx[30007];
void dfs(int s,int du,int f)
{
	minx[s]=10000007;
	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]=fmin(minx[s],minx[g[s][i]]);
		}
		else minx[s]=fmin(minx[s],d[g[s][i]]); 
	}
}
int main()
{
	int n,m;
	fill(d,d+30007,-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 3 ms 1152 KB Output is correct
2 Incorrect 3 ms 1096 KB Wrong number of edges
# Verdict Execution time Memory Grader output
1 Correct 7 ms 1664 KB Output is correct
2 Incorrect 6 ms 1408 KB Wrong number of edges
# Verdict Execution time Memory Grader output
1 Correct 159 ms 9176 KB Output is correct
2 Correct 157 ms 8584 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 308 ms 12596 KB Output is correct
2 Runtime error 403 ms 17004 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 708 ms 23316 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 3 ms 2048 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 3 ms 2048 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 4 ms 2048 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 4 ms 2112 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 4 ms 2048 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -