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 "art.h"
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define F first
#define S second
#define INF 1e18
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define pii pair<int,int>
#define pll pair<ll,ll>
#define OK cout<<"Ok"<<endl;
#define MOD (ll)(1e9+7)
const int mxn=4005;
int n,arr[mxn];
map<int,int>mp;
void solve(int N) {
int n=N;
for(int i=1;i<=n;i++){
int x=i-1,y=n-i;
mp[y-x]=i;
}
vector<int>vt(n);
iota(vt.begin(),vt.end(),1);
int l=publish(vt);
int first=l,last=0;
for(int i=2;i<=n;i++){
int a=vt[0];
vt.erase(vt.begin());
vt.pb(a);
int x=publish(vt);
last=x;
arr[mp[x-l]]=i-1;
l=x;
}
arr[mp[first-last]]=n;
vector<int>ans;
for(int i=1;i<=n;i++){
ans.pb(arr[i]);
}
answer(ans);
}
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... |