#include <bits/stdc++.h>
#include "simurgh.h"
//#include "grader.cpp"
#define pb push_back
#define sz(s) (int)s.size()
using namespace std;
const int N = (int)500 + 7;
vector < int > gr[N];
vector < int > ask;
vector < int > ans, u1, v1;
int nn;
bool fl;
void go(int cur) {
if (fl) return ;
if (cur + 1 == nn) {
for (int to : gr[cur]) {
ask[cur - 1] = to;
int cnt = count_common_roads(ask);
if (cnt == nn - 1) {
ans = ask;
fl = 1;
return ;
}
}
return ;
}
for (int to : gr[cur]) {
ask[cur - 1] = to;
go(cur + 1);
}
}
vector<int> find_roads(int n1, vector<int> U, vector<int> V) {
int m = U.size();
nn = n1;
ask.resize(nn - 1);
ans.resize(nn - 1);
u1 = U;
v1 = V;
for (int i = 0; i < m; i++) {
if (u1[i] > v1[i]) swap(u1[i], v1[i]);
gr[v1[i]].pb(i);
}
go(1);
return ans;
}
/*
7 21
0 1
0 2
0 3
0 4
0 5
0 6
1 2
1 3
1 4
1 5
1 6
2 3
2 4
2 5
2 6
3 4
3 5
3 6
4 5
4 6
5 6
0 6 11 15 18 20
*/
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
376 KB |
WA in grader: NO |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
376 KB |
WA in grader: NO |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
376 KB |
WA in grader: NO |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
correct |
2 |
Incorrect |
4 ms |
532 KB |
WA in grader: NO |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
376 KB |
WA in grader: NO |
2 |
Halted |
0 ms |
0 KB |
- |