Submission #438379

#TimeUsernameProblemLanguageResultExecution timeMemory
438379SHZhangBit Shift Registers (IOI21_registers)C++17
33 / 100
4 ms576 KiB
#include "registers.h" #include <vector> using namespace std; void construct_instructions(int s, int n, int k, int q) { (void)s; (void)q; vector<bool> ones_above; for (int i = 0; i < n * k; i++) ones_above.push_back(false); for (int i = n * k; i < 2000; i++) ones_above.push_back(true); if (n > 2) { append_store(1, ones_above); append_or(0, 0, 1); } vector<bool> all_0s; for (int i = 0; i < 2000; i++) all_0s.push_back(false); for (int i = k - 1; i >= 0; i--) { append_move(1, 0); for (int j = 0; (1 << j) < n; j++) { append_right(2, 1, k * (1 << j)); append_and(1, 1, 2); } vector<bool> bit_only = all_0s; bit_only[i] = true; append_store(2, bit_only); append_and(3, 1, 2); append_or(99, 3, 99); if (i) { append_not(3, 3); append_and(1, 2, 3); for (int j = 0; (1 << j) < n; j++) { append_left(2, 1, k * (1 << j)); append_or(1, 1, 2); } append_and(1, 0, 1); if (k <= 2) { append_right(1, 1, 1); append_or(0, 0, 1); } else { append_store(4, all_0s); for (int j = 1; j < k; j++) { append_right(2, 1, j); vector<bool> mask = all_0s; for (int x = 0; x < 2000; x++) { if (x % k < k - j) mask[x] = true; } append_store(3, mask); append_and(2, 2, 3); append_or(4, 2, 4); } append_or(0, 0, 4); } } append_print(0); } append_move(0, 99); }
#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...