#include "registers.h"
#include <iostream>
#include <vector>
using namespace std;
void construct_instructions(int s, int n, int k, int q) {
vector<bool> v(2000);
for(int i=0;i<2000;i++)
{
v[i]=0;
}
long long int len=1;
while(len<n)
{
len*=2;
}
for(int i=n;i<len;i++)
{
for(int j=0;j<k;j++)
{
v[i*k+j]=1;
}
}
append_store(1,v);
append_add(0,0,1);
for(int i=0;i<2000;i++)
{
if((i/k)%2==0)v[i]=1;
else v[i]=0;
}
append_store(2,v);
long long int rm=2;
while(len>1)
{
append_right(1,0,k*rm/2);
append_move(5,1);
if(rm==2)append_and(5,5,2);
append_not(1,1);
if(rm==2)append_and(0,0,2);
append_and(1,1,2);
append_add(3,0,1);
append_move(1,5);
append_print(0);
append_print(1);
append_not(2,2);
append_and(3,2,3);
append_print(3);
int tmp=1;
while(tmp<k+1)
{
if(tmp*2<=k+1)
{
append_right(4,3,tmp);
append_add(3,3,4);
}
else
{
append_right(4,3,k-tmp+1);
append_or(3,3,4);
}
tmp*=2;
}
append_print(0);
append_print(1);
append_print(3);
append_and(1,1,3);
append_not(3,3);
append_and(0,0,3);
append_add(0,0,1);
len/=2;
rm*=2;
}
return ;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
300 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
Wrong answer detected in grader |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
Incorrect min value |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
296 KB |
Incorrect min value |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
Incorrect sorting |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
Incorrect sorting |
2 |
Halted |
0 ms |
0 KB |
- |