제출 #230650

#제출 시각아이디문제언어결과실행 시간메모리
230650Dilshod_ImomovLibrary (JOI18_library)C++17
19 / 100
3094 ms4448 KiB
#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) 메시지

library.cpp: In function 'void Solve(int)':
library.cpp:56:5: warning: 'start' may be used uninitialized in this function [-Wmaybe-uninitialized]
  dfs( start, 0 );
  ~~~^~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...