답안 #108828

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
108828 2019-05-02T08:54:45 Z tictaccat 도서관 (JOI18_library) C++14
0 / 100
2000 ms 420 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);

	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);
}
# 결과 실행 시간 메모리 Grader output
1 Correct 140 ms 384 KB # of queries: 10185
2 Correct 134 ms 256 KB # of queries: 8511
3 Correct 139 ms 256 KB # of queries: 9651
4 Correct 153 ms 384 KB # of queries: 10506
5 Correct 156 ms 384 KB # of queries: 9781
6 Correct 167 ms 384 KB # of queries: 10745
7 Correct 155 ms 384 KB # of queries: 10405
8 Correct 137 ms 384 KB # of queries: 8903
9 Correct 157 ms 256 KB # of queries: 10226
10 Correct 63 ms 256 KB # of queries: 4212
11 Incorrect 2 ms 384 KB Wrong Answer [2]
12 Correct 2 ms 256 KB # of queries: 2
13 Correct 3 ms 384 KB # of queries: 5
14 Correct 2 ms 384 KB # of queries: 5
15 Correct 2 ms 256 KB # of queries: 67
16 Correct 4 ms 256 KB # of queries: 171
# 결과 실행 시간 메모리 Grader output
1 Correct 140 ms 384 KB # of queries: 10185
2 Correct 134 ms 256 KB # of queries: 8511
3 Correct 139 ms 256 KB # of queries: 9651
4 Correct 153 ms 384 KB # of queries: 10506
5 Correct 156 ms 384 KB # of queries: 9781
6 Correct 167 ms 384 KB # of queries: 10745
7 Correct 155 ms 384 KB # of queries: 10405
8 Correct 137 ms 384 KB # of queries: 8903
9 Correct 157 ms 256 KB # of queries: 10226
10 Correct 63 ms 256 KB # of queries: 4212
11 Incorrect 2 ms 384 KB Wrong Answer [2]
12 Correct 2 ms 256 KB # of queries: 2
13 Correct 3 ms 384 KB # of queries: 5
14 Correct 2 ms 384 KB # of queries: 5
15 Correct 2 ms 256 KB # of queries: 67
16 Correct 4 ms 256 KB # of queries: 171
17 Execution timed out 3005 ms 328 KB Time limit exceeded
18 Execution timed out 3012 ms 256 KB Time limit exceeded
19 Execution timed out 3018 ms 256 KB Time limit exceeded
20 Execution timed out 3012 ms 256 KB Time limit exceeded
21 Execution timed out 3023 ms 256 KB Time limit exceeded
22 Execution timed out 3029 ms 256 KB Time limit exceeded
23 Execution timed out 3047 ms 384 KB Time limit exceeded
24 Incorrect 1622 ms 256 KB Wrong Answer [3]
25 Execution timed out 3079 ms 384 KB Time limit exceeded
26 Execution timed out 3091 ms 256 KB Time limit exceeded
27 Incorrect 1457 ms 256 KB Wrong Answer [3]
28 Execution timed out 3008 ms 420 KB Time limit exceeded
29 Execution timed out 3082 ms 384 KB Time limit exceeded
30 Execution timed out 3085 ms 340 KB Time limit exceeded