Submission #108830

# Submission time Handle Problem Language Result Execution time Memory
108830 2019-05-02T08:57:02 Z tictaccat Library (JOI18_library) C++14
19 / 100
2000 ms 424 KB
#include <cstdio>
#include <vector>
#include "library.h"
#include <bits/stdc++.h>
using namespace std;

void Solve(int N)
{

	srand(time(0));

	vector<int> M(N,1), indices(N);

	if (N == 1) {
		Answer(vector<int>{1});
		return;
	}

	iota(indices.begin(),indices.end(),0);
	random_shuffle(indices.begin(),indices.end());

	vector<int> res(N);
	vector<bool> found(N);

	for (res[0] = 0; res[0] < N; res[0]++) {
		M[res[0]] = 0;
		if (Query(M) == 1) {
			found[res[0]] = true;
			break;
		}
		M[res[0]] = 1;
	}

	M = vector<int>(N,0);
	M[res[0]] = 1;

	for (int k = 1; k < N; k++) {
		for (int i: indices) {
			if (found[i]) continue;
			M[i] = 1;
			if (Query(M) == 1) {
				res[k] = i;
				found[i] = true;
				break;
			}
			M[i] = 0;
		}
	}

	for (int i = 0; i < N; i++) {
		res[i]++;
	//	cout << res[i] << " ";
	}

	// cout << "\n";

	Answer(res);
}
# Verdict Execution time Memory Grader output
1 Correct 142 ms 256 KB # of queries: 9259
2 Correct 115 ms 256 KB # of queries: 8540
3 Correct 105 ms 256 KB # of queries: 10424
4 Correct 128 ms 256 KB # of queries: 10253
5 Correct 149 ms 384 KB # of queries: 10665
6 Correct 129 ms 384 KB # of queries: 10684
7 Correct 162 ms 256 KB # of queries: 10760
8 Correct 121 ms 256 KB # of queries: 9582
9 Correct 126 ms 384 KB # of queries: 9114
10 Correct 53 ms 320 KB # of queries: 4165
11 Correct 2 ms 384 KB # of queries: 0
12 Correct 2 ms 256 KB # of queries: 2
13 Correct 2 ms 384 KB # of queries: 4
14 Correct 2 ms 256 KB # of queries: 6
15 Correct 4 ms 384 KB # of queries: 42
16 Correct 5 ms 256 KB # of queries: 215
# Verdict Execution time Memory Grader output
1 Correct 142 ms 256 KB # of queries: 9259
2 Correct 115 ms 256 KB # of queries: 8540
3 Correct 105 ms 256 KB # of queries: 10424
4 Correct 128 ms 256 KB # of queries: 10253
5 Correct 149 ms 384 KB # of queries: 10665
6 Correct 129 ms 384 KB # of queries: 10684
7 Correct 162 ms 256 KB # of queries: 10760
8 Correct 121 ms 256 KB # of queries: 9582
9 Correct 126 ms 384 KB # of queries: 9114
10 Correct 53 ms 320 KB # of queries: 4165
11 Correct 2 ms 384 KB # of queries: 0
12 Correct 2 ms 256 KB # of queries: 2
13 Correct 2 ms 384 KB # of queries: 4
14 Correct 2 ms 256 KB # of queries: 6
15 Correct 4 ms 384 KB # of queries: 42
16 Correct 5 ms 256 KB # of queries: 215
17 Execution timed out 3012 ms 384 KB Time limit exceeded
18 Execution timed out 3018 ms 256 KB Time limit exceeded
19 Execution timed out 3086 ms 256 KB Time limit exceeded
20 Execution timed out 3041 ms 424 KB Time limit exceeded
21 Execution timed out 3092 ms 336 KB Time limit exceeded
22 Execution timed out 3047 ms 256 KB Time limit exceeded
23 Execution timed out 3061 ms 384 KB Time limit exceeded
24 Incorrect 1418 ms 256 KB Wrong Answer [3]
25 Execution timed out 3024 ms 256 KB Time limit exceeded
26 Execution timed out 3043 ms 332 KB Time limit exceeded
27 Incorrect 1538 ms 384 KB Wrong Answer [3]
28 Execution timed out 3038 ms 336 KB Time limit exceeded
29 Execution timed out 3093 ms 256 KB Time limit exceeded
30 Execution timed out 3099 ms 384 KB Time limit exceeded