// Template path: /home/mohammed/.config/sublime-text-3/Packages/User
#include <bits/stdc++.h>
using namespace std;
#include "simurgh.h"
std::vector<int> find_roads(int n, std::vector<int> u, std::vector<int> v) {
int sz = u.size();
vector<int> vv;
for (int i = 0 ; i < n - 1; i++) {
vv.push_back(i);
}
int curr = count_common_roads(vv);
if (curr == n - 1) {
return vv;
}
vector<int> same;
same.push_back(vv[n - 2]);
bool golden = false;
for (int i = n - 1 ; i < sz; i++) {
vv[n - 2] = i;
int e = count_common_roads(vv);
if (e < curr) {
golden = true;
}
if (e == curr) {
same.push_back(i);
}
}
vv.clear();
for (int i = 0 ; i < n - 1 ; i++) {
vv.push_back(i);
}
curr = count_common_roads(vv);
for (int i = 0 ; i < n -2 ; i++) {
vv[i] = n - 1;
int e = count_common_roads(vv);
if (e == curr) {
same.push_back(i);
}
vv[i] = i;
}
if (golden) {
return vv;
} else {
set<int> ss;
for (int i = 0 ; i < sz ; i++) {
ss.insert(i);
}
for (auto & i : same) {
auto it = ss.lower_bound(i);
ss.erase(it);
}
vv.clear();
for (auto &i : ss) {
vv.push_back(i);
}
return vv;
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
WA in grader: NO |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
WA in grader: NO |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
WA in grader: NO |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
correct |
2 |
Incorrect |
0 ms |
212 KB |
WA in grader: NO |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
WA in grader: NO |
2 |
Halted |
0 ms |
0 KB |
- |