#include "simurgh.h"
#ifndef EVAL
#include "grader.cpp"
#endif
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define pii pair<int,int>
vector<pii> edge;
vector<pii> edges[505];
int n, m;
vector<int> ans;
vector<int> now;
bool used[505];
bool found = false;
void dfs(int u){
if(found)return;
if((int)now.size() == n-1){
for(int i=0;i<n;i++){
if(!used[i] && i != u)return;
}int t = count_common_roads(now);
if(t == n-1){
ans = now;
found = true;
}
return;
}
used[u] = true;
for(auto [v, id] : edges[u]){
if(found)return;
if(used[v])continue;
now.pb(id);
dfs(v);
now.pop_back();
}
used[u] = false;
}
vector<int> find_roads(int Ni, vector<int> u, vector<int> v){
n = Ni, m = u.size();
for(int i=0;i<m;i++){
edges[u[i]].pb({v[i],i});
edges[v[i]].pb({u[i],i});
edge.pb({u[i],v[i]});
}
for(int i=0;i<n;i++)dfs(i);
assert(found);
return ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
2 ms |
492 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
2 ms |
492 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
2 ms |
492 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
364 KB |
correct |
2 |
Incorrect |
4 ms |
364 KB |
WA in grader: NO |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
2 ms |
492 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |