#include "registers.h"
#include <bits/stdc++.h>
#define pb push_back
#define se second
#define fi first
using namespace std;
int c, n;
// 1 2 4 8
void mlog(){
++c; append_right(c,c-1,1);
append_or(c-1,c-1,c);
append_right(c,c-1,2);
append_or(c-1,c-1,c);
append_right(c,c-1,4);
append_or(c-1,c-1,c);
append_right(c,c-1,8);
append_or(c-1,c-1,c);
c--;
}
void mn(int x, int y){
++c; append_xor(c,c,c);
append_xor(c,x,y); // xor
mlog();
// append_print(c);
++c; append_xor(c,c,c);
append_right(c,c-1,1);
++c; append_xor(c,c,c);
append_xor(c,c-2,c-1); // cmn isolate 1 bit
// append_print(c);
++c; append_xor(c,c,c);
append_and(c,x,c-1); // 000 ato 0100, ngikutin x
mlog(); // 0111
// append_print(c);
++c; append_not(c,c-1); // inversenya
++c; append_and(c,x,c-1);
++c; append_and(c,y,c-3);
append_add(c,c,c-1);
// taro di c
}
void sw(int x, int y){
c = n;
mn(x, y);
int MN = c;
++c; append_xor(c,x,y);
append_move(x, MN);
append_xor(y, c, MN);
}
void construct_instructions(int s, int N, int k, int q) {
n = N;
for(int i=1; i<=n; i++){
append_move(i, 0);
append_left(i,i,2000-i*k);
append_right(i,i,2000-k);
}
for(int i=2; i<=n; i++){
for(int j=n; j>=i; j--)
sw(j, j-1);
for(int j=1; j<=n; j++)
append_print(j);
}
append_xor(0,0,0);
for(int i=1; i<=n; i++){
if(i != 1) append_left(0, 0, k);
append_xor(0, 0, i);
}
// append_print(0);
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |