QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#132852#6661. 야유회5sb0 0ms0kbC++23965b2023-07-31 19:52:132023-07-31 19:52:14

Judging History

你现在查看的是最新测评结果

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-07-31 19:52:14]
  • 评测
  • 测评结果:0
  • 用时:0ms
  • 内存:0kb
  • [2023-07-31 19:52:13]
  • 提交

answer

#include <vector>
#include <cassert>

constexpr int n[3] = {100000, 20, 6};
constexpr int m[3] = {10, 3, 2};

std::vector<int> a[3];

void init() {
	for (int i = 0; i < 3; i++) {
		for (int j = 0; (int)a[i].size() < n[i] && j < (1 << (m[i] * 2)); j++) {
			if (__builtin_popcount(j) == m[i]) {
				a[i].push_back(j);
			}
		}
		assert((int)a[i].size() == n[i]);
	}
}

int f(int i, int x, int y) {
	assert(0 <= x && x < n[i] && 0 <= y && y < n[i]);
	x = a[i][x], y = a[i][y];
	for (int j = 0; j < m[i] * 2; i++) {
		if (((x >> j) & 1) == 0 && ((y >> j) & 1) == 1) {
			return j;
		}
	}
	assert(false);
	return -1;
}

int morning(int m, int r) {
	return f(0, m, r);
}

int afternoon(int l, int m, int r) {
	return f(2, f(1, l, m), f(1, m, r));
}

int evening(int l, int m, int r) {
	if (m < 3) {
		return m;
	}
	for (int i = 0; i < 3; i++) {
		if (i != l && i != r) {
			return i;
		}
	}
	assert(false);
	return -1;
}

詳細信息

Subtask #1:

score: 0
Dangerous Syscalls

Test #1:

score: 0
Dangerous Syscalls

input:

2dc2b1d4-8de2-INPUT-bcd3-aa55b691fdb3
1
2
40 40
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
40 40
0 3 1 5 7 9 6 4 2 10 8 23 21 25 27 29 26 24 22 30 28 13 11 15 17 19 16 14 12 20 18 33 31 35 37 39 36 34 32 38

output:


result:


Subtask #2:

score: 0
Dangerous Syscalls

Test #8:

score: 0
Dangerous Syscalls

input:

2dc2b1d4-8de2-INPUT-bcd3-aa55b691fdb3
2
2
40 40
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
40 40
0 3 1 5 7 9 6 4 2 10 8 23 21 25 27 29 26 24 22 30 28 13 11 15 17 19 16 14 12 20 18 33 31 35 37 39 36 34 32 38

output:


result: