Submission #565624

#TimeUsernameProblemLanguageResultExecution timeMemory
565624UzoufXylophone (JOI18_xylophone)C++14
0 / 100
3071 ms208 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...