#include "registers.h"
#include <bits/stdc++.h>
using namespace std;
const int M = 100, B = 2000;
void dupe_numbers(int n, int k, int t, int x)
{
/*
duplicate a k-bit number n times
x: array
80, 81: working space
t: output
*/
append_move(80, x);
int m = 1;
for (; m + m < n; m += m)
{
append_left(81, 80, m * k);
append_or(80, 81, 80);
}
append_left(81, 80, (n - m) * k);
append_or(t, 81, 80);
}
void construct_instructions(int s, int n, int k, int q)
{
vector<bool> firstk(B, 0), everyk(B, 0);
for (int i = 0; i < k; i++)
firstk[i] = 1;
append_store(5, firstk);
append_store(6, everyk);
auto bubble = [&](int x /* and x + 1*/)
{
append_print(0);
append_left(10, 0, B - (x + 2) * k);
append_print(10);
append_right(10, 10, B - 2 * k);
append_print(10);
append_right(15, 10, k);
append_xor(15, 15, 10);
append_left(15, 15, B - k);
append_right(15, 15, B - k);
append_print(15);
append_move(20, 15);
for (int i = 1; i < k; i++)
{
append_right(30, 20, i);
append_not(30, 30);
append_and(20, 30, 20);
}
append_print(20);
append_left(20, 20, B - k);
append_right(20, 20, B - k);
append_print(20);
append_and(40, 20, 10);
append_add(50, 40, 5);
append_right(50, 50, k);
dupe_numbers(k, 1, 50, 50);
append_and(15, 50, 15);
append_left(60, 15, k);
append_or(15, 60, 15);
append_left(15, 15, x * k);
append_print(15);
append_xor(0, 0, 15);
};
for (int i = 0; i < n; i++)
for (int j = 0; j + i + 1 < n; j++)
bubble(j);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
Wrong answer detected in grader |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
300 KB |
Output is correct |
2 |
Incorrect |
1 ms |
584 KB |
Wrong answer detected in grader |
3 |
Halted |
0 ms |
0 KB |
- |
# |
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 |
Correct |
1 ms |
596 KB |
Output is correct |
2 |
Correct |
1 ms |
468 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
596 KB |
Output is correct |
2 |
Correct |
1 ms |
468 KB |
Output is correct |
3 |
Incorrect |
1 ms |
628 KB |
Wrong answer detected in grader |
4 |
Halted |
0 ms |
0 KB |
- |