#include "registers.h"
#include <vector>
using namespace std;
const int b = 2'000;
//task, array size, num bits, query limit
void construct_instructions(int s, int n, int k, int q)
{//bit k+1
int clean_k = 52;
vector<bool> f(b, 0);
for(int i = 0; i < k; i++) f[i] = 1;
append_store(clean_k, f);
int A = 0;
//do nothing
int B = 1;
append_right(B, A, k);
append_and(A, A, clean_k);
append_print(A);
append_print(B);
int sum_AB = 2;
append_add(sum_AB, A, B);
append_print(sum_AB);
int one = 3;
vector<bool> one_vector(b, 0);
one_vector[0] = 1;
append_store(one, one_vector);
append_print(one);
int minus_B = 4;
append_not(minus_B, B);
append_add(minus_B, minus_B, one);
append_print(minus_B);
int diff_AB = 5;
append_add(diff_AB, A, minus_B);
append_print(diff_AB);
int full_0 = 6;
vector<bool> full_zero_vector(b, 0);
append_store(full_0, full_zero_vector);
append_print(full_0);
int lone_sign_diff_AB = 7;
append_right(lone_sign_diff_AB, diff_AB, k+1);
append_and(lone_sign_diff_AB, lone_sign_diff_AB, one);
append_print(lone_sign_diff_AB);
int full_1 = 8;
vector<bool> full_one_vector(b, 1);
append_store(full_1, full_one_vector);
append_print(full_1);
int not_full_sign_diff_AB = 9;
append_add(not_full_sign_diff_AB, full_1, lone_sign_diff_AB);
append_print(not_full_sign_diff_AB);
int full_sign_diff_AB = 10;
append_not(full_sign_diff_AB, not_full_sign_diff_AB);
append_print(full_sign_diff_AB);
int abs_diff_AB = 11;
append_xor(abs_diff_AB, full_sign_diff_AB, diff_AB);
append_print(abs_diff_AB);
int minus_abs_diff_AB = 12;
append_not(minus_abs_diff_AB, abs_diff_AB);
append_add(minus_abs_diff_AB, minus_abs_diff_AB, one);
append_print(minus_abs_diff_AB);
int twice_ans = 13;
append_add(twice_ans, minus_abs_diff_AB, sum_AB);
append_print(twice_ans);
append_right(0, twice_ans, 1);
append_print(0);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
204 KB |
Incorrect min value |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
204 KB |
Incorrect min value |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
204 KB |
Incorrect sorting |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
204 KB |
Incorrect sorting |
2 |
Halted |
0 ms |
0 KB |
- |