Submission #1097504

#TimeUsernameProblemLanguageResultExecution timeMemory
1097504Alihan_8Library (JOI18_library)C++17
0 / 100
28 ms600 KiB
#include "library.h" #include <bits/stdc++.h> using namespace std; #define pb push_back int n; int qry(vector <int> p){ vector <int> M(n); for ( auto &x: p ) M[x] = 1; return Query(M); } void Solve(int N){ n = N; int st = -1; vector <int> M(n, 1), res(n); for ( int i = 0; i < n; i++ ){ M[i] = 0; if ( Query(M) == 1 ){ st = i; break; } M[i] = 1; } vector <int> chk(n); res[0] = st; chk[st] = 1; for ( int i = 1; i < n; i++ ){ vector <int> q; for ( int j = 0; j < n; j++ ){ if ( !chk[j] ) q.pb(j); } int u = 0, m = q.size(); for ( int lg = 0; lg <= 10; lg++ ){ vector <int> t; for ( int j = 0; j < m; j++ ){ if ( j >> lg & 1 ) t.pb(q[j]); } if ( t.empty() ) continue; int w = qry(t); t.pb(res[i - 1]); if ( w == qry(t) ){ u |= 1 << lg; } } res[i] = q[u]; chk[q[u]] = 1; } for ( auto &x: res ) x++; Answer(res); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...