이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "monster.h"
#include <bits/stdc++.h>
#define all(x) x.begin(), x.end()
using namespace std;
vector<int> Solve(int n) {
vector <int> A(n, 0);
for (int i = 0; i < n; i++){
for (int j = i + 1; j < n; j++){
if (Query(i,j))A[i]++;
else A[j]++;
}
}
vector <int> pos(n);
iota(all(pos), 0);
sort(all(pos), [&](auto x, auto y){
return A[x] < A[y];
});
if (!Query(pos[0],pos[1]))
swap(pos[0], pos[1]);
if (Query(pos[n - 2], pos[n - 1]) == false)
swap(pos[n - 2], pos[n - 1]);
for (int i = 0; i < n; i++){
A[pos[i]] = i;
}
return A;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |