Submission #621187

# Submission time Handle Problem Language Result Execution time Memory
621187 2022-08-03T13:46:27 Z HamletPetrosyan Bit Shift Registers (IOI21_registers) C++17
10 / 100
1 ms 628 KB
#include "registers.h"
using namespace std;

#define add push_back

const int b = 2000;

void construct_instructions(int s, int n, int k, int q) {
	vector<bool> v;
	for(int i = 0; i < b; i++){
		if(i < k) v.add(1);
		else v.add(0);
	}
	append_move(99, 0);
	append_store(98, v);
	v.clear(); v.resize(b, 0); v[0] = 1;
	append_store(96, v);
	v[0] = 0; v[b - 1] = 1;
	append_store(95, v);

	// 99 - skzbnakany
	// 98 - k hat 1
	// 97 - = 0
	// 96 - = 1
	// 95 - 99rd bity 1
	//
	// 0 - I tiv
	// 1 - II tiv
	// 2 - !(II tiv)
	// 3 - 0 + 2
	// 4 - 3 & 98
	// 5 - !3 & 98
	//
	// 10 - I gorcakic
	// 11 - II gorcakic
	//
	// 20 - 10-in gumarvox
	// 21 - 11-in gumarvox

	append_and(0, 0, 98);

//	append_print(0);

	for(int i = 1; i < n; i++){
		append_right(1, 99, i * k);
		append_and(1, 1, 98);
//		append_print(1);
		append_not(2, 1);
		append_add(2, 2, 96);
//		append_print(2);

		append_add(3, 0, 2);
//		append_print(3);
		append_and(4, 3, 95);
//		append_print(4);
		append_not(3, 3);
		append_and(5, 3, 95);
//		append_print(5);

		append_and(10, 10, 97);
		append_and(11, 11, 97);

		for(int j = k - 1; j >= 0; j--){
			append_right(20, 4, b - 1 - j);
			append_right(21, 5, b - 1 - j);
			append_add(10, 10, 20);
			append_add(11, 11, 21);
		}

//		append_print(11);

		append_and(0, 0, 10);
		append_and(1, 1, 11);
		append_add(0, 0, 1);
	}
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Wrong answer detected in grader
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Incorrect 1 ms 628 KB Wrong answer detected in grader
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Wrong answer detected in grader
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 340 KB Incorrect sorting
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 340 KB Incorrect sorting
2 Halted 0 ms 0 KB -