Submission #1114194

# Submission time Handle Problem Language Result Execution time Memory
1114194 2024-11-18T10:34:44 Z siewjh Bit Shift Registers (IOI21_registers) C++17
21 / 100
1 ms 336 KB
#include "registers.h"
#include <bits/stdc++.h>
using namespace std;
const int b = 2000;

void construct_instructions(int s, int n, int k, int q){
	if (s == 0){
		int rnds = log2(n), tlen = k * (1 << rnds);
		vector<bool> fl(b, 0), kgrp(b, 0);
		for (int i = n * k; i < tlen; i++) fl[i] = 1;
		append_store(10, fl);
		append_or(0, 0, 10);
		for (int i = 0; i < tlen; i += k)
			for (int j = 0; j < k; j++, i++)
				kgrp[i] = 1;
		append_store(11, kgrp);
		for (int i = 0, len = k; i < rnds; i++, len <<= 1){
			append_right(1, 0, len); // 0 has odd pos, 1 has even pos
			append_and(0, 0, 11);
			append_not(2, 1);
			append_and(2, 2, 11); // 2 is negative 1, clean higher pos of 0 and 2
			append_add(3, 0, 2);
			append_right(3, 3, k); // 0 if v0 < v1, 1 if v0 > v1
			append_add(3, 3, 11); // 1...1 and 0...0
			append_and(4, 0, 3);
			append_not(3, 3);
			append_and(5, 1, 3);
			append_or(0, 4, 5); // (v0 & v3) | (v1 & !v3)
		}
	}
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 336 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 336 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 336 KB Incorrect min value
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 336 KB Incorrect min value
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 336 KB Incorrect sorting
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 336 KB Incorrect sorting
2 Halted 0 ms 0 KB -