#include "registers.h"
#include <bits/stdc++.h>
using namespace std;
using bdata = vector<bool>;
static const int m = 100;
static const int b = 2000;
const int MAX_REG = m - 1;
const int XOR_REG = m - 2;
const int SUM_REG = m - 3;
const int EXT_REG = m - 4;
void init_min () {
append_store( MAX_REG, bdata(b, true) );
}
void min (int f, int s, int target) {
bdata one (b, false); one[0] = true;
append_store(SUM_REG, one);
append_xor( XOR_REG, s, MAX_REG );
append_add( SUM_REG, f, SUM_REG );
append_add( SUM_REG, XOR_REG, SUM_REG );
append_right( SUM_REG, SUM_REG, 10 );
append_and ( XOR_REG, SUM_REG, f );
append_not ( SUM_REG, SUM_REG );
append_and ( SUM_REG, SUM_REG, s );
append_add ( target, SUM_REG, XOR_REG );
}
void extract (int target, int sizes, int index) {
append_move(EXT_REG, 0);
int l = sizes * index;
append_right(EXT_REG, EXT_REG, l);
int del = b - sizes;
append_left (EXT_REG, EXT_REG, del);
append_right(EXT_REG, EXT_REG, del);
append_move (target, EXT_REG);
}
void construct_instructions(int s, int n, int k, int q) {
assert(s == 0);
init_min();
extract(1, k, 0);
for (int i = 1; i < n; i ++) {
extract(2, k, i);
int target = i + 1 == n ? 0 : 1;
min(1, 2, target);
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
2 ms |
596 KB |
Output is correct |
3 |
Correct |
2 ms |
596 KB |
Output is correct |
4 |
Correct |
2 ms |
596 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
Wrong answer detected in grader |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
1 ms |
340 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
1 ms |
340 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |