#include "monster.h"
#include <bits/stdc++.h>
using namespace std;
std::vector<int> Solve(int N) {
std::vector<int> T(N), cnt(N);
for (int i=0; i<N; i++)
{
for (int j=i+1; j<N; j++)
{
if (Query(i, j)) cnt[i]++;
else cnt[j]++;
}
}
vector<pair<int, int>> v;
for (int i=0; i<N; i++) v.push_back({cnt[i], i});
sort(v.begin(), v.end());
for (int i = 0; i < N; i++) T[v[i].second] = i;
int a=v[2].second;
if (Query(v[0].second, a)||Query(v[0].second, v[3].second)) swap(T[v[0].second], T[v[1].second]);
a=v[N-3].second;
if (Query(v[N-2].second, a)) swap(T[v[N-2].second], T[v[N-1].second]);
//for (int i=0; i<N; i++) cout<<"t "<<T[i]<<'\n';
return T;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
Wrong Answer [3] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
Wrong Answer [3] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
138 ms |
420 KB |
Wrong Answer [6] |
2 |
Halted |
0 ms |
0 KB |
- |