# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1052241 | Sacharlemagne | Monster Game (JOI21_monster) | C++17 | 0 ms | 0 KiB |
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"
using namespace std;
namespace {
bool example_variable;
} // namespace
vector<int> Solve(int N) {
vector<int> v(N), ans(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]);
}