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"
using namespace std;
#define pb push_back
#define pi pair<int, int>
#define endl '\n'
#define all(v) v.begin(), v.end()
#define fr(m,n,k) for(int m=n;m<=k;m++)
#define vi vector<int>
int n;
void solve(int N) {
cin >> n;
vector<int> v; fr(i, 1, n) v.pb(i);
vector<pi> is;
int has[n + 1] = {};
fr(i, 1, n) {
has[i] = publish(v);
int x = *v.begin();
v.pb(x); v.erase(v.begin());
}
has[0] = has[n];
fr(i, 1, n) {
is.pb({has[i] - has[i - 1], i - 1});
}
sort(is.rend(), is.rbegin());
vi an(n);
fr(i, 0, n - 1) {
auto [_, pos] = is[i];
an[i] = pos;
}
answer(an);
}
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... |