Submission #40417

# Submission time Handle Problem Language Result Execution time Memory
40417 2018-02-01T12:26:14 Z Pajaraja Pipes (CEOI15_pipes) C++14
10 / 100
3325 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]=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]=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 3072 KB Output is correct
2 Incorrect 5 ms 3072 KB Wrong number of edges
# Verdict Execution time Memory Grader output
1 Correct 8 ms 3584 KB Output is correct
2 Incorrect 8 ms 3328 KB Wrong number of edges
# Verdict Execution time Memory Grader output
1 Correct 155 ms 11120 KB Output is correct
2 Correct 156 ms 10528 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 318 ms 14500 KB Output is correct
2 Runtime error 376 ms 18944 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 702 ms 25244 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 1118 ms 30512 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 1825 ms 52024 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 2487 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 3131 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 3325 ms 65536 KB Execution killed with signal 9 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -