#include "registers.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef pair<ll,ll> P;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef tuple<ll,ll,ll> PP;
typedef vector<PP> vpp;
typedef vector<vpp> vvpp;
typedef vector<bool> vb;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define REP(i,k,n) for(ll i=(ll)(k);i<(ll)(n);i++)
#define pb emplace_back
#define all(a) a.begin(),a.end()
#define dupli(a) {sort(all(a));a.erase(unique(all(a)),a.end());}
#define lb(v,k) (lower_bound(all(v),k)-v.begin())
#define fi first
#define se second
template<class T> bool chmax(T&a,T b){if(a<b){a=b;return true;}return false;}
const ll inf=1001001001001001001;
void construct_instructions(int s, int n, int k, int q) {
ll lg=0;
while(n>(1<<lg))lg++;
vb tmp(2000,false);
REP(i,n*k,2000)tmp[i]=true;
append_store(1,tmp);
append_or(0,0,1);
if(s==0){
rep(i,lg){
append_right(1,0,k<<i);
append_xor(2,0,1);
rep(j,k){
append_right(4,0,j);
append_right(5,2,j);
append_xor(6,3,4);
append_and(6,6,5);
append_xor(3,3,6);
}
rep(i,2000){
if(i%k==0)tmp[i]=true;
else tmp[i]=false;
}
append_store(4,tmp);
append_and(3,3,4);
rep(j,k-1){
append_left(4,3,1);
append_or(3,3,4);
}
append_and(2,2,3);
append_xor(0,0,2);
}
}
else{
vb f1(2000,false),f2(2000,false),f3(2000,false),f4(2000,false);
if(n%2){
rep(i,k)f1[i]=true;
rep(i,k)f2[n*k-i-1]=true;
}
else{
rep(i,k)f1[i]=f1[n*k-i-1]=true;
}
rep(i,2000){
if((i/k)%2)f3[i]=true;
else f4[i]=true;
}
append_store(98,f1);
append_store(99,f2);
append_store(96,f3);
append_store(97,f4);
rep(i,n){
append_right(1,0,k);
append_xor(2,0,1);
rep(j,k){
append_right(4,0,j);
append_right(5,2,j);
append_xor(6,3,4);
append_and(6,6,5);
append_xor(3,3,6);
}
rep(i,2000){
if(i%k==0)tmp[i]=true;
else tmp[i]=false;
}
append_store(4,tmp);
append_and(3,3,4);
rep(j,k-1){
append_left(4,3,1);
append_or(3,3,4);
}
append_and(2,2,3);
append_xor(2,0,2);
append_xor(3,0,1);
append_xor(3,3,2);
append_and(2,2,96+i%2);
append_and(3,3,96+i%2);
append_and(0,0,98+i%2);
append_left(3,3,k);
append_or(0,0,2);
append_or(0,0,3);
}
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
340 KB |
Output is correct |
3 |
Correct |
1 ms |
340 KB |
Output is correct |
4 |
Correct |
1 ms |
340 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
Wrong answer detected in grader |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
340 KB |
Output is correct |
2 |
Correct |
1 ms |
340 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
340 KB |
Output is correct |
2 |
Correct |
1 ms |
340 KB |
Output is correct |
3 |
Incorrect |
2 ms |
636 KB |
Wrong answer detected in grader |
4 |
Halted |
0 ms |
0 KB |
- |