#include "registers.h"
#include<bits/stdc++.h>
using namespace std;
const int m=100,b=2000;
int s,n,k,q;
//variables
#define ansreg 0
#define datareg 1
#define bitreg1 2
#define bitreg2 3
#define maskreg 4
#define temp 5
#define allxor 6
#define xorand1 7
#define xorand2 8
#define mask1 9
#define mask2 10
//constants
#define zeromask 97
#define onemask 98
#define completemask 99
void moveguy(int i,int j){
if(j==n-1){
append_right(i,datareg,j*k);
return;
}
append_right(i,datareg,(j+1)*k);
append_left(i,i,(j+1)*k);
append_xor(i,datareg,i);
if(j)append_right(i,i,j*k);
}
void writebit(int t,int i,int j){
append_right(t,datareg,i*k+j);
append_and(t,t,onemask);
}
void writebit(int t,int from,int i,int j){
append_right(t,from,i*k+j);
append_and(t,t,onemask);
}
void wb(int t,int from,int j){
append_right(t,from,j);
append_and(t,t,onemask);
}
void chmin(int t){
append_store(mask1,vector<bool>(b,1));
append_store(mask2,vector<bool>(b,1));
moveguy(temp,t);
append_xor(allxor,ansreg,temp);
append_and(xorand1,allxor,ansreg);
append_and(xorand2,allxor,temp);
for(int i=k-1;0<=i;i--){
append_right(bitreg1,xorand1,i);
append_right(bitreg2,xorand2,i);
//set bit 1
append_add(mask1,bitreg1,mask1);
//set bit 2
append_add(mask2,bitreg2,mask2);
//apply mask
if(i){
append_and(maskreg,mask1,mask2);
append_and(xorand1,xorand1,maskreg);
append_and(xorand2,xorand2,maskreg);
}
/*
append_print(ansreg);
append_print(temp);
*/
append_print(mask1);
append_print(mask2);
}
append_and(ansreg,ansreg,mask1);
append_and(temp,temp,mask2);
append_or(ansreg,ansreg,temp);
}
void construct_instructions(int S, int N, int K, int Q) {
s=S,n=N,k=K,q=Q;
if(!s){
append_move(datareg,0);
//append_store(completemask,vector<bool>(b,1));
vector<bool>to(b,0);
to[0]=1;
append_store(onemask,to);
moveguy(ansreg,0);
for(int i=1;i<n;i++)chmin(i);
}else assert(0);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Wrong answer detected in grader |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
432 KB |
Output is correct |
2 |
Incorrect |
1 ms |
696 KB |
Wrong answer detected in grader |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Wrong answer detected in grader |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
348 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
348 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |