# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
714397 | vjudge1 | Art Collections (BOI22_art) | C++17 | 0 ms | 208 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 <bits/stdc++.h>
#include "art.h"
#define ll long long
#define pii pair<int, int>
using namespace std;
int n;
bool comp(int a, int b){
if(a == b) return true;
vector<int> v = {a, b};
for (int i = 1; i <= n; i++)
{
if(a == i || b == i) continue;
v.emplace_back(i);
}
int p1 = publish(v);
swap(v[0], v[1]);
int p2 = publish(v);
return p1 > p2;
}
void solve(int N){
n = N;
vector<int> ans(n);
for (int i = 1; i <= (n / 2) + (n % 2); i++)
{
vector<int> v = {i};
for (int j = 1; j <= n; j++)
{
if(i == j) continue;
v.emplace_back(j);
}
int p1 = publish(v);
v.erase(v.begin());
v.push_back(i);
int p2 = publish(v);
int pos = n - (n - 1 - abs(p1 - p2)) / 2;
if(comp(i, n - i + 1)){
ans[pos - 1] = i;
ans[n - pos] = n - i + 1;
}
else{
ans[pos - 1] = n - i + 1;
ans[n - pos] = i;
}
}
answer(ans);
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |