#include "registers.h"
using namespace std;
#include <vector>
#define B 2000
void construct_instructions(int s, int n, int k, int q) {
if (s==1){return;}
vector<bool> v;
vector<bool> blank;
//seperate numbers
v.resize(B,0);
blank=v;
for (int i=0;i<k;i++){v[i]=1;}
append_store(n+1,v);
for (int i=0;i<n;i++){
append_move(i+1,0);
if (i!=0){
append_right(i+1,i+1,i*k);
}
if (i!=n-1){
append_and(i+1,i+1,n+1);
}
}
for (int i=1;i<=n;i++){append_print(i);}
v=blank;
append_store(0,v);
//do operations
append_not(n+2,0);
for (int i=k-1;i>=0;i--){
v=blank;
v[i]=1;
append_store(n+1,v);
append_store(n+3,v);
for (int j=0;j<n;j++){
append_and(n+3,n+3,j+1);
}
append_add(0,0,n+3);
//extend mask
if (i!=0){
append_right(n+3,n+3,i);
}
append_add(n+3,n+3,n+2);
for (int j=0;j<n;j++){
//and with op and extend mask
append_and(n+4,n+1,j+1);
append_right(n+4,n+4,i);
append_add(n+4,n+4,n+2);
append_not(n+4,n+4);
append_and(n+4,n+4,n+3);
append_or(j+1,j+1,n+4);
}
append_print(0);
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Wrong answer detected in grader |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Incorrect |
0 ms |
348 KB |
Wrong answer detected in grader |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
344 KB |
Wrong answer detected in grader |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Incorrect sorting |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Incorrect sorting |
2 |
Halted |
0 ms |
0 KB |
- |