Submission #1214396

#TimeUsernameProblemLanguageResultExecution timeMemory
1214396omsincoconutBit Shift Registers (IOI21_registers)C++17
22 / 100
0 ms328 KiB
#include "registers.h"
#include <bits/stdc++.h>

using namespace std;

void construct_instructions(int s, int n, int k, int q) {
    const int m = 100, b = 2000;

    append_not(0, 0); // find max of not instead
    vector<bool> monospaced(b, 0);
    for (int i = 0; i < n; i++) monospaced[i*k] = 1;

    append_store(99, monospaced);
    append_store(1, monospaced); // candidate list

    for (int bit = k-1; bit >= 0; bit--) {
        append_right(2, 0, bit); // bit value
        append_and(2, 2, 1); // bit value & candidate (if not candidate, will be zero)
        append_move(3, 2);

        for (int i = 1; i <= 64; i *= 2){
            append_left(4, 3, i*k);
            append_or(3, 3, 4);
        }
        append_right(4, 3, 100*k);
        append_or(3, 3, 4);
        append_not(3, 3);

        append_or(2, 2, 3);
        append_and(1, 1, 2);
        append_print(1);
    }

    for (int cur = 1; cur < k;) {
        if (2*cur <= k) {
            append_left(2, 1, cur);
            append_or(1, 1, 2);
            cur *= 2;
        } else {
            append_left(2, 1, k-cur);
            append_or(1, 1, 2);
            cur = k;
        }
    }
    append_print(1);

    append_and(0, 0, 1);
    append_print(0);
    for (int i = 1; i <= 64; i *= 2) {
        append_right(1, 0, i*k);
        append_or(0, 0, 1);
    }

    append_not(0, 0);
    append_print(0);
}
#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...