#include "registers.h"
#include <bits/stdc++.h>
using namespace std;
void construct_instructions(int s, int n, int k, int q) {
assert(s == 0);
const int b = 2000;
vector<bool> k1(b);
for(int i = 0; i < k; i ++){
k1[i] = 1;
}
vector<bool> one(b);
vector<bool> zero(b);
one[0] = 1;
append_store(2, k1);
append_store(4, one);
append_move(12, 2);
for(int j = 0; j < n; j ++){
append_and(13, 0, 2);
append_right(0, 0, k);
if(j == n){
//append_move(0, 12);
append_move(0, 13);
return;
}
/*for(int x = 3; x < 12; x ++){
if(x == 4){continue;}
append_store(x, zero);
}*/
append_not(12, 12);
append_not(13, 13);
append_not(3, 13);
append_add(5, 3, 4);
append_add(6, 12, 5);
append_and(7, 6, 2); // 7 stores value of number
append_right(6, 6, k); // 6 stores which is greater
// 8 is all one or all 0 in the size of k
append_move(8, 6);
for(int i = 1; i < k; i ++){
append_left(8, 8, 1);
append_or(8, 8, 6);
}
append_move(9, 7);
append_and(9, 8, 9);
append_not(10, 9);
append_add(11, 10, 4);
append_add(12, 12, 11);
append_not(12, 12);
append_and(12, 12, 2);
}
append_move(0, 12);
return;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
204 KB |
Wrong answer detected in grader |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Correct |
2 ms |
620 KB |
Output is correct |
3 |
Correct |
2 ms |
588 KB |
Output is correct |
4 |
Correct |
2 ms |
620 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
204 KB |
Wrong answer detected in grader |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
332 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
332 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |