답안 #812691

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
812691 2023-08-07T10:12:08 Z HamletPetrosyan 레지스터 (IOI21_registers) C++17
33 / 100
1 ms 468 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 - cur_min
// 2 - a[i]
// 3 - !a[i]
// 4 - -a[i] or !a[i] + 1
// 5 - cur_min - a[i]

// 6 - rev01(coef_i base)
// 7 - rev01(coef_min base)
// 8 - coef_min
// 9 - coef_i

// 10 - coef_min & cur_min
// 11 - coef_i & a[i]

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_print(1);
	
	for(int i = 1; i < n; i++){
		append_right(2, 0, i * k);									// <------ 1
		append_and(2, 97, 2);										// <------ 2

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

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

		append_add(8, 97, 6);										// <------ 8
		append_add(9, 97, 7);										// <------ 9

		append_and(10, 1, 8);										// <------ 10
		append_and(11, 2, 9);										// <------ 11

		append_add(1, 10, 11);										// <------ 12
		append_print(1);
	}
	append_move(0, 1);											// <------ 4
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 428 KB Output is correct
3 Correct 1 ms 468 KB Output is correct
4 Correct 1 ms 428 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 212 KB Wrong answer detected in grader
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 296 KB Incorrect sorting
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 296 KB Incorrect sorting
2 Halted 0 ms 0 KB -