#include "registers.h"
#include <bits/stdc++.h>
#define LEN 2000
#define INPUT 0
#define MASK 1
#define TOO_BIG 2
#define REMOVE_MASK 3
#define ONE 4
#define NOT_REMOVE 5
#define TOO_BIG_MASK 2
#define FINAL_SHIFT 8
#define ZERO 9
#define ALL 10
using namespace std;
void construct_instructions(int s, int n, int k, int q) {
if (s == 0) {
for (int bit = 0; bit < k; bit++)
{
vector<bool> mask(LEN);
for (int i = 0; i < n; i++)
{
mask[i * k] = true;
}
append_store(MASK, mask);
append_left(MASK, MASK, k - 1 - bit);
append_and(TOO_BIG, INPUT, MASK);
append_right(TOO_BIG, TOO_BIG, k - 1 - bit);
for (int i = 0; i < k; i++)
{
append_or(REMOVE_MASK, TOO_BIG, REMOVE_MASK);
append_left(TOO_BIG, TOO_BIG, MASK);
}
vector<bool> one(LEN);
one[0] = true;
append_store(ONE, one);
append_add(NOT_REMOVE, REMOVE_MASK, ONE);
vector<bool> too_big(LEN);
too_big[n * k] = true;
append_store(TOO_BIG, too_big);
append_and(TOO_BIG, TOO_BIG, NOT_REMOVE);
append_right(TOO_BIG, TOO_BIG, n * k);
vector<bool> all(2000, true);
append_store(ALL, all);
append_add(TOO_BIG, TOO_BIG, ALL);
append_and(REMOVE_MASK, REMOVE_MASK, TOO_BIG_MASK);
append_or(INPUT, INPUT, REMOVE_MASK);
}
vector<bool> zero(LEN);
for (int i = 0; i < n * k; i++)
{
zero[i] = true;
}
append_not(INPUT, INPUT);
append_store(ZERO, zero);
append_and(INPUT, INPUT, ZERO);
append_move(FINAL_SHIFT, INPUT);
for (int i = 1; i <= n; i <<= 1)
{
append_right(FINAL_SHIFT, FINAL_SHIFT, k * i);
append_or(INPUT, INPUT, FINAL_SHIFT);
append_move(FINAL_SHIFT, INPUT);
}
append_not(INPUT, INPUT);
}
if (s == 1) {
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
# |
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 |
292 KB |
Output is correct |
2 |
Correct |
1 ms |
468 KB |
Output is correct |
3 |
Correct |
1 ms |
340 KB |
Output is correct |
4 |
Correct |
2 ms |
300 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
296 KB |
Wrong answer detected in grader |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
Incorrect sorting |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
Incorrect sorting |
2 |
Halted |
0 ms |
0 KB |
- |