#include "registers.h"
#include <bits/stdc++.h>
#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx2")
#define pb push_back
#define F first
#define pii pair<int,int>
#define all(a) a.begin(),a.end()
#define S second
#define sz(a) (int)a.size()
#define rep(i , a , b) for(int i = (a) ; i <= (b) ; i++)
#define per(i , a , b) for(int i = (a) ; i >= (b) ; i--)
#define ld double
#define ll long long
using namespace std ;
const int maxn = 5000 + 10 , inf = 1e9+ 10 , mod = 998244353;
int n , k ;
void solve(){
vector <bool> vec;
vec.clear() ;
rep(j , 0 , 1999){
vec.pb(1);
}
append_store(5 , vec);
per(i , k-1 , 0){
vector <bool> vec;
rep(j , 0 ,1999){
if(j%k==i){
vec.pb(1);
}else{
vec.pb(0);
}
}
append_store(1 ,vec) ;
append_and(3 , 0 , 1) ;
vec.clear() ;
bool ok =1;
rep(j , 0 , n*k-1){
if(j%k!=i){
vec.pb(1);
}else{
vec.pb(ok) ;
ok = 0;
}
}
rep(j , n*k , 2000-1)vec.pb(0);
append_store(2 , vec);
append_add(1 , 3 , 2) ;
append_right(1 , 1 , n*k);
append_left(1 , 1 , i) ;
append_add(4 , 4 , 1) ;
if(i ==0 )break ;
append_add(1 , 1 ,5 );
append_and(1 , 1 ,3 );
int t = 1 ;
while(t!=i+1){
if(t*2 <= i+1){
append_right(3 , 1 , t) ;
t = t*2 ;
}else{
append_right(3 , 1 , i+1 - t) ;
t = i+1 ;
}
append_or(1 , 3 , 1) ;
}
append_or(0 , 0 ,1) ;
}
append_move(0 , 4) ;
}
void construct_instructions(int s, int N, int K, int q) {
n = N;
k = K ;
solve();
}
# | 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... |