#include "registers.h"
#include <bits/stdc++.h>
using namespace std;
int nn,kk;
void compare(int f,int s,int mn,int mx)
{
append_print(f);
append_print(s);
append_xor(2,f,s);
append_and(3,f,2);
append_not(4,2);
for(int j=0; j<kk; j++)
{
if(j)append_left(5,5,1);
append_and(5,5,4);
append_or(5,5,3);
}
append_and(5,5,50);
append_right(5,5,kk-1);
append_add(5,5,51);
append_print(5);
append_not(6,5);
append_and(7,5,f);
append_and(8,6,s);
if(mx==-1)append_or(mn,7,8);
else if(mx!=-1)
{
append_or(9,7,8);
append_and(7,5,s);
append_and(8,6,f);
append_or(mx,7,8);
append_move(mn,9);
}
}
void construct_instructions(int s, int n, int k, int q)
{
vector<bool> v(2000);
v[k-1]=1;
append_store(50,v);
for(int i=0; i<k; i++)
v[i]=1;
append_store(51,v);
nn=n;
kk=k;
if(s==0)
{
int c=0;
for(int i=1; i<n; i++)
{
append_right(1,0,i*k);
int h=9;
if(c==9)h=10;
if(i==n-1)h=0;
compare(c,1,h,-1);
c=h;
}
}
else
{
for(int i=0;i<n;i++)
{
append_right(i+11,0,i*k);
}
for(int i=11;i<11+n;i++)
{
for(int j=i+1;j<11+n;j++)
{
compare(i,j,i,j);
}
}
for(int i=10+n;i>=11;i--)
{
if(i!=10+n)append_left(40,40,k);
append_and(i,i,51);
append_or(40,40,i);
}
append_move(0,40);
}
}
// 0 2 2 1000
# | 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... |