Submission #903489

# Submission time Handle Problem Language Result Execution time Memory
903489 2024-01-11T08:07:38 Z abcvuitunggio Bit Shift Registers (IOI21_registers) C++17
100 / 100
1 ms 612 KB
#include "registers.h"
#include <bits/stdc++.h>
using namespace std;
const int b=2000;
int k;
void minimize(int d){
    append_right(1,0,d);
    append_and(0,0,98);
    append_and(1,1,98);
    append_not(2,1);
    append_add(2,0,2);
    append_right(2,2,k);
    append_not(3,2);
    append_and(4,2,1);
    append_and(5,3,0);
    append_and(2,2,0);
    append_and(3,3,1);
    append_or(0,2,3);
    append_or(1,4,5);
}
void construct_instructions(int s, int n, int k, int q){
    ::k=k;
    vector <bool> ve(b,0);
    for (int i=n*k;i<b;i++)
        ve[i]=1;
    append_store(99,ve);
    append_or(0,0,99);
    for (int i=0;i<b;i++)
        ve[i]=(i%(k*2)<k);
    append_store(98,ve);
    if (!s){
        int d=k;
        while (n>1){
            minimize(d);
            n=(n+1)/2;
            d*=2;
        }
        return;
    }
    for (int i=0;i<n;i++){
        if (i&1){
            append_left(6,0,b-k);
            append_right(6,6,b-k);
            append_right(0,0,k);
            append_or(0,0,99);
        }
        minimize(k);
        append_left(1,1,k);
        append_or(0,0,1);
        if (i&1){
            append_left(0,0,k);
            append_or(0,0,6);
        }
    }
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 504 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 344 KB Output is correct
4 Correct 1 ms 356 KB Output is correct
5 Correct 0 ms 356 KB Output is correct
6 Correct 0 ms 356 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 356 KB Output is correct
2 Correct 1 ms 356 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 356 KB Output is correct
2 Correct 1 ms 356 KB Output is correct
3 Correct 1 ms 612 KB Output is correct
4 Correct 1 ms 612 KB Output is correct
5 Correct 1 ms 604 KB Output is correct
6 Correct 1 ms 604 KB Output is correct
7 Correct 1 ms 608 KB Output is correct