Submission #119091

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

void Solve(int N)
{
	if (N == 1) {
		Answer({1});
		return;
	}
	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 285 ms 256 KB # of queries: 18340
2 Correct 247 ms 424 KB # of queries: 18148
3 Correct 321 ms 424 KB # of queries: 19899
4 Correct 235 ms 316 KB # of queries: 19898
5 Correct 330 ms 256 KB # of queries: 19906
6 Correct 291 ms 376 KB # of queries: 19905
7 Correct 310 ms 384 KB # of queries: 19904
8 Correct 295 ms 256 KB # of queries: 18522
9 Correct 247 ms 436 KB # of queries: 19703
10 Correct 84 ms 256 KB # of queries: 8254
11 Correct 2 ms 256 KB # of queries: 0
12 Correct 2 ms 256 KB # of queries: 2
13 Correct 2 ms 256 KB # of queries: 4
14 Correct 1 ms 256 KB # of queries: 6
15 Correct 3 ms 384 KB # of queries: 106
16 Correct 4 ms 256 KB # of queries: 354
# Verdict Execution time Memory Grader output
1 Correct 285 ms 256 KB # of queries: 18340
2 Correct 247 ms 424 KB # of queries: 18148
3 Correct 321 ms 424 KB # of queries: 19899
4 Correct 235 ms 316 KB # of queries: 19898
5 Correct 330 ms 256 KB # of queries: 19906
6 Correct 291 ms 376 KB # of queries: 19905
7 Correct 310 ms 384 KB # of queries: 19904
8 Correct 295 ms 256 KB # of queries: 18522
9 Correct 247 ms 436 KB # of queries: 19703
10 Correct 84 ms 256 KB # of queries: 8254
11 Correct 2 ms 256 KB # of queries: 0
12 Correct 2 ms 256 KB # of queries: 2
13 Correct 2 ms 256 KB # of queries: 4
14 Correct 1 ms 256 KB # of queries: 6
15 Correct 3 ms 384 KB # of queries: 106
16 Correct 4 ms 256 KB # of queries: 354
17 Execution timed out 3023 ms 324 KB Time limit exceeded
18 Execution timed out 3023 ms 256 KB Time limit exceeded
19 Execution timed out 3081 ms 256 KB Time limit exceeded
20 Execution timed out 3055 ms 256 KB Time limit exceeded
21 Execution timed out 3033 ms 256 KB Time limit exceeded
22 Execution timed out 3007 ms 256 KB Time limit exceeded
23 Execution timed out 3094 ms 256 KB Time limit exceeded
24 Incorrect 1649 ms 412 KB Wrong Answer [3]
25 Execution timed out 3057 ms 332 KB Time limit exceeded
26 Execution timed out 3067 ms 332 KB Time limit exceeded
27 Incorrect 1701 ms 384 KB Wrong Answer [3]
28 Execution timed out 3011 ms 320 KB Time limit exceeded
29 Execution timed out 3058 ms 448 KB Time limit exceeded
30 Execution timed out 3088 ms 376 KB Time limit exceeded