#include "registers.h"
#include <bits/stdc++.h>
using namespace std;
const int PLUS_ONE = 99;
const int CARRY_BITS = 98;
const int PADDING = 97;
const int TMP1 = 96;
const int TMP2 = 95;
int S, N, K;
void order(int A, int B) {
append_print(A);
append_print(B);
append_not(TMP1, A);
append_add(TMP1, TMP1, B);
append_add(TMP1, TMP1, PLUS_ONE);
append_xor(TMP1, TMP1, A);
append_xor(TMP1, TMP1, B);
append_and(TMP1, TMP1, CARRY_BITS);
append_right(TMP2, TMP1, K);
append_not(TMP2, TMP2);
append_add(TMP1, TMP1, TMP2);
append_add(TMP1, TMP1, PLUS_ONE);
append_move(TMP2, A);
append_xor(TMP2, TMP2, B);
append_and(TMP2, TMP2, TMP1);
append_xor(A, A, TMP2);
append_xor(B, B, TMP2);
}
void construct_instructions(int _S, int _N, int _K, int Q) {
S = _S;
N = _N;
K = _K;
{
vector<bool> bits(2000);
bits[0] = 1;
append_store(PLUS_ONE, bits);
}
{
vector<bool> bits(2000);
for (int i = 1; i <= N; i++) {
bits[i * K] = 1;
}
append_store(CARRY_BITS, bits);
}
if (S == 0) {
while (N > 1) {
append_right(1, 0, (N / 2) * K);
order(0, 1);
N = (N + 1) / 2;
}
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
300 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
6 |
Correct |
0 ms |
300 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
Incorrect sorting |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
Incorrect sorting |
2 |
Halted |
0 ms |
0 KB |
- |