이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "monster.h"
#include <bits/stdc++.h>
using namespace std;
const int nx=205;
int n, dp[nx][nx], cnt[nx];
std::vector<int> Solve(int N) {
n=N;
for (int i=0; i<n; i++) for (int j=i+1; j<n; j++) dp[i][j]=Query(i, j), dp[j][i]=!dp[i][j], cnt[i]+=dp[i][j], cnt[j]+=dp[j][i];
vector<pair<int ,int>> v;
for (int i=0; i<n; i++) v.push_back({cnt[i], i});
sort(v.begin(), v.end());
vector<int> res(n), ans(n);
for (int i=0; i<n; i++) res[i]=v[i].second;
if (!dp[res[0]][res[1]]) swap(res[0], res[1]);
if (!dp[res[n-2]][res[n-1]]) swap(res[n-2], res[n-1]);
for (int i=0; i<n; i++) ans[res[i]]=i;
/*
cout<<"res ";
for (auto x:res) cout<<x<<' ';
cout<<'\n';
cout<<"ans ";
for (auto x:ans) cout<<x<<' ';
cout<<'\n';
*/
return ans;
}
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |