Submission #818564

#TimeUsernameProblemLanguageResultExecution timeMemory
818564LittleCubeBit Shift Registers (IOI21_registers)C++17
22 / 100
1 ms384 KiB
#include "registers.h" #include <bits/stdc++.h> using namespace std; const int M = 100, B = 2000; void keep_prefix(int x, int l) { append_left(x, x, B - l); append_right(x, x, B - l); } void or_numbers(int n, int k, int t, int x) { /* bit or n k-bit numbers stored at first k bits x: array 10, 11: working space 12: empty filter t: output */ append_move(10, x); while (n > 1) { int m = (n + 1) / 2; append_right(11, 10, m * k); append_or(10, 11, 10); n = m; } keep_prefix(10, k); append_move(t, 10); } void dupe_numbers(int n, int k, int t, int x) { /* duplicate a k-bit number n times x: array 20, 21: working space t: output */ append_move(20, x); int m = 1; for (; m + m < n; m += m) { append_left(21, 20, m * k); append_or(20, 21, 20); } append_left(21, 20, (n - m) * k); append_or(t, 21, 20); } void construct_instructions(int s, int n, int k, int q) { /* filter msb 0: array 1: every k bits only i-th has value 2: filter 3: filter helper 4: empty checker 5: stupid 6: full -> 0: filtered array */ vector<bool> stupid(B, 0), full(B, 1); for (int i = 0; i < n * k; i++) stupid[i] = 1; append_store(5, stupid); append_store(6, full); append_xor(0, 0, 5); for (int i = k - 1; i >= 0; i--) { vector<bool> filter(B, 0); for (int j = i; j < n * k; j += k) filter[j] = 1; append_store(1, filter); append_and(2, 0, 1); // if none of them has the bit, set the filter to all 1 or_numbers(n * k, 1, 4, 2); keep_prefix(4, 1); append_right(2, 2, i); append_add(4, 4, 6); dupe_numbers(k, 1, 2, 2); append_or(2, 4, 2); append_and(0, 2, 0); } or_numbers(n, k, 0, 0); append_xor(0, 0, 5); keep_prefix(0, k); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...