Submission #100768

# Submission time Handle Problem Language Result Execution time Memory
100768 2019-03-14T08:57:11 Z JPN20 Library (JOI18_library) C++17
0 / 100
530 ms 640 KB
#include <bits/stdc++.h>
#include "library.h"
using namespace std;

int c = 0, N; bool used[1009];

int getans(int pos) {
	vector<int>vec;
	for (int i = 0; i < N; i++) {
		if (used[i] == false) vec.push_back(i);
	}
	
	int sz = 1, cc = 0; while (sz <= vec.size()) { sz *= 2; cc++; }
	
	int cx = 0;
	for (int i = cc - 1; i >= 0; i--) {
		vector<int>V1(N, 0);
		for (int j = 0; j < cx + (1 << i); j++) {
			if (j >= vec.size()) break;
			V1[vec[j]] = 1;
		}
		vector<int>V2 = V1; V2[c] = 1;
		
		int F1 = Query(V1);
		int F2 = Query(V2);
		if (F1 != F2) cx += (1 << i);
	}
	return vec[cx];
}

void Solve(int NN) {
	N = NN;
	for (int i = 0; i < N; i++) {
		vector<int>G(N, 1); G[i] = 0;
		int Z = Query(G);
		if (Z == 1) { c = i; }
	}
	
	vector<int>W;
	used[c] = true; W.push_back(c + 1);
	
	for (int i = 0; i < N - 1; i++) {
		int f = getans(c);
		W.push_back(f + 1);
		used[f] = true;
		c = f;
	}
	Answer(W);
}

Compilation message

library.cpp: In function 'int getans(int)':
library.cpp:13:32: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  int sz = 1, cc = 0; while (sz <= vec.size()) { sz *= 2; cc++; }
                             ~~~^~~~~~~~~~~~~
library.cpp:19:10: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    if (j >= vec.size()) break;
        ~~^~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 36 ms 408 KB # of queries: 2754
2 Correct 40 ms 640 KB # of queries: 2737
3 Correct 34 ms 320 KB # of queries: 2890
4 Correct 35 ms 304 KB # of queries: 2890
5 Correct 40 ms 384 KB # of queries: 2890
6 Correct 38 ms 384 KB # of queries: 2890
7 Correct 40 ms 384 KB # of queries: 2890
8 Correct 44 ms 384 KB # of queries: 2771
9 Correct 37 ms 256 KB # of queries: 2873
10 Correct 15 ms 324 KB # of queries: 1683
11 Incorrect 2 ms 256 KB Wrong Answer [2]
12 Correct 2 ms 384 KB # of queries: 4
13 Correct 2 ms 384 KB # of queries: 9
14 Correct 2 ms 384 KB # of queries: 14
15 Correct 4 ms 256 KB # of queries: 105
16 Correct 5 ms 256 KB # of queries: 235
# Verdict Execution time Memory Grader output
1 Correct 36 ms 408 KB # of queries: 2754
2 Correct 40 ms 640 KB # of queries: 2737
3 Correct 34 ms 320 KB # of queries: 2890
4 Correct 35 ms 304 KB # of queries: 2890
5 Correct 40 ms 384 KB # of queries: 2890
6 Correct 38 ms 384 KB # of queries: 2890
7 Correct 40 ms 384 KB # of queries: 2890
8 Correct 44 ms 384 KB # of queries: 2771
9 Correct 37 ms 256 KB # of queries: 2873
10 Correct 15 ms 324 KB # of queries: 1683
11 Incorrect 2 ms 256 KB Wrong Answer [2]
12 Correct 2 ms 384 KB # of queries: 4
13 Correct 2 ms 384 KB # of queries: 9
14 Correct 2 ms 384 KB # of queries: 14
15 Correct 4 ms 256 KB # of queries: 105
16 Correct 5 ms 256 KB # of queries: 235
17 Correct 492 ms 384 KB # of queries: 18954
18 Correct 477 ms 384 KB # of queries: 18723
19 Correct 521 ms 256 KB # of queries: 18954
20 Correct 440 ms 256 KB # of queries: 17736
21 Correct 345 ms 320 KB # of queries: 16707
22 Correct 530 ms 256 KB # of queries: 18954
23 Correct 370 ms 404 KB # of queries: 18933
24 Correct 132 ms 328 KB # of queries: 8727
25 Correct 475 ms 384 KB # of queries: 18513
26 Correct 391 ms 384 KB # of queries: 17337
27 Correct 159 ms 256 KB # of queries: 8687
28 Correct 433 ms 324 KB # of queries: 18954
29 Correct 476 ms 384 KB # of queries: 18933
30 Correct 458 ms 316 KB # of queries: 18954