Submission #794692

# Submission time Handle Problem Language Result Execution time Memory
794692 2023-07-26T19:08:51 Z Johann Bit Shift Registers (IOI21_registers) C++17
33 / 100
1 ms 340 KB
#include "registers.h"
#include "bits/stdc++.h"
using namespace std;

typedef long long ll;
typedef pair<ll, ll> pii;
typedef vector<int> vi;
typedef vector<bool> vb;
typedef vector<pii> vpii;
typedef vector<vpii> vvpii;
typedef vector<vvpii> vvvpii;
#define sz(x) (int)(x).size()
#define all(x) (x).begin(), (x).end()

void construct_instructions(int s, int n, int k, int q)
{

	vb mask;

	// mask for number
	mask.assign(2000, 0);
	for (int i = 0; i < k; ++i)
		mask[i] = 1;
	append_store(99, mask);

	// mask for 1
	mask.assign(2000, 0);
	mask[0] = 1;
	append_store(98, mask);

	// get first number in R1
	append_and(1, 0, 99);  // x (and later candidate minimum) in 1
	append_right(0, 0, k); // remaining n-1 numbers in 0

	for (int i = 1; i < n; ++i)
	{
		append_and(2, 0, 99);  // y to compare with in 2
		append_right(0, 0, k); // remaining n - i - 1 numbers in 0;
		append_not(3, 1);	   // ~x
		append_add(3, 3, 98);  // -x
		append_add(4, 2, 3);   // y - x in 4
		append_right(5, 4, k); // right shift of this in 5
		append_and(4, 4, 5);   // will it be used in 4
		append_add(1, 1, 4);   // result in 1
		append_print(1);
	}
	append_move(0, 1);
}
# 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 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Wrong answer detected in grader
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 -