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 int long long
#define ll long long
#define ld long double
#define pb push_back
#define nd second
#define st first
#define sz size
#define forr(i, n) for(int i=1;i<=n;i++)
const ll infl=1e18+90;
const int inf=1e9+90;
int x;
/*
int s[8]{0, 7, 4, 5, 2, 1, 3, 6};
void answer(vector<int> a)
{
for(auto it:a) cout<<it<<" ";
cout<<"\n";
}
int publish(vector<int> a)
{
//cerr<<"wchodze dla a = ";
//for(auto it:a) cerr<<it<<" ";
//cerr<<"\n";
int wyn=0;
for(int i=0;i<x;i++)
{
for(int j=i+1;j<x;j++)
{
//cerr<<"s["<<i<<"] = "<<s[i]<<" s["<<j<<"] = "<<s[j]<<"\n";
if(s[a[i]]<s[a[j]])
{
//cerr<<"dla i, j = "<<i<<" "<<j<<"\n";
wyn++;
}
}
}
//cerr<<"zwracam wyn = "<<wyn<<"\n";
return wyn;
}
*/
vector<int> wek, kon;
vector<pair<int,int> > wyn;
int fun(int a)
{
wek.clear();
for(int i=1;i<=x;i++)
{
if(i!=a) wek.pb(i);
}
wek.pb(a);
int p=publish(wek);
wek.clear();
wek.pb(a);
for(int i=2;i<=x;i++)
{
if(i!=a) wek.pb(i);
}
wek.pb(1);
int k=publish(wek);
return (k-p);
}
void solve(int n)
{
x=n;
for(int i=2;i<=n;i++)
{
int xd=fun(i);
wyn.pb({xd, i});
}
wyn.pb({0, 1});
sort(wyn.begin(), wyn.end());
for(auto it:wyn)
{
kon.pb(it.nd);
}
answer(kon);
}
/*
int main()
{
solve(7);
}
*/
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... |