Submission #812635

# Submission time Handle Problem Language Result Execution time Memory
812635 2023-08-07T09:44:08 Z HamletPetrosyan Bit Shift Registers (IOI21_registers) C++17
21 / 100
1 ms 300 KB
#include "registers.h"
#include <bits/stdc++.h>
using namespace std;

const int M = 100, B = 2000;

// 99 - zero
// 98 - one
// 97 - 2^k - 1

// 1 - a[0]
// 2 - a[1]
// 3 - !a[1]
// 4 - -a[1] or !a[1] + 1
// 5 - a[0] - a[1]

// 6 - coef[0] base
// 7 - coef[0]
// 8 - coef[1] base
// 9 - coef[1]

// 10 - coef[0] & a[0]
// 11 - coef[1] & a[1]

void construct_instructions(int s, int n, int k, int q) {
	/// init
	vector<bool> stv(B);
	stv[0] = 1;
	append_store(98, stv);										// <------ 1
	for(int i = 1; i < k; i++) stv[i] = 1;
	append_store(97, stv);										// <------ 2
	///

	append_and(1, 97, 0);										// <------ 3
	append_right(2, 0, k);										// <------ 4

	/// subtraction
	append_not(3, 2);											// <------ 5
	append_add(4, 3, 98);										// <------ 6
	append_add(5, 1, 4);										// <------ 7
	///

	append_right(6, 5, B - 1);									// <------ 7
	append_xor(8, 6, 98);										// <------ 8

	append_left(7, 6, 1);										// <------ 9
	append_add(7, 7, 6);										// <------ 10
	append_left(9, 8, 1);										// <------ 11
	append_add(9, 9, 8);										// <------ 12

	append_and(10, 1, 7);										// <------ 13
	append_and(11, 2, 9);										// <------ 14

	append_add(0, 10, 11);										// <------ 15
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 296 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 300 KB Incorrect min value
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 296 KB Incorrect min value
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Incorrect sorting
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Incorrect sorting
2 Halted 0 ms 0 KB -