Submission #437665

# Submission time Handle Problem Language Result Execution time Memory
437665 2021-06-26T19:11:25 Z ecnerwala Bit Shift Registers (IOI21_registers) C++17
58 / 100
1 ms 204 KB
#include "registers.h"

#include <bits/stdc++.h>

void construct_instructions(int S, int N, int K, int Q) {
	const int B = 2000;

	{
		std::vector<bool> tmp(B);
		std::fill(tmp.begin()+N*K, tmp.end(), true);
		append_store(1, tmp);
		append_or(0, 0, 1);
	}

	const int K_MSK = 99;
	{
		std::vector<bool> tmp(B);
		for (int i = 0; i < B; i += K) tmp[i] = true;
		append_store(K_MSK, tmp);
	}
	const int ONE = 98;
	{
		std::vector<bool> tmp(B);
		tmp[0] = 1;
		append_store(ONE, tmp);
	}

	int L = 8*sizeof(N) - __builtin_clz(N-1);
	N = (1 << L);

	if (S == 0) {
		while (N > 1) {
			append_right(1, 0, N/2*K);
			append_xor(2, 0, 1);
			append_print(0);
			append_print(1);
			append_print(2);
			append_not(3, 0);
			append_add(3, 3, 1);
			append_xor(3, 3, 2);
			append_and(3, 3, K_MSK);
			append_print(3);
			append_right(4, 3, K);
			append_not(4, 4);
			append_add(3, 3, 4);
			append_print(3);
			append_and(2, 2, 3);
			append_xor(0, 0, 2);
			append_print(0);
			N /= 2;
		}
	} else if (S == 1) {
	} else assert(false);
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Incorrect sorting
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Incorrect sorting
2 Halted 0 ms 0 KB -