This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "registers.h"
#include <bits/stdc++.h>
using namespace std;
const int M = 100, B = 2000;
void construct_instructions(int s, int n, int k, int q)
{
if(k == 1)
{
append_right(1, 0, 1);
append_and(0, 1, 0);
}
else
{
// check 2
// if a ^ b == 3 add (a cycle shifted & b > 0)
append_right(1, 0, 2);
append_and(2, 0, 1); // a & b
// append_print(2);
append_right(10, 1, 1);
append_left(11, 1, 1);
append_or(12, 10, 11);
append_left(20, 12, B - 2);
append_right(20, 20, B - 2); // b cycle shifted
// append_print(20);
append_and(20, 0, 20); // a cycle shifted & b
// append_print(20);
append_xor(25, 0, 1); // a ^ b, only 3 is okay so...
append_left(25, 25, B - 2);
append_right(25, 25, B - 2);
// append_print(25);
append_left(26, 25, 1);
append_right(27, 25, 1);
append_or(28, 26, 27); // a ^ b cycle shifted
// append_print(28);
append_and(25, 25, 28); // a ^ b == 3
// append_print(25);
append_and(20, 20, 25); // and with (a cycle shifted & b > 0)
vector<bool> two(B, 0);
two[0] = two[1] = 1;
append_store(30, two);
append_add(31, 30, 20); // third bit is the answer
append_right(31, 31, 2);
append_add(0, 31, 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... |