#include "registers.h"
#include <vector>
using namespace std;
void construct_instructions(int s, int n, int k, int q) {
(void)s; (void)q;
vector<bool> ones_above;
for (int i = 0; i < n * k; i++) ones_above.push_back(false);
for (int i = n * k; i < 2000; i++) ones_above.push_back(true);
if (n > 2) {
append_store(1, ones_above);
append_or(0, 0, 1);
}
vector<bool> all_0s;
for (int i = 0; i < 2000; i++) all_0s.push_back(false);
for (int i = k - 1; i >= 0; i--) {
append_move(1, 0);
for (int j = 0; (1 << j) < n; j++) {
append_right(2, 1, k * (1 << j));
append_and(1, 1, 2);
}
vector<bool> bit_only = all_0s;
bit_only[i] = true;
append_store(2, bit_only);
append_and(3, 1, 2);
append_or(99, 3, 99);
if (i) {
append_not(3, 3);
append_and(1, 2, 3);
for (int j = 0; (1 << j) < n; j++) {
append_left(2, 1, k * (1 << j));
append_or(1, 1, 2);
}
append_and(1, 0, 1);
if (k <= 2) {
append_right(1, 1, 1);
append_or(0, 0, 1);
} else {
append_store(4, all_0s);
for (int j = 1; j < k; j++) {
append_right(2, 1, j);
vector<bool> mask = all_0s;
for (int x = 0; x < 2000; x++) {
if (x % k < k - j) mask[x] = true;
}
append_store(3, mask);
append_and(2, 2, 3);
append_or(4, 2, 4);
}
append_or(0, 0, 4);
}
}
append_print(0);
}
append_move(0, 99);
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
332 KB |
Output is correct |
2 |
Correct |
3 ms |
460 KB |
Output is correct |
3 |
Correct |
2 ms |
332 KB |
Output is correct |
4 |
Correct |
3 ms |
480 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
204 KB |
Wrong answer detected in grader |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
4 ms |
576 KB |
Incorrect sorting |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
4 ms |
576 KB |
Incorrect sorting |
2 |
Halted |
0 ms |
0 KB |
- |