이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#ifndef LOCAL
#include "monster.h"
#endif
using namespace std;
vector<int> Solve(int n) {
vector<int> cntWin(n);
for (int i = 0; i < n; ++i) {
for (int j = i + 1; j < n; ++j) {
if (Query(i, j)) {
++cntWin[i];
} else {
++cntWin[j];
}
}
}
vector<int> order(n);
iota(order.begin(), order.end(), 0);
sort(order.begin(), order.end(), [&](const int& A, const int& B) {
return cntWin[A] < cntWin[B];
});
if (Query(order[1], order[0])) {
swap(order[0], order[1]);
}
if (Query(order[n - 1], order[n - 2])) {
swap(order[n - 2], order[n - 1]);
}
vector<int> ans(n);
for (int i = 0; i < n; ++i) {
ans[order[i]] = i;
}
return ans;
}
/*
void solve() {
}
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
#ifdef LOCAL
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
int T = 1;
cin >> T;
while (T--) {
solve();
cerr << "-----------\n";
cout << "-----------\n";
}
#else
int T = 1;
// cin >> T;
while (T--) {
solve();
}
#endif
return 0;
}
*/
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |