제출 #1055962

#제출 시각아이디문제언어결과실행 시간메모리
1055962aykhnBit Shift Registers (IOI21_registers)C++17
33 / 100
1 ms856 KiB
#include "registers.h"
#include <bits/stdc++.h>

using namespace std;

void construct_instructions(int s, int n, int k, int q) {
	if (n == 2 && k <= 2)
	{
		if (k == 1)
		{
			append_right(1, 0, 1);
			append_and(0, 0, 1);
		}
		else
		{
			vector<bool> v(2000, 0);
			v[0] = v[1] = 1;
			append_store(4, v);
			append_right(1, 0, 2);
			append_and(0, 0, 4);
			append_xor(2, 0, 1);
			append_and(2, 2, 1);
			append_right(3, 2, 1);
			append_or(2, 2, 3);
			append_or(1, 2, 1);
	
			append_xor(2, 0, 1);
			append_and(2, 2, 0);
			append_right(3, 2, 1);
			append_or(2, 2, 3);
			append_or(0, 2, 0);
	
			append_and(0, 0, 1);
		}
		return;
	}
	vector<bool> v(2000, 0);
	for (int i = 0; i < k; i++) v[i] = 1;
	append_store(6, v);
	append_move(1, 0);
	append_and(1, 1, 6);
	append_right(0, 0, k);
	for (int i = 1; i < n; i++)
	{
		append_move(2, 0);
		append_and(2, 2, 6);
		append_xor(3, 1, 2);
		for (int j = 1; j < k; j <<= 1)
		{
			append_right(4, 3, j);
			append_or(3, 3, 4);
		}
		append_right(4, 3, 1);
		append_xor(3, 3, 4);

		append_and(4, 1, 3);
		for (int j = 1; j < k; j <<= 1)
		{
			append_right(5, 4, j);
			append_or(4, 4, 5);
		}
		append_or(1, 1, 4);

		append_and(4, 2, 3);
		for (int j = 1; j < k; j <<= 1)
		{
			append_right(5, 4, j);
			append_or(4, 4, 5);
		}
		append_or(2, 2, 4);
		
		append_and(1, 1, 2);

		append_right(0, 0, k);
	}
	append_move(0, 1);
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...