# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
34368 | bnahmad15 | Pipes (CEOI15_pipes) | C++14 | 5072 ms | 65536 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |