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 fr(i, a, b) for (int i = a; i <= b; ++i)
#define rf(i, a, b) for (int i = a; i >= b; --i)
#define fe(x, y) for (auto& x : y)
#define fi first
#define se second
#define pb push_back
#define sz(x) (int)x.size()
#define all(x) x.begin(), x.end()
#define pw(x) (1LL << (x))
using namespace std;
template <typename T>
using ve = vector < T >;
template <typename T>
bool umx(T& a, T b) {return a < b ? a = b, 1 : 0;}
template <typename T>
bool umn(T& a, T b) {return a > b ? a = b, 1 : 0;}
using ll = long long;
using pll = pair <ll, ll>;
using pii = pair <int, int>;
const int N = 2e5 + 100;
const int oo = 1e9 + 10;
const ll OO = 1e18 + 100;
vector<int> order;
int n;
int ans[N];
void solve(int k) {
n = k;
order.resize(n, 0);
iota(all(order), 1);
int was = publish(order);
for (int i = 0; i < n; ++i) {
int x = was;
order.erase(order.begin());
order.pb(i + 1);
int y = publish(order);
int vl = (x + y - (n - 1)) / 2;
ans[x - vl] = i;
was = y;
}
order.clear();
fr(i, 0, n - 1) order.pb(ans[i] + 1);
answer(order);
}
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... |