Submission #230647

# Submission time Handle Problem Language Result Execution time Memory
230647 2020-05-10T19:28:19 Z Dilshod_Imomov Library (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);
	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:48:5: warning: 'start' may be used uninitialized in this function [-Wmaybe-uninitialized]
  dfs( start, 0 );
  ~~~^~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 319 ms 384 KB Wrong Answer [3]
2 Incorrect 325 ms 504 KB Wrong Answer [3]
3 Incorrect 341 ms 384 KB Wrong Answer [3]
4 Incorrect 376 ms 384 KB Wrong Answer [3]
5 Incorrect 330 ms 384 KB Wrong Answer [3]
6 Incorrect 309 ms 396 KB Wrong Answer [3]
7 Incorrect 331 ms 384 KB Wrong Answer [3]
8 Incorrect 331 ms 384 KB Wrong Answer [3]
9 Incorrect 326 ms 504 KB Wrong Answer [3]
10 Correct 226 ms 384 KB # of queries: 16512
11 Incorrect 4 ms 384 KB Wrong Answer [5]
12 Correct 4 ms 384 KB # of queries: 2
13 Correct 5 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 14 ms 384 KB # of queries: 702
# Verdict Execution time Memory Grader output
1 Incorrect 319 ms 384 KB Wrong Answer [3]
2 Incorrect 325 ms 504 KB Wrong Answer [3]
3 Incorrect 341 ms 384 KB Wrong Answer [3]
4 Incorrect 376 ms 384 KB Wrong Answer [3]
5 Incorrect 330 ms 384 KB Wrong Answer [3]
6 Incorrect 309 ms 396 KB Wrong Answer [3]
7 Incorrect 331 ms 384 KB Wrong Answer [3]
8 Incorrect 331 ms 384 KB Wrong Answer [3]
9 Incorrect 326 ms 504 KB Wrong Answer [3]
10 Correct 226 ms 384 KB # of queries: 16512
11 Incorrect 4 ms 384 KB Wrong Answer [5]
12 Correct 4 ms 384 KB # of queries: 2
13 Correct 5 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 14 ms 384 KB # of queries: 702
17 Execution timed out 3083 ms 384 KB Time limit exceeded
18 Execution timed out 3098 ms 384 KB Time limit exceeded
19 Execution timed out 3018 ms 384 KB Time limit exceeded
20 Execution timed out 3011 ms 384 KB Time limit exceeded
21 Execution timed out 3051 ms 384 KB Time limit exceeded
22 Execution timed out 3098 ms 384 KB Time limit exceeded
23 Execution timed out 3072 ms 384 KB Time limit exceeded
24 Incorrect 1863 ms 384 KB Wrong Answer [3]
25 Execution timed out 3100 ms 384 KB Time limit exceeded
26 Execution timed out 3017 ms 384 KB Time limit exceeded
27 Incorrect 1851 ms 384 KB Wrong Answer [3]
28 Execution timed out 3069 ms 384 KB Time limit exceeded
29 Execution timed out 3084 ms 384 KB Time limit exceeded
30 Execution timed out 3013 ms 384 KB Time limit exceeded