Submission #230649

# Submission time Handle Problem Language Result Execution time Memory
230649 2020-05-10T19:34:43 Z Dilshod_Imomov Library (JOI18_library) C++17
0 / 100
2000 ms 2648 KB
#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;
			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:54:5: warning: 'start' may be used uninitialized in this function [-Wmaybe-uninitialized]
  dfs( start, 0 );
  ~~~^~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 327 ms 1144 KB Wrong Answer [3]
2 Incorrect 362 ms 1276 KB Wrong Answer [3]
3 Incorrect 380 ms 1140 KB Wrong Answer [3]
4 Incorrect 325 ms 1272 KB Wrong Answer [3]
5 Incorrect 379 ms 1144 KB Wrong Answer [3]
6 Incorrect 324 ms 1272 KB Wrong Answer [3]
7 Incorrect 379 ms 1144 KB Wrong Answer [3]
8 Incorrect 327 ms 1144 KB Wrong Answer [3]
9 Incorrect 331 ms 1272 KB Wrong Answer [3]
10 Correct 229 ms 888 KB # of queries: 16512
11 Correct 4 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 13 ms 512 KB # of queries: 702
# Verdict Execution time Memory Grader output
1 Incorrect 327 ms 1144 KB Wrong Answer [3]
2 Incorrect 362 ms 1276 KB Wrong Answer [3]
3 Incorrect 380 ms 1140 KB Wrong Answer [3]
4 Incorrect 325 ms 1272 KB Wrong Answer [3]
5 Incorrect 379 ms 1144 KB Wrong Answer [3]
6 Incorrect 324 ms 1272 KB Wrong Answer [3]
7 Incorrect 379 ms 1144 KB Wrong Answer [3]
8 Incorrect 327 ms 1144 KB Wrong Answer [3]
9 Incorrect 331 ms 1272 KB Wrong Answer [3]
10 Correct 229 ms 888 KB # of queries: 16512
11 Correct 4 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 13 ms 512 KB # of queries: 702
17 Execution timed out 3084 ms 1664 KB Time limit exceeded
18 Execution timed out 3079 ms 1540 KB Time limit exceeded
19 Execution timed out 3092 ms 1516 KB Time limit exceeded
20 Execution timed out 3065 ms 1716 KB Time limit exceeded
21 Execution timed out 3030 ms 1776 KB Time limit exceeded
22 Execution timed out 3034 ms 1784 KB Time limit exceeded
23 Execution timed out 3007 ms 1444 KB Time limit exceeded
24 Incorrect 1798 ms 2648 KB Wrong Answer [3]
25 Execution timed out 3068 ms 1700 KB Time limit exceeded
26 Execution timed out 3068 ms 1688 KB Time limit exceeded
27 Incorrect 1789 ms 2448 KB Wrong Answer [3]
28 Execution timed out 3066 ms 1676 KB Time limit exceeded
29 Execution timed out 3018 ms 1724 KB Time limit exceeded
30 Execution timed out 3080 ms 1664 KB Time limit exceeded