#include "registers.h"
#include<bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define vi vector<int>
#define f0r(i,n) for(int i = 0; i<n; i++)
#define FOR(i, k, n) for(int i = k; i<n; i++)
#define pii pair<int,int>
#define vvi vector<vector<int>>
#define vb vector<bool>
#define vpii vector<pair<int,int>>
#define vout(v) for(auto u : v)cout<<u<<' '; cout<<endl;
#define dout(x) cout<<x<<' '<<#x<<endl;
#define dout2(x,y) cout<<x<<' '<<#x<<' '<<y<<' '<<#y<<endl;
using namespace std;
const int m = 100;
const int b = 2000;
const int ONE = m-1;
const int MINUSONE = m-2;
const int IIOO = m-3;
const int OOII = m-4;
int cur = 1;
int identity(int x){
append_add(cur, MINUSONE, x);
cur++;
append_not(cur, cur-1);
cur++;
return cur - 2;
}
int extract(int t, int k){
append_right(cur, t, k);
append_and(cur, cur, ONE);
cur++;
return cur - 1;
}
void construct_instructions(int s, int n, int k, int q) {
if(k == 2){
cur = 1;
vb one;
one.pb(1);
f0r(i, b-1)one.pb(0);
append_store(m-1, one);
vb minusone;
f0r(i, b)minusone.pb(1);
append_store(m-2, minusone);
vb iioo; iioo.pb(1); iioo.pb(1); f0r(i,b-2)iioo.pb(0);
append_store(m-3, iioo);
vb ooii; ooii.pb(0); ooii.pb(0); ooii.pb(1); ooii.pb(1); f0r(i, b-4)ooii.pb(0);
append_store(m-4, ooii);
append_print(0);
append_and(cur, 0, ONE); int a1 = cur; cur++;
int a2 = extract(0, 1);
int b1 = extract(0, 2);
append_right(cur, 0, 3); int b2 = cur; cur++;
append_and(cur, a2, b2); int nd = cur; cur++;
int msk = identity(nd) + 1;
append_print(a1);
append_print(b1);
append_and(cur, a1, b1); int c = cur; cur++;
append_left(cur, a2, 1); int twoa2 = cur; cur++;
append_or(c, c, twoa2);
append_and(cur, msk, c); int res = cur; cur++;
int id = identity(a2); int id2 = identity(b2);
int nota2 = id; int isa2 = id + 1; int notb2 = id2; int isb2 = id2 + 1;
//nota2 and b2 and a
append_and(cur, nota2, isb2); int msk1 = cur; cur++;
append_and(cur, isa2, notb2); int msk2 = cur; cur++;
append_and(msk1, msk1, IIOO); append_and(msk2, msk2, OOII);
append_and(0, 0, msk1); append_and(0, 0, msk2); append_print(0); append_print(res); append_or(0, 0, res);
}
else{
append_move(1,0);
append_right(1, 1, 1);
append_and(0, 0, 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... |