Submission #1175623

#TimeUsernameProblemLanguageResultExecution timeMemory
1175623PagodePaivaBit Shift Registers (IOI21_registers)C++20
22 / 100
0 ms584 KiB
#include "registers.h"
#include <bits/stdc++.h>

using namespace std;

/*
void append_move(int t, int y)
void append_store(int t, bool[] v)
void append_and(int t, int x, int y)
void append_or(int t, int x, int y)
void append_xor(int t, int x, int y)
void append_not(int t, int x)
void append_right(int t, int x, int p)
void append_right(int t, int x, int p)
void append_add(int t, int x, int y)*/

const int b = 2000;
vector <bool> v;

void construct_instructions(int s, int n, int kk, int q) {
    for(int i = 0;i < b;i++){
        if((i%kk) == kk-1) v.push_back(true);
        else v.push_back(false);
    }
    while(n > 1){
        //cout << n << '\n';
        int k = kk-1;
        int t = (n/2)*kk;
        append_print(0);
        append_right(1, 0, t);
        append_and(2, 1, 0);
        append_xor(3, 2, 0);
        append_xor(4, 2, 1);
        append_move(98, 2);
        append_store(97, v);
        k--;
        while(k >= 0){
            // 0 = a
            // 1 = b
            // 2 = p
            append_right(3, 3, 1); // 3 = x
            append_right(4, 4, 1); // 4 = y
            append_print(3);
            append_print(4);
            append_xor(5, 3, 4); // 5 = (x^y)
            append_not(6, 5); // 6 = -(x^y)
            append_and(7, 0, 4); // 7 = a and y
            append_and(8, 1, 3); // 8 = b and x
            append_or(9, 8, 7); // 9 = (a and y) or (b and x)
            append_and(10, 9, 5); // 10 = ((x^y)and((a and y) or (b and x)))
            append_and(11, 6, 98); // (-(x^y)) and (a and b)
            append_or(12, 11, 10); // p
            append_right(97, 97, 1);
          //  append_print(97);
          //  append_print(12);
            append_and(12, 12, 97); // p_k
            append_or(2, 12, 2); // p = p or p_k
            append_xor(13, 0, 2); // p^a
            append_or(3, 3, 13); // x = x and (p^a)
            append_xor(14, 1, 2); // p^b
            append_or(4, 4, 14); // y = y and (p^b)
            append_print(2);
            k--;
        }
        append_move(0, 2);
        n = (n+1)/2;
    }
    return; 
}
#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...