Submission #771636

# Submission time Handle Problem Language Result Execution time Memory
771636 2023-07-03T07:37:30 Z drdilyor Bit Shift Registers (IOI21_registers) C++17
0 / 100
1 ms 340 KB
#include<bits/stdc++.h>
#include "registers.h"
using namespace std;

constexpr int m = 100;
constexpr int b = 2000;

void construct_instructions(int s, int n, int k, int q) {
    assert(s==0);

    int used = 1;
    int mask, ones;
    vector<bool> maskv(b), onesv(b, 1);
    for (int i = 0; i < n; i++)
        maskv[k * (i+1) - k] = 1;

    append_store(mask = used++, maskv);
    append_store(ones = used++, onesv);

    int ans = used++;

    for (int bit = k-1; bit >= 0; bit--) {
        int val, check, preserve_mask, curans;
        append_and(val = used++, 0, mask);
        append_not(val, val);
        append_add(check = used++, val, ones);

        append_right(curans = used++, check, b - 1);
        append_left(curans, curans, bit);
        append_or(ans, ans, curans);

        append_right(check, check, b/2);

        append_not(val, val);
        append_and(preserve_mask = used++, mask, check);
        append_or(mask, val, preserve_mask);
        append_right(mask, mask, 1);
    }
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Incorrect min value
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Wrong answer detected in grader
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Incorrect min value
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Incorrect min value
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 340 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 340 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -