Submission #788753

#TimeUsernameProblemLanguageResultExecution timeMemory
788753thimote75Bit Shift Registers (IOI21_registers)C++17
33 / 100
2 ms596 KiB
#include "registers.h" #include <bits/stdc++.h> using namespace std; using bdata = vector<bool>; static const int m = 100; static const int b = 2000; const int MAX_REG = m - 1; const int XOR_REG = m - 2; const int SUM_REG = m - 3; const int EXT_REG = m - 4; void init_min () { append_store( MAX_REG, bdata(b, true) ); } void min (int f, int s, int target) { bdata one (b, false); one[0] = true; append_store(SUM_REG, one); append_xor( XOR_REG, s, MAX_REG ); append_add( SUM_REG, f, SUM_REG ); append_add( SUM_REG, XOR_REG, SUM_REG ); append_right( SUM_REG, SUM_REG, 10 ); append_and ( XOR_REG, SUM_REG, f ); append_not ( SUM_REG, SUM_REG ); append_and ( SUM_REG, SUM_REG, s ); append_add ( target, SUM_REG, XOR_REG ); } void extract (int target, int sizes, int index) { append_move(EXT_REG, 0); int l = sizes * index; append_right(EXT_REG, EXT_REG, l); int del = b - sizes; append_left (EXT_REG, EXT_REG, del); append_right(EXT_REG, EXT_REG, del); append_move (target, EXT_REG); } void construct_instructions(int s, int n, int k, int q) { assert(s == 0); init_min(); extract(1, k, 0); for (int i = 1; i < n; i ++) { extract(2, k, i); int target = i + 1 == n ? 0 : 1; min(1, 2, target); } }
#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...