답안 #230648

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
230648 2020-05-10T19:32:26 Z Dilshod_Imomov 도서관 (JOI18_library) C++17
0 / 100
2000 ms 504 KB
#include <bits/stdc++.h>
#include "library.h"
using namespace std;
 
const int N = 1e3 + 7;

vector < int > adj[N], res;
int used[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 ) {
				continue;
			}
			m[j - 1] = 1;
			int x = Query(m);
			if ( x == 1 ) {
				adj[i].push_back( j );
			}
			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);
}

Compilation message

library.cpp: In function 'void Solve(int)':
library.cpp:53:5: warning: 'start' may be used uninitialized in this function [-Wmaybe-uninitialized]
  dfs( start, 0 );
  ~~~^~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 321 ms 384 KB Wrong Answer [3]
2 Incorrect 323 ms 384 KB Wrong Answer [3]
3 Incorrect 393 ms 384 KB Wrong Answer [3]
4 Incorrect 288 ms 504 KB Wrong Answer [3]
5 Incorrect 343 ms 384 KB Wrong Answer [3]
6 Incorrect 341 ms 384 KB Wrong Answer [3]
7 Incorrect 342 ms 384 KB Wrong Answer [3]
8 Incorrect 320 ms 384 KB Wrong Answer [3]
9 Incorrect 345 ms 384 KB Wrong Answer [3]
10 Correct 193 ms 392 KB # of queries: 16512
11 Correct 5 ms 384 KB # of queries: 0
12 Correct 4 ms 384 KB # of queries: 2
13 Correct 4 ms 384 KB # of queries: 6
14 Correct 5 ms 384 KB # of queries: 12
15 Correct 7 ms 384 KB # of queries: 210
16 Correct 10 ms 384 KB # of queries: 702
# 결과 실행 시간 메모리 Grader output
1 Incorrect 321 ms 384 KB Wrong Answer [3]
2 Incorrect 323 ms 384 KB Wrong Answer [3]
3 Incorrect 393 ms 384 KB Wrong Answer [3]
4 Incorrect 288 ms 504 KB Wrong Answer [3]
5 Incorrect 343 ms 384 KB Wrong Answer [3]
6 Incorrect 341 ms 384 KB Wrong Answer [3]
7 Incorrect 342 ms 384 KB Wrong Answer [3]
8 Incorrect 320 ms 384 KB Wrong Answer [3]
9 Incorrect 345 ms 384 KB Wrong Answer [3]
10 Correct 193 ms 392 KB # of queries: 16512
11 Correct 5 ms 384 KB # of queries: 0
12 Correct 4 ms 384 KB # of queries: 2
13 Correct 4 ms 384 KB # of queries: 6
14 Correct 5 ms 384 KB # of queries: 12
15 Correct 7 ms 384 KB # of queries: 210
16 Correct 10 ms 384 KB # of queries: 702
17 Execution timed out 3083 ms 384 KB Time limit exceeded
18 Execution timed out 3016 ms 384 KB Time limit exceeded
19 Execution timed out 3033 ms 384 KB Time limit exceeded
20 Execution timed out 3003 ms 384 KB Time limit exceeded
21 Execution timed out 3040 ms 384 KB Time limit exceeded
22 Execution timed out 3072 ms 384 KB Time limit exceeded
23 Execution timed out 3071 ms 384 KB Time limit exceeded
24 Incorrect 1798 ms 384 KB Wrong Answer [3]
25 Execution timed out 3024 ms 384 KB Time limit exceeded
26 Execution timed out 3034 ms 384 KB Time limit exceeded
27 Incorrect 1800 ms 384 KB Wrong Answer [3]
28 Execution timed out 3010 ms 384 KB Time limit exceeded
29 Execution timed out 3011 ms 384 KB Time limit exceeded
30 Execution timed out 3008 ms 384 KB Time limit exceeded