#include "registers.h"
#include<bits/stdc++.h>
using namespace std;
void construct_instructions(int s, int n, int k, int q) {
// znajdz 1 rozniaca sie pozycje;
append_right(1, 0, k);//ustaw b
append_left(0, 0, 2000-k), append_right(0,0,2000-k);//ustaw a
vector<bool>jeden(2000, 0);jeden[0] = 1;append_store(1, jeden);
//0 - a
//1 - b
//2 - "1"
//3 - czy_znaleziono_pozcje
//4 ktora wieksza
int i;
for(i=k-1;i>=0;i--){
append_right(5, 0, i);
append_right(6, 1, i);
append_and(5, 5, 2);//i-ty bit a
append_and(6, 6, 2);//i-ty bit b
append_xor(7, 5, 6);//xor
append_xor(8, 3, 2); // !4
append_and(8, 8, 7), append_and(4, 8, 5); // 1 - jesli b<a
//3 = (!4) & 7 & 5
append_or(3, 3, 7);//czy_znaleziono_poprawione
}
//3 same 0 jeśli a<b, same 1, jeśli b<a
append_move(3, 4);
for(i=1;i<k;i++){
append_left(3,3,1);
append_or(3, 3, 4);
}
append_and(4, 0, 3);
append_xor(4, 4, 0); //a^(a&1111)
append_and(5, 1, 3); //b&1111
append_or(0, 4, 5);
//a^(a&1111) | b&1111
return;
}
# |
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 |
Incorrect min value |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Incorrect sorting |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Incorrect sorting |
2 |
Halted |
0 ms |
0 KB |
- |