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 <bits/stdc++.h>
#include "library.h"
using namespace std;
const int N = 1e3 + 7;
int used[N];
deque < int > vc = {1};
void rec( int x, int n ) {
vector < int > m(n);
m[x - 1] = 1;
int cnt = 0;
used[x] = 1;
for ( int i = 1; i <= n; i++ ) {
if ( used[i] ) {
continue;
}
m[i - 1] = 1;
int y = Query( m );
if ( y == 1 ) {
if ( cnt ) {
vc.push_front(i);
cnt++;
rec( i, n );
}
else {
vc.push_back( i );
cnt++;
rec( i, n );
}
}
m[i - 1] = 0;
}
}
void Solve(int n)
{
rec( 1, n );
vector < int > res;
for ( auto i: vc ) {
res.push_back( i );
}
Answer(res);
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |