#include "registers.h"
#include<bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define pb push_back
#define vll vector<ll>
#define pll pair<ll, ll>
typedef int ll;
namespace{
const int LOG=4;
const int diff=100;
const ll B=2000;
const ll m=100;
}
void construct_instructions(int s, int n, int k, int q) {
vector<bool> v1(B), v2(B), v3(B);
for(ll i=0;i<k;i++){
v1[i]=1;
v3[i]=1;
}
for(ll i=diff;i<diff+k;i++){
v2[i]=1;
v3[i]=1;
}
append_store(m-2, v1);
append_store(m-1, v2);
append_store(m-3, v3);
vector<vector<bool>> v(n, vector<bool>(B, 1));
for(ll i=0;i<n;i++){
for(ll j=i*k;j<(i+1)*k;j++){
v[i][j]=0;
}
}
auto find_small=[&](int a){
append_right(3, a, diff);
append_and(4, a, 3);
append_and(4, 4, m-2);
append_left(5, 4, diff);
append_or(4, 5, 4);
append_xor(6, 4, a);
append_print(6);
append_not(7, 6);
append_print(7);
for(int i=0;i<LOG;i++){
append_right(8, 7, (1<<i));
append_and(7, 7, 8);
}
append_right(9, 7, diff);
append_and(9, m-2, 9);
append_and(7, 7, m-2);
append_left(7, 7, diff);
append_or(9, 7, 9);
append_and(6, 6, 9);
for(int i=0;i<LOG;i++){
append_right(8, 6, (1<<i));
append_or(6, 6, 8);
}
append_or(a, a, 6);
append_right(3, a, diff);
append_and(4, a, 3);
append_and(4, 4, m-2);
return 4;
};
append_move(1, 0);
append_and(1, 1, m-2);
for(ll i=0;i<n;i++){
for(ll j=n-2;j>=i;j--){
append_right(2, 0, k*(j+1));
append_print(2);
append_left(2, 2, diff);
append_and(2, 2, m-1);
append_right(3, 0, k*j);
append_and(3, 3, m-2);
append_or(2, 3, 2);
append_move(90, 2);
append_move(1, find_small(2));
append_not(90, 90);
append_and(90, 90, m-3);
append_move(2, find_small(90));
append_not(2, 2);
append_left(1, 1, k*j);
append_left(2, 2, k*(j+1));
append_store(m-4, v[j]);
append_and(0, 0, m-4);
append_store(m-4, v[j+1]);
append_and(0, 0, m-4);
append_or(0, 0, 1);
append_or(0, 0, 2);
}
}
// append_move(0, 1);
return;
}
# | 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... |