Submission #34368

# Submission time Handle Problem Language Result Execution time Memory
34368 2017-11-10T18:45:37 Z bnahmad15 Pipes (CEOI15_pipes) C++14
0 / 100
5000 ms 65536 KB
#include <bits/stdc++.h>
using namespace std;

int n,m,cant,target;
bool flag;
vector <pair<int,int> > adj[1000];
vector<int> u,v;
bool vis[1000]={false};

void check(int node){
	if (node == target){
		flag = true;
		return;
	}
	vis[node]=true;
	for (auto i : adj[node]){
		if (i.second == cant)
			continue;
		if (vis[i.first])
			continue;
		check(i.first);
	}
	vis[node]=false;
}
int main(){

	scanf("%d%d",&n,&m);
	u.resize(m);
	v.resize(m);
	for (int i =0 ;i <m;i++){
		scanf("%d%d",&u[i],&v[i]);
		adj[u[i]].push_back({v[i],i});
		adj[v[i]].push_back({u[i],i});
	}
	for (int i = 0; i<m; i++){
		cant = i;
		target = v[i];
		flag = false;
		check(u[i]);
		if (!flag){
			cout<<u[i]<<" "<<v[i]<<endl;
		}
	}
	return 0;
}

Compilation message

pipes.cpp: In function 'int main()':
pipes.cpp:27: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:31:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d%d",&u[i],&v[i]);
   ~~~~~^~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Execution timed out 5072 ms 384 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 2 ms 640 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 11 ms 9856 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 16 ms 16256 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 24 ms 23932 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 28 ms 28912 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 45 ms 45992 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 57 ms 60252 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 82 ms 65536 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 109 ms 65536 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -