# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
68758 | Talant | Simurgh (IOI17_simurgh) | C++17 | 30 ms | 23988 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 "simurgh.h"
//#include "grader.cpp"
#include <bits/stdc++.h>
#define sc second
#define fr first
#define mk make_pair
#define pb push_back
using namespace std;
const int N = (1e6 + 5);
const int inf = (1e9 + 7);
vector <pair<int,int> > g[N];
vector <int> vec,ans;
int was[N];
int nn;
int f;
void dfs (int v) {
if (f) return;
was[v] = 1;
for (auto to : g[v]) {
if (!was[to.fr]) {
vec.pb(to.sc);
dfs(to.fr);
vec.pop_back();
}
}
was[v] = 0;
if (vec.size() == nn - 1) {
int o = count_common_roads(vec);
if (o == nn - 1) {
ans = vec;
f = 1;
return;
}
}
}
vector<int> find_roads(int n, vector<int> u, vector<int> v) {
nn = n;
for (int i = 0; i < u.size(); i ++) {
g[u[i]].pb(mk(v[i],i));
g[v[i]].pb(mk(u[i],i));
}
for (int i = 0; i < n; i ++) {
dfs(i);
if (f) return ans;
}
return ans;
}
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... |