#include "registers.h"
#include<bits/stdc++.h>
using namespace std;
vector<bool> tmp;
void construct_instructions(int s, int n, int k, int q) {
if(s==0 && q==20) {
if(k==1) {
append_right(1, 0, 1);
append_and(0, 0, 1);
} else {
for(int i=0; i<k; i++) tmp.push_back(true);
for(int i=k; i<2000; i++) tmp.push_back(false);
append_store(99, tmp);
append_right(1, 0, 2);
append_and(2, 0, 99);
append_and(77, 1, 2);
append_add(10, 1, 99); append_right(10, 10, 2);
append_add(11, 2, 99); append_right(11, 11, 2);
append_and(10, 10, 11);
append_add(12, 77, 99); append_right(12, 12, 2);
append_xor(10, 10, 12);
append_or(0, 77, 10);
}
} else if(s==0) {
tmp.clear();
for(int i=0; i<n*k; i++) {
tmp.push_back(true);
}
for(int i=n*k; i<2000; i++) {
tmp.push_back(false);
}
append_store(99, tmp); // 11111...1111
tmp.clear();
tmp.push_back(true);
for(int i=1; i<2000; i++) {
tmp.push_back(false);
}
append_store(98, tmp); // 000...0001
tmp.clear();
for(int i=0; i<k; i++) tmp.push_back(true);
for(int i=k; i<2000; i++) tmp.push_back(false);
append_store(97, tmp);
append_xor(0, 0, 99);
for(int i=k-1; i>=0; i--) {
tmp.clear();
for(int j=0; j<n*k; j++) {
if(j%k==i) tmp.push_back(true);
else tmp.push_back(false);
}
for(int j=n*k; j<2000; j++) tmp.push_back(false);
append_store(10, tmp);
append_and(10, 0, 10);
append_left(9, 10, k-i);
append_right(8, 10, i);
append_not(8, 8);
append_add(8, 8, 98);
append_add(8, 8, 9);
// 8 stores the mask, 7 used
append_add(7, 8, 99);
append_right(7, 7, n*k);
append_add(7, 7, 99);
append_xor(8, 7, 8);
append_and(0, 0, 8);
}
for(int i=0; i<7; i++) {
append_right(1, 0, k*(1<<i));
append_or(0, 0, 1);
}
append_and(0, 0, 97);
append_xor(0, 0, 97);
} else {
}
}
# |
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 |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
340 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
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 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
340 KB |
Output is correct |
5 |
Correct |
1 ms |
340 KB |
Output is correct |
6 |
Correct |
1 ms |
340 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
Incorrect sorting |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
Incorrect sorting |
2 |
Halted |
0 ms |
0 KB |
- |