Submission #1261051

#TimeUsernameProblemLanguageResultExecution timeMemory
1261051biankBit Shift Registers (IOI21_registers)C++20
58 / 100
1 ms328 KiB
#include "registers.h"
#include <bits/stdc++.h>
 
#define forsn(i, s, n) for (int i = int(s); i < int(n); i++)
#define forn(i, n) forsn(i, 0, n)
#define dforsn(i, s, n) for (int i = int(n) - 1; i >= int(s); i--)
#define dforn(i, n) dforsn(i, 0, n)
 
#define sz(x) int(x.size())
#define all(x) begin(x), end(x)
 
#define pb push_back
#define eb emplace_back
 
#define fst first
#define snd second
 
using namespace std;
 
using vi = vector<int>;
using ii = pair<int, int>;
using vb = vector<bool>;

const int B = 2000;

void construct_instructions(int s, int n, int k, int q) {
    vb v(B);
    forn(i, B) v[i] = i % (2 * k) == 0;
    append_store(99, v);
    forn(i, B) v[i] = (i / k) % 2 == 0;
    append_store(98, v);
    forn(i, B) v[i] = i >= n * k;
    append_store(97, v);
    append_or(0, 0, 97);
    int steps = 0;
    while ((1 << steps) < n) steps++;
    int shift = k;
    forn(_, steps) {
        append_right(1, 0, shift);
        append_not(8, 1);
        append_and(8, 8, 98);
        append_and(9, 0, 98);
        append_add(2, 9, 8);
        append_right(2, 2, k);
        append_and(2, 2, 99);
        append_add(2, 2, 98);
        append_and(6, 2, 9);
        append_not(7, 2);
        append_and(7, 1, 7);
        append_or(0, 6, 7);
        shift *= 2;
    }
}
#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...