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 "monster.h"
#include <bits/stdc++.h>
using namespace std;
namespace {
bool example_variable;
} // namespace
vector<int> Solve(int N) {
vector<int> v(N), ans(N), ret(N);
for (int i = 0; i<N; ++i) {
ans[i] = i;
for (int j = i+1; j<N; ++j) {
++v[Query(i,j) ? i : j];
}
}
sort(ans.begin(), ans.end(), [&](int a, int b) {return v[a] < v[b];});
if (!Query(ans[0], ans[1])) swap(ans[0], ans[1]);
if (!Query(ans[N-2], ans[N-1])) swap(ans[N-2], ans[N-1]);
for (int i = 0; i<N; ++i) ret[ans[i]] = i;
return ret;
}
Compilation message (stderr)
monster.cpp:6:6: warning: '{anonymous}::example_variable' defined but not used [-Wunused-variable]
6 | bool example_variable;
| ^~~~~~~~~~~~~~~~
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |