이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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;
// cout << x << '\n';
vc.push_back( x );
for ( int i = 1; i <= n; i++ ) {
if ( used[i] ) {
continue;
}
m[i - 1] = 1;
int y = Query( m );
if ( y == 1 ) {
cnt++;
rec( i, n );
used[i] = 0;
return;
}
m[i - 1] = 0;
}
}
void Solve(int n)
{
for ( int i = 1; i <= n; i++ ) {
vc.clear();
// cout << "------------------\n";
rec( i, n );
if ( (int)vc.size() == n ) {
vector < int > res;
for ( auto j: vc ) {
res.push_back( j );
}
Answer(res);
break;
}
}
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |