Submission #1261040

#TimeUsernameProblemLanguageResultExecution timeMemory
1261040biankBit Shift Registers (IOI21_registers)C++20
21 / 100
0 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, 5);
    int steps = 0;
    while ((1 << steps) < n) steps++;
    int shift = k;
    forn(_, steps) {
        append_right(1, 0, shift);
        append_not(2, 1);
        append_and(2, 2, 98);
        append_and(0, 0, 98);
        append_add(3, 0, 2);
        append_right(3, 3, k);
        append_and(3, 3, 99);
        append_add(3, 3, 98);
        append_and(4, 3, 0);
        append_not(5, 3);
        append_and(5, 5, 1);
        append_or(0, 4, 5);
        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...