제출 #565642

#제출 시각아이디문제언어결과실행 시간메모리
565642UzoufXylophone (JOI18_xylophone)C++14
0 / 100
3093 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; break; } } 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...