Submission #442938

# Submission time Handle Problem Language Result Execution time Memory
442938 2021-07-09T11:29:48 Z alan8585 Bit Shift Registers (IOI21_registers) C++17
22 / 100
2 ms 532 KB
#include "registers.h"
#include <vector>
using namespace std;

vector<bool> emp(2000), set(2000, 1);

void construct_instructions(int s, int n, int k, int q) {
	vector<bool> v(2000); v[0] = 1, append_store(51, v);
	append_store(61, set);

	append_move(1, 0);
	for(int i = k - 1; i >= 0; i--) {
		// 99 high bit mask
		vector<bool> v(2000);
		for(int j = 0; j < n; j++) {
			v[j * k + i] = 1;
		}
		append_store(99, v);

		append_and(87, 1, 99);

		append_xor(98, 87, 99);

		append_move(2, 98);
		for(int j = 1; j < 2000; j <<= 1) {
			append_right(3, 2, j);
			append_or(2, 2, 3);
		}
		append_and(2, 2, 51);

		append_move(4, 2);
		for(int j = 1; j < 2000; j <<= 1) {
			append_left(3, 4, j);
			append_or(4, 4, 3);
		}

		append_right(88, 87, i);
		append_store(87, emp);
		for(int j = 0; j < i; j++) {
			append_left(89, 88, j);
			append_or(87, 87, 89);
		}
		append_and(87, 4, 87);
		append_or(1, 1, 87);

		append_move(5, 1);
		append_not(97, 99);
		append_and(5, 5, 97);

		// left mask 95
		vector<bool> v2(2000);
		for(int l = 0; l < i; l++)
			for(int j = 0; j < n; j++)
				v2[j * k + l] = 1;
		append_store(95, v2);

		append_xor(2, 2, 51);
		// 1 if min need this bit

		append_left(41, 2, i);
		append_or(42, 41, 42);

		// erase 5
		append_xor(67, 2, 51);
		for(int j = 1; j < 2000; j <<= 1) {
			append_left(3, 67, j);
			append_or(67, 67, 3);
		}
		append_and(1, 1, 67);

		append_xor(1, 1, 99);
		for(int j = 1; j < 2000; j <<= 1) {
			append_left(3, 2, j);
			append_or(2, 2, 3);
		}
		append_and(1, 1, 2);

		append_add(1, 1, 5);

	}
	append_move(0, 42);
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Wrong answer detected in grader
# Verdict Execution time Memory Grader output
1 Correct 1 ms 332 KB Output is correct
2 Correct 1 ms 532 KB Output is correct
3 Correct 1 ms 332 KB Output is correct
4 Correct 1 ms 460 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Wrong answer detected in grader
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 460 KB Incorrect sorting
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 460 KB Incorrect sorting
2 Halted 0 ms 0 KB -