using namespace std;
#include <vector>
#define vb vector<bool>
const int B = 2000;
int N,K;
void append_move(int t, int x);
void append_store(int t, std::vector<bool> v);
void append_and(int t, int x, int y);
void append_or(int t, int x, int y);
void append_xor(int t, int x, int y);
void append_not(int t, int x);
void append_left(int t, int x, int s);
void append_right(int t, int x, int s);
void append_add(int t, int x, int y);
void append_print(int t);
//void construct_instructions(int s, int n, int k, int q);
void dif(int t, int a, int b, int l){
vb v(B);v[0]=true; append_store(l,v);
append_not(t,b);
append_add(t,l,t);
append_add(t,a,t);
append_print(t);
}
void comp(int t, int a, int b, int l){ // puts 00...0 in t if (a==b), and 1..111 else
append_xor(l,a,b);
append_right(l,l,1);
vb v(B,true);
append_store(l+1,v);
append_add(l+2,l+1,l);
append_right(l+3,l+2,B-1);
append_add(t,l+1,l+3);
//append_not(t,t);
append_print(t);
}
void ithbit(int t, int i){
vb v1(B);
for(int j = i; j < N*K; j+=K){
v1[j]=1;
}
append_store(t,v1);
}
void compi(int t, int a, int b, int l){
dif(t,b,a,l);
append_move(l+2,t);
append_right(l+2,l+2,B-1);
vb v(B,true); append_store(l+1,v);
append_add(l+3,l+2,l+1);
append_and(t,t,l+3);
append_add(t,t,a);
//append_print(t);
append_xor(t,t,a);
append_xor(t,t,b);
}
void construct_instructions(int s, int n, int k, int q) {
N=n, K=k;
for(int i = 0; i < n; i++){
for(int j = i+1; j < n; j++){
append_move(1,0);append_move(2,0);
append_right(1,1,(B-(i+1)*K)); append_left(1,1,B-K);
append_right(2,2,(B-(j+1)*K)); append_left(2,2,B-K);
compi(3,1,2,10);
append_xor(4,1,3);
append_right(4,4,i*K);
append_xor(0,0,4);
append_right(4,4,(j-i)*K);
append_xor(0,0,4);
}
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Incorrect min value |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 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 min value |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Wrong answer detected in grader |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
604 KB |
Incorrect sorting |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
604 KB |
Incorrect sorting |
2 |
Halted |
0 ms |
0 KB |
- |