이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
void append_move(int t, int x);
void append_store(int t, vector<bool> v);
void append_and(int t, int x, int y);
void append_or(int t, int x, int y);
void append_xor(int t, int x, int y);
void append_not(int t, int x);
void append_left(int t, int x, int s);
void append_right(int t, int x, int s);
void append_add(int t, int x, int y);
void append_print(int t);
void construct_instructions(int s, int n, int k, int q);
void fill (vector<bool>& v, bool b = 0) {
while ((int) v.size() < 2000) v.push_back(b);
}
vector<bool> v1 {1}, inv1;
const int c1 = 99, invc1 = 98;
void cmp (int t, int a, int b) { // all 1s iff a < b
append_not(t, b);
append_add(t, t, c1);
append_add(t, a, t);
append_right(t, t, 1999);
append_not(t, t);
append_add(t, t, c1);
}
void min (int t, int a, int b, int tmp) {
cmp(t, a, b);
append_not(tmp, t);
append_and(t, t, a);
append_and(tmp, tmp, b);
append_add(t, t, tmp);
}
void construct_instructions (int s, int n, int k, int q) {
fill(v1);
fill(inv1, 1);
append_store(c1, v1);
if (s == 0) {
vector<bool> AND;
if (n == 2) {
for (int i = 0; i < k; i++) AND.push_back(1);
fill(AND);
append_store(98, AND);
append_and(1, 0, 98);
append_right(2, 0, k);
min(0, 1, 2, 98);
} else {
vector<bool> NEG;
for (int i = 0; i < n*k; i++) AND.push_back(i % k == 0);
fill(AND);
for (int i = 0; i < n*k; i++) NEG.push_back(i % k != 0);
NEG[0] = 1;
fill(NEG, 1);
append_store(96, AND);
append_store(97, NEG);
append_store(invc1, inv1);
for (int i = 0; i < k; i++) {
append_and(10+k-i, 0, 96);
append_right(0, 0, 1);
}
append_left(0, 0, 2000);
for (int i = 0; i < k; i++) {
append_or(2, 11+i, 1);
append_add(3, 97, 2);
append_right(3, 3, 1999);
append_not(3, 3);
append_and(3, 3, c1);
append_left(0, 0, 1);
append_add(0, 0, 3);
append_add(3, 3, invc1);
append_and(2, 2, 3);
append_or(1, 1, 2);
}
}
}
}
# | 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... |