Submission #829726

# Submission time Handle Problem Language Result Execution time Memory
829726 2023-08-18T14:29:18 Z rainboy Toxic Gene (NOI23_toxic) C++17
9.46154 / 100
6 ms 388 KB
#include "toxic.h"
#include <vector>

using namespace std;

typedef vector<int> vi;

const int K = 8;

void determine_type(int n) {
	vi cc(n, '?');
	for (int i = 0; i < n; i++)
		if (query_sample({ i + 1 }) == 0)
			cc[i] = 'T';
	int t = 0;
	while (cc[t] != 'T')
		t++;
	vi ii(K); int k = 0;
	for (int i = 0; i < n; i++)
		if (cc[i] == '?') {
			ii[k++] = i;
			if (k == K) {
				vi ii_;
				ii_.push_back(t + 1);
				for (int h = 0; h < k; h++)
					for (int t = 0; t < 1 << h; t++)
						ii_.push_back(ii[h] + 1);
				int b = query_sample(ii_);
				for (int h = 0; h < k; h++)
					cc[ii[h]] = (b & 1 << h) == 0 ? 'R' : 'S';
				k = 0;
			}
		}
	if (k > 0) {
		vi ii_;
		ii_.push_back(t + 1);
		for (int h = 0; h < k; h++)
			for (int t = 0; t < 1 << h; t++)
				ii_.push_back(ii[h] + 1);
		int b = query_sample(ii_);
		for (int h = 0; h < k; h++)
			cc[ii[h]] = (b & 1 << h) == 0 ? 'R' : 'S';
		k = 0;
	}
	for (t = 0; t < n; t++)
		answer_type(t + 1, cc[t]);
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Partially correct 4 ms 384 KB Partially correct
3 Partially correct 4 ms 324 KB Partially correct
4 Partially correct 4 ms 340 KB Partially correct
5 Partially correct 4 ms 332 KB Partially correct
6 Partially correct 4 ms 340 KB Partially correct
7 Partially correct 5 ms 360 KB Partially correct
8 Partially correct 4 ms 340 KB Partially correct
9 Partially correct 4 ms 340 KB Partially correct
10 Partially correct 4 ms 332 KB Partially correct
11 Partially correct 4 ms 340 KB Partially correct
12 Partially correct 4 ms 340 KB Partially correct
13 Partially correct 4 ms 340 KB Partially correct
14 Partially correct 4 ms 340 KB Partially correct
15 Partially correct 4 ms 340 KB Partially correct
16 Partially correct 4 ms 340 KB Partially correct
17 Partially correct 4 ms 340 KB Partially correct
18 Partially correct 4 ms 340 KB Partially correct
19 Partially correct 4 ms 340 KB Partially correct
20 Partially correct 4 ms 340 KB Partially correct
21 Partially correct 4 ms 364 KB Partially correct
22 Partially correct 4 ms 340 KB Partially correct
23 Partially correct 4 ms 336 KB Partially correct
24 Partially correct 4 ms 340 KB Partially correct
25 Partially correct 4 ms 388 KB Partially correct
26 Partially correct 4 ms 340 KB Partially correct
27 Partially correct 4 ms 336 KB Partially correct
28 Partially correct 4 ms 336 KB Partially correct
29 Partially correct 4 ms 336 KB Partially correct
30 Partially correct 4 ms 388 KB Partially correct
31 Partially correct 6 ms 340 KB Partially correct
32 Partially correct 4 ms 340 KB Partially correct
33 Partially correct 4 ms 384 KB Partially correct
34 Partially correct 4 ms 340 KB Partially correct
35 Partially correct 4 ms 328 KB Partially correct
36 Partially correct 1 ms 212 KB Partially correct