# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
565622 | Uzouf | Xylophone (JOI18_xylophone) | C++14 | 1 ms | 208 KiB |
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;
static int A[5000];
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;i++)
{
if (max(pp[i],pp[i-1])-min(pp[i],pp[i-1])!=nm[i-1]) bl=false;
}
if (bl) {break;}
}while (next_permutation(pp.begin(),pp.end()));
for(int i = 0; i < N; i++) {
answer(i+1, pp[i]);
}
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |