# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
597434 | 2022-07-16T02:51:50 Z | Hanksburger | Library (JOI18_library) | C++17 | 0 ms | 0 KB |
#include <bits/stdc++.h> using namespace std; vector<int> v, zero, tmp, ans; void Solve(int n) { for (int i=1; i<=n; i++) { v.push_back(i); zero.push_back(0); } for (int i=0; i<n; i++) { int l=0, r=n-i-1; while (l<r) { int m=(l+r)/2, res1, res2; tmp=zero; for (int j=l; j<=m; j++) tmp[v[j]-1]=1; res1=Query(tmp); if (i) tmp[ans[i-1]-1]=1; else for (int j=0; j<n; j++) tmp[j]^=1; res2=Query(tmp); if (res1>=res2) r=m; else l=m+1; } ans.push_back(v[l]); v.erase(v.begin()+l); } Answer(ans); }