This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
//#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#include "registers.h"
using namespace std;
#define ve vector
typedef long long ll;
typedef pair<int, int> pii;
const int INF = 1e9 + 10;
int m = 100;
int b = 2000;
void construct_instructions(int s, int n, int k, int q) {
ve<bool> mask1(b), mask2(b), mask3(b);
for (int i = 0; i < n / 2; i++) {
for (int j = 0; j < k; j++) {
mask1[2 * i * k + j] = true;
mask2[2 * i * k + k + j] = true;
}
}
for (int i = 0; i < k; i++) {
mask3[i] = true;
}
append_store(1, mask1);
append_store(2, mask2);
append_store(11, mask3);
ve<bool> end(b);
for (int i = 0; i < k; i++) {
end[n * k + i] = true;
}
append_store(13, end);
append_or(0, 0, 13);
for (int i = 0; i < n; i++) {
if (i % 2) {
append_and(12, 0, 11);
append_right(0, 0, k);
}
// A
append_and(3, 0, 1);
// B
append_and(4, 0, 2);
// Subtract
append_right(5, 4, k);
append_xor(5, 5, 1);
append_add(5, 5, 3);
// Duplicate bits
append_and(5, 5, 2);
for (int i = 0; i < k - 1; i++) {
append_left(6, 5, 1);
append_or(5, 5, 6);
}
append_right(6, 5, k);
append_or(5, 5, 6);
// Negated mask
append_not(7, 5);
// Swap A
append_left(8, 3, k);
append_and(8, 8, 5);
// Swap B
append_right(9, 4, k);
append_and(9, 9, 5);
// No swap
append_and(10, 0, 7);
// Result
append_or(10, 10, 8);
append_or(10, 10, 9);
if (i % 2) {
append_left(10, 10, k);
append_or(10, 10, 12);
}
append_move(0, 10);
}
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |