#include "registers.h"
#include<bits/stdc++.h>
using namespace std;
#define DO int K=i_dont_need.front();i_dont_need.pop();i_have_added.push(K);
int CCC;
const int B=2000;
queue<int> i_dont_need,i_have_added;
int AD_move(int x) {
DO
append_move(K,x);
return K;
}
int AD_store(vector<bool> v){
DO
append_store(K,v);
return K;
}
int AD_and(int x, int y){
DO
append_and(K,x,y);
return K;
}
int AD_or(int x, int y){
DO
append_or(K,x,y);
return K;
}
int AD_xor(int x, int y){
DO
append_xor(K,x,y);
return K;
}
int AD_not(int x){
DO
append_not(K,x);
return K;
}
int AD_left(int x, int s){
DO
append_left(K,x,s);
return K;
}
int AD_right(int x, int s){
DO
append_right(K,x,s);
return K;
}
int AD_add(int x, int y){
DO
append_add(K,x,y);
return K;
}
int AD_neg(int reg){
vector<bool>V(B);
V[0]=1;
return AD_add(AD_not(reg),AD_store(V));
}
void add_comparison(int a,int b){
while(i_have_added.size())i_have_added.pop();
int K=AD_xor(a,b);
int UHH=AD_and(K,AD_add(AD_right(AD_add(b,AD_neg(a)),B-1),AD_store(vector<bool>(B,1))));
append_xor(a,a,UHH);
append_xor(a,b,UHH);
}
void CCONV() {
while(i_have_added.size())
i_dont_need.push(i_have_added.front()),
i_have_added.pop();
}
void meerge(int sz,int k,int reg){
if(sz==1)return;
int sz1=sz/2,sz2=sz-sz1;
int oth=AD_right(reg,k*sz1);
append_left(reg,reg,B-k*sz1);
append_right(reg,reg,B-k*sz1);
meerge(sz1,k,reg);
meerge(sz2,k,oth);
add_comparison(reg,oth);
i_have_added.push(oth);
CCONV();
}
void construct_instructions(int s, int n, int k, int q) {
for(int i=1;i<100;i++)
i_dont_need.push(i);
meerge(n,k,0);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
1 ms |
1116 KB |
Output is correct |
3 |
Correct |
2 ms |
860 KB |
Output is correct |
4 |
Correct |
2 ms |
860 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
348 KB |
Wrong answer detected in grader |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
344 KB |
Incorrect sorting |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
344 KB |
Incorrect sorting |
2 |
Halted |
0 ms |
0 KB |
- |