Submission #130202

# Submission time Handle Problem Language Result Execution time Memory
130202 2019-07-14T08:40:19 Z RockyB Library (JOI18_library) C++17
19 / 100
2000 ms 2876 KB
#include "library.h"

#include <bits/stdc++.h>

using namespace std;

const int MAXN = (int)1e5 + 7;

vector <int> g[MAXN];

void Solve(int N) {
	vector <int> A(N);
	for (int i = 1; i <= N; i++) {
		for (int j = i + 1; j <= N; j++) {
			A[i - 1] = A[j - 1] = 1;
			int cnt = Query(A);
			if (cnt == 1) {
				g[i].push_back(j);
				g[j].push_back(i);
			}
			A[i - 1] = A[j - 1] = 0;
		}
	}		
	int v = -1, p = -1;
	vector <int> ans;
	for (int i = 1; i <= N; i++) {
		// cerr << i << " -> " << g[i].size() << endl;
		if (g[i].size() <= 1) {
			v = i;
			break;
		}
	}
	while (ans.size() < N) {
		ans.push_back(v);
		for (auto it : g[v]) {
			if (it != p) {
				p = v;
				v = it;
				break;
			}
		}
	}
	// for (auto it : ans) cerr << it << ' ';
	Answer(ans);
}

Compilation message

library.cpp: In function 'void Solve(int)':
library.cpp:33:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  while (ans.size() < N) {
         ~~~~~~~~~~~^~~
# Verdict Execution time Memory Grader output
1 Correct 320 ms 2680 KB # of queries: 18336
2 Correct 301 ms 2728 KB # of queries: 18145
3 Correct 283 ms 2668 KB # of queries: 19900
4 Correct 277 ms 2876 KB # of queries: 19900
5 Correct 324 ms 2728 KB # of queries: 19900
6 Correct 322 ms 2728 KB # of queries: 19900
7 Correct 341 ms 2680 KB # of queries: 19900
8 Correct 297 ms 2680 KB # of queries: 18528
9 Correct 356 ms 2668 KB # of queries: 19701
10 Correct 136 ms 2680 KB # of queries: 8256
11 Correct 4 ms 2552 KB # of queries: 0
12 Correct 4 ms 2552 KB # of queries: 1
13 Correct 4 ms 2680 KB # of queries: 3
14 Correct 5 ms 2552 KB # of queries: 6
15 Correct 5 ms 2556 KB # of queries: 105
16 Correct 8 ms 2680 KB # of queries: 351
# Verdict Execution time Memory Grader output
1 Correct 320 ms 2680 KB # of queries: 18336
2 Correct 301 ms 2728 KB # of queries: 18145
3 Correct 283 ms 2668 KB # of queries: 19900
4 Correct 277 ms 2876 KB # of queries: 19900
5 Correct 324 ms 2728 KB # of queries: 19900
6 Correct 322 ms 2728 KB # of queries: 19900
7 Correct 341 ms 2680 KB # of queries: 19900
8 Correct 297 ms 2680 KB # of queries: 18528
9 Correct 356 ms 2668 KB # of queries: 19701
10 Correct 136 ms 2680 KB # of queries: 8256
11 Correct 4 ms 2552 KB # of queries: 0
12 Correct 4 ms 2552 KB # of queries: 1
13 Correct 4 ms 2680 KB # of queries: 3
14 Correct 5 ms 2552 KB # of queries: 6
15 Correct 5 ms 2556 KB # of queries: 105
16 Correct 8 ms 2680 KB # of queries: 351
17 Execution timed out 3027 ms 2676 KB Time limit exceeded
18 Execution timed out 3073 ms 2808 KB Time limit exceeded
19 Execution timed out 3096 ms 2680 KB Time limit exceeded
20 Execution timed out 3085 ms 2552 KB Time limit exceeded
21 Execution timed out 3006 ms 2552 KB Time limit exceeded
22 Execution timed out 3008 ms 2680 KB Time limit exceeded
23 Execution timed out 3071 ms 2552 KB Time limit exceeded
24 Incorrect 1067 ms 2680 KB Wrong Answer [3]
25 Execution timed out 3097 ms 2680 KB Time limit exceeded
26 Execution timed out 3073 ms 2552 KB Time limit exceeded
27 Incorrect 996 ms 2672 KB Wrong Answer [3]
28 Execution timed out 3057 ms 2552 KB Time limit exceeded
29 Execution timed out 3033 ms 2680 KB Time limit exceeded
30 Execution timed out 3099 ms 2552 KB Time limit exceeded