#include <bits/stdc++.h>
using namespace std;
#define loop(x, i) for (int i = 0; i < x; i++)
#define ALL(x) begin(x), end(x)
#define pb push_back
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef vector<vii> vvii;
typedef vector<bool> vb;
#include "registers.h"
// first free register index
// int i = 1;
void splitInput()
{
append_right(1, 0, 2); // get b into seperate register
append_and(0, 0, 10);
}
// 01 if value, else 00
void onlyKeep(int reg, int target, int v)
{
if (v == 0)
append_xor(target, reg, 13);
if (v == 1)
{
append_xor(target, reg, 12);
}
else if (v == 2)
append_xor(target, reg, 11);
if (v == 3)
{
append_add(target, reg, 11);
}
else
append_add(target, target, 11);
append_right(target, target, 2);
cerr << "value should be " << v << '\n';
append_print(target);
}
void construct_instructions(int s, int n, int k, int q)
{
if (s == 0 && n == 2 && k == 2)
{
vb mask1(2000);
mask1[0] = 1;
vb mask1001(2000), mask0110(2000);
mask0110[1] = 1;
mask0110[2] = 1;
mask1001[0] = 1;
mask1001[3] = 1;
append_store(98, mask0110);
append_store(99, mask1001);
append_store(10, mask1);
append_xor(1, 98, 0);
append_xor(2, 99, 0);
append_add(1, 10, 1);
append_right(1, 1, 4);
append_add(2, 10, 2);
append_right(2, 2, 4);
append_right(3, 0, 2); // get b into seperate register
// 5
append_and(0, 0, 3);
append_add(0, 0, 1);
append_add(0, 0, 2);
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Incorrect min value |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Incorrect min value |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Incorrect sorting |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Incorrect sorting |
2 |
Halted |
0 ms |
0 KB |
- |