Submission #119087

# Submission time Handle Problem Language Result Execution time Memory
119087 2019-06-20T10:07:00 Z spacewalker Library (JOI18_library) C++14
0 / 100
2000 ms 432 KB
#include <cstdio>
#include <vector>
#include "library.h"
using namespace std;

void Solve(int N)
{
	int start = -1;
	vector<int> toQuery(N, 1);
	for (int i = 0; i < N; ++i) {
		toQuery[i] = 0;
		if (Query(toQuery) == 1) {
			start = i;
			break;
		}
		toQuery[i] = 1;
	}
	vector<int> ans{start};
//	printf("start %d\n", start);
	for (int i = 1; i < N; ++i) {
		for (int pnext = 0; pnext < N; ++pnext) {
			if (ans.size() > 1 && pnext == *next(ans.rbegin(), 1)) continue;
			if (pnext == ans.back()) continue;
			vector<int> toQuery(N);
			toQuery[ans.back()] = toQuery[pnext] = 1;
			if (Query(toQuery) == 1) {
				ans.push_back(pnext);
//				printf("next %d\n", pnext);
				break;
			}
		}
	}
	vector<int> retVal;
	for (int x : ans) retVal.push_back(x + 1);
	Answer(retVal);
}
	
# Verdict Execution time Memory Grader output
1 Correct 210 ms 256 KB # of queries: 18340
2 Correct 232 ms 400 KB # of queries: 18148
3 Correct 221 ms 256 KB # of queries: 19899
4 Correct 250 ms 384 KB # of queries: 19898
5 Correct 218 ms 384 KB # of queries: 19906
6 Correct 339 ms 424 KB # of queries: 19905
7 Correct 277 ms 312 KB # of queries: 19904
8 Correct 202 ms 256 KB # of queries: 18522
9 Correct 280 ms 384 KB # of queries: 19703
10 Correct 107 ms 376 KB # of queries: 8254
11 Incorrect 2 ms 384 KB Wrong Answer [2]
12 Correct 1 ms 256 KB # of queries: 2
13 Correct 2 ms 256 KB # of queries: 4
14 Correct 2 ms 384 KB # of queries: 6
15 Correct 4 ms 256 KB # of queries: 106
16 Correct 4 ms 384 KB # of queries: 354
# Verdict Execution time Memory Grader output
1 Correct 210 ms 256 KB # of queries: 18340
2 Correct 232 ms 400 KB # of queries: 18148
3 Correct 221 ms 256 KB # of queries: 19899
4 Correct 250 ms 384 KB # of queries: 19898
5 Correct 218 ms 384 KB # of queries: 19906
6 Correct 339 ms 424 KB # of queries: 19905
7 Correct 277 ms 312 KB # of queries: 19904
8 Correct 202 ms 256 KB # of queries: 18522
9 Correct 280 ms 384 KB # of queries: 19703
10 Correct 107 ms 376 KB # of queries: 8254
11 Incorrect 2 ms 384 KB Wrong Answer [2]
12 Correct 1 ms 256 KB # of queries: 2
13 Correct 2 ms 256 KB # of queries: 4
14 Correct 2 ms 384 KB # of queries: 6
15 Correct 4 ms 256 KB # of queries: 106
16 Correct 4 ms 384 KB # of queries: 354
17 Execution timed out 3022 ms 384 KB Time limit exceeded
18 Execution timed out 3074 ms 408 KB Time limit exceeded
19 Execution timed out 3006 ms 256 KB Time limit exceeded
20 Execution timed out 3027 ms 384 KB Time limit exceeded
21 Execution timed out 3019 ms 324 KB Time limit exceeded
22 Execution timed out 3048 ms 256 KB Time limit exceeded
23 Execution timed out 3071 ms 256 KB Time limit exceeded
24 Incorrect 1715 ms 256 KB Wrong Answer [3]
25 Execution timed out 3029 ms 256 KB Time limit exceeded
26 Execution timed out 3056 ms 256 KB Time limit exceeded
27 Incorrect 1633 ms 432 KB Wrong Answer [3]
28 Execution timed out 3080 ms 384 KB Time limit exceeded
29 Execution timed out 3023 ms 320 KB Time limit exceeded
30 Execution timed out 3043 ms 332 KB Time limit exceeded