# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
440061 | algorithm16 | Bit Shift Registers (IOI21_registers) | C++17 | 0 ms | 0 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "registers.h"
#include<iostream>
#include<algorithm>
using namespace std;
int ind=6,b=2000,r=2;
void is0(int x,int y,int bit,int op) {
//append_left(ind,x,b-1-bit);
append_right(ind,x,bit);
flip(ind);
if(op) append_and(y,y,ind);
else append_or(y,y,ind);
ind+=1;
}
void flip(int x) {
append_not(x,x);
append_left(x,x,b-1);
append_right(x,x,b-1);
}
void construct_instructions(int s,int n,int k,int q) {
if(k==1) {
append_move(1,0);
append_right(1,1,1);
append_and(0,0,1);
return;
}
append_move(1,0);
append_right(1,1,2);
append_and(2,0,1);
// 3 4 5
is0(2,3,1,0);
is0(2,3,0,1);
is0(0,4,1,0);
is0(0,4,0,1);
flip(4);
is0(1,5,1,0);
is0(1,5,0,1);
flip(5);
append_and(3,3,4);
append_and(3,3,5);
append_add(2,2,3);
append_move(0,2);
return;
}