This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
// 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 |
---|
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... |