# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
230650 | Dilshod_Imomov | Library (JOI18_library) | C++17 | 3094 ms | 4448 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#include "library.h"
using namespace std;
const int N = 1e3 + 7;
vector < int > adj[N], res;
int used[N], cnt[N][N];
void dfs( int v, int ind ) {
// cout << v << ' ' << ind << endl;
res[ind] = v;
used[v] = 1;
for ( auto u: adj[v] ) {
if ( !used[u] ) {
dfs( u, ind + 1 );
}
}
}
void Solve(int n)
{
vector < int > m(n);
res.assign(n, 0);
if ( n == 1 ) {
res[0] = 1;
Answer(res);
return;
}
for ( int i = 1; i <= n; i++ ) {
m[i - 1] = 1;
for ( int j = 1; j <= n; j++ ) {
if ( i == j || cnt[i][j] ) {
continue;
}
cnt[i][j] = 1;
cnt[j][i] = 1;
m[j - 1] = 1;
int x = Query(m);
if ( x == 1 ) {
adj[i].push_back( j );
adj[j].push_back( i );
}
m[j - 1] = 0;
}
m[i - 1] = 0;
}
int start;
for ( int i = 1; i <= n; i++ ) {
// cout << i << ' ' << adj[i].size() << '\n';
if ( (int)adj[i].size() == 1 ) {
start = i;
break;
}
}
dfs( start, 0 );
Answer(res);
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |