제출 #438140

#제출 시각아이디문제언어결과실행 시간메모리
438140Elegia레지스터 (IOI21_registers)C++17
47 / 100
1 ms308 KiB
#include "registers.h"

using bitvec = std::vector<bool>;

const int B = 2000, M = 100;

const bitvec ZERO(B);

void task0(int n, int k) {
	bitvec pre(n * k, true);
	pre.resize(B);
	const int SET1 = M / 2, FULL = M / 2 + 1, ONE = M / 2 + 2;
	append_store(FULL, pre);
	{
		bitvec one(B); one[0] = true;
		append_store(ONE, one);
	}
	for (int i = k - 1; i >= 0; --i) {
		if (i != k - 1) {
			append_right(SET1, SET1, 1);
			append_or(0, 0, SET1);
		}
		bitvec cur(B);
		for (int j = 0; j != n; ++j)
			cur[j * k + i] = true;
		append_store(1, cur); append_and(2, 0, 1);
		append_xor(3, 1, 2);
		append_add(3, 3, FULL); append_right(3, 3, n * k);
		append_xor(3, 3, ONE);
		append_add(3, 3, FULL); append_and(2, 3, 2);
		append_xor(0, 0, 2);
		if (i) append_or(SET1, 2, SET1);
	}
}

void construct_instructions(int s, int n, int k, int q) {
	if (s == 0) task0(n, k);
}
#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...