이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "registers.h"
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pii;
typedef vector<int> vi;
typedef vector<bool> vb;
typedef vector<pii> vpii;
typedef vector<vpii> vvpii;
typedef vector<vvpii> vvvpii;
#define sz(x) (int)(x).size()
#define all(x) (x).begin(), (x).end()
void construct_instructions(int s, int n, int k, int q)
{
vb mask;
// mask for 1
mask.assign(2000, 0);
mask[0] = 1;
append_store(98, mask);
auto swap = [&](int a, int b, int filter)
{
// smaller stuff lands in a
append_not(2, a);
append_add(2, 2, 98);
append_add(2, 2, b); // b - a
{
append_xor(3, a, 2);
append_xor(3, b, 3);
append_and(95, 3, filter); // filters the carrybits we prepared with the xor
append_right(96, 95, k);
append_not(96, 96);
append_add(96, 96, 98);
append_add(94, 95, 96); // with filter - (filter >> k) we build filters with k bits
}
append_xor(2, a, b);
append_and(2, 2, 94);
append_xor(a, a, 2);
if (s == 1)
append_xor(b, b, 2);
};
if (s == 0)
{
mask.assign(2000, 0);
int next = 1;
while (next < n)
next *= 2;
fill(mask.begin() + n * k, mask.begin() + next * k, 1);
append_store(99, mask);
append_or(0, 0, 99);
while (next > 1)
{
append_right(1, 0, (next / 2) * k);
vb filter;
filter.assign(2000, 0);
for (int i = 0; i < next / 2; ++i)
filter[i * k + k] = 1;
append_store(97, filter);
swap(0, 1, 97);
next >>= 1;
}
}
}
# | 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... |