This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
//InTheNameOfGOD
//PRS;)
#include "art.h"
#pragma GCC optimize("unroll-loops", "Ofast", "O3")
#include<bits/stdc++.h>
#define rep(i, l, r) for(ll i = l; i < r; i++)
#define per(i, l, r) for(ll i = r - 1; i >= l; i--)
typedef int ll;
using namespace std;
constexpr ll xn = 4e3;
ll a[xn], ans[xn];
void solve(ll n)
{
vector<ll> v(n);
rep(i, 0, n) v[i] = a[i] = i + 1, ans[i] = -1;
ll ls = publish(v), t = n - 1;
while(t--)
{
per(i, 0, n - 1) swap(a[i], a[i + 1]);
rep(i, 0, n) v[i] = a[i];
ll x = publish(v);
ans[(n - ls + x - 1) >> 1] = a[0], ls = x;
}
rep(i, 0, n) if(ans[i] < 0) ans[i] = a[n - 1];
rep(i, 0, n) v[i] = ans[i];
answer(v);
}
Compilation message (stderr)
interface.cpp: In function 'int publish(std::vector<int>)':
interface.cpp:20:17: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
20 | if(v.size() != N) {
| ~~~~~~~~~^~~~
interface.cpp: In function 'void answer(std::vector<int>)':
interface.cpp:36:17: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
36 | if(v.size() != N) {
| ~~~~~~~~~^~~~
# | 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... |