Submission #34368

#TimeUsernameProblemLanguageResultExecution timeMemory
34368bnahmad15Pipes (CEOI15_pipes)C++14
0 / 100
5072 ms65536 KiB
#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 (stderr)

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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...