#include "registers.h"
#include <algorithm>
#include <bitset>
#include <cstdint>
#include <cstring>
#include <iostream>
#include <limits.h>
#include <math.h>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
//#define int long long
#define loop(X, N) for(int X = 0; X < (N); X++)
#define all(V) V.begin(), V.end()
#define rall(V) V.rbegin(), V.rend()
using namespace std;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef vector<vector<ii>> vvii;
typedef vector<bool> vb;
typedef vector<vector<bool>> vvb;
void spread(int i, int extra, int k) {
int maxPow = 0;
while (k) {
k /= 2;
maxPow++;
}
for (int pow = 1; pow <= maxPow; pow *= 2) {
append_right(extra, i, pow);
append_or(i, i, extra);
}
}
void findMin(int reg, int step, int n, int k) {
int pow = 1 << step;
append_left(reg + 1, 0, k * pow);
append_and(reg + 1, reg + 1, 99);
append_xor(reg + 2, 0, 1);
//append_print(0);
//append_print(1);
//append_print(2);
append_right(reg + 3, reg + 2, 1);
spread(reg + 3, reg + 4, k); //8
//append_print(3);
//append_print(4);
append_not(reg + 3, reg + 3);
append_and(reg + 4, reg + 2, reg + 3);
//append_print(4);
append_and(reg + 5, reg + 0, reg + 4);
spread(reg + 5, reg + 6, k); //8
//append_print(5);
append_and(reg + 2, reg + 5, 2);
append_xor(0, 0, 2);
//append_print(0);
append_print(0);
}
void construct_instructions(int s, int n, int k, int q) {
if (s == 1) return;
vb even(2000, true);
for (int i = 0; i < n; i++) {
for (int j = i * k * 2; j < i * k * 2 + k; j++) {
even[j] = false;
}
}
//for (int i = k * n; i < 2000; i++) even[i] = false;
append_store(99, even);
findMin(0, 0, n, k);
// vb even2(2000, false);
// for (int i = 0; i < n; i += 1) {
// for (int j = i * k * 2; j < i * k * 2 + k; j++) {
// even2[j] = true;
// }
// }
// append_store(98, even2);
// append_and(0, 0, 98);
// append_print(0);
// findMin(7, 1, n, k);
// append_right(0, 0, k * 2);
/*
0 2 5 100
22 19
*/
}
# |
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 min value |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 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 |
344 KB |
Incorrect sorting |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
Incorrect sorting |
2 |
Halted |
0 ms |
0 KB |
- |