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 "xylophone.h"
#include <bits/stdc++.h>
using namespace std;
void solve(int N) {
vector<int> pp;
for (int i=1;i<=N;i++) pp.push_back(i);
vector<int> nm;
for (int i=1;i<N;i++) {
nm.push_back(query(i,i+1));
}
sort(pp.begin(),pp.end());
do
{
bool bl=true;
for (int i=0;i<N-1;i++)
{
if (max(pp[i],pp[i+1])-min(pp[i],pp[i+1])!=nm[i]) bl=false;
}
if (bl) {break;}
}while (next_permutation(pp.begin(),pp.end()));
for(int i = 0; i < N; i++) {
answer(i+1, pp[i]);
}
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |