이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "registers.h"
#include <bits/stdc++.h>
using namespace std;
#define OP_MOVE 0
#define OP_STORE 1
#define OP_AND 2
#define OP_OR 3
#define OP_XOR 4
#define OP_NOT 5
#define OP_LEFT 6
#define OP_RIGHT 7
#define OP_ADD 8
const int M = 100;
const int B = 2000;
void add_op(int tp,int t,int x,int y = -1){
if(tp == OP_MOVE)append_move(t,x);
else if(tp == OP_AND)append_and(t,x,y);
else if(tp == OP_OR)append_or(t,x,y);
else if(tp == OP_XOR)append_xor(t,x,y);
else if(tp == OP_NOT)append_not(t,x);
else if(tp == OP_LEFT)append_left(t,x,y);
else if(tp == OP_RIGHT)append_right(t,x,y);
else if(tp == OP_ADD)append_add(t,x,y);
return;
}
const int one = 1;
const int mask = 2;
void construct_instructions(int s, int n, int k, int q) {
vector<bool> v(B,0);
v[0] = 1;
append_store(one,v);
int ans = 3;
for(int i = 0;i<k;i++)v[i] = 1;
append_store(ans,v);
append_store(mask,v);
for(int i = 0;i<n;i++){
int a = ans,b = 4;
add_op(OP_RIGHT,b,0,i*k);
add_op(OP_AND,b,mask,b);
int flag = 5;
add_op(OP_NOT,flag,a);
add_op(OP_AND,flag,mask,flag);
add_op(OP_ADD,flag,b,flag);
add_op(OP_ADD,flag,one,flag);
add_op(OP_RIGHT,flag,flag,k);
add_op(OP_AND,flag,one,flag);
for(int j = 1;j<k;j<<=1){
int tmp = 6;
add_op(OP_LEFT,tmp,flag,j);
add_op(OP_OR,flag,tmp,flag);
}
int rflag = 6;
append_print(a);
append_print(b);
add_op(OP_NOT,rflag,flag);
append_print(flag);
append_print(rflag);
add_op(OP_AND,b,rflag,b);
add_op(OP_AND,a,flag,a);
append_print(a);
append_print(b);
add_op(OP_OR,ans,a,b);
}
add_op(OP_MOVE,0,ans);
return;
}
# | 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... |