#include <bits/stdc++.h>
#include "registers.h"
#define all(x) (x).begin(),(x).end()
using namespace std;
using ll = long long;
using ld = long double;
//#define int ll
#define sz(x) ((int)(x).size())
using pii = pair<int,int>;
using tii = tuple<int,int,int>;
const int BSIZE = 2000;
namespace Utils {
vector<bool> tobits(int x) {
vector<bool> val;
if(x == 0) { val.emplace_back(0); return val; }
while(x > 0) {
val.emplace_back(x & 1);
x >>= 1;
}
return val;
}
vector<bool> multiply(vector<bool> v, int times) {
vector<bool> R;
while(times) {
if(times & 1)
copy(all(v), back_inserter(R));
times >>= 1;
auto X = v;
copy(all(X), back_inserter(v));
}
return R;
}
vector<bool> concat(vector<bool> a, vector<bool> b) { copy(all(b), back_inserter(a)); return a; }
vector<bool> ceil(vector<bool> a) {
a.resize(BSIZE, 0);
return a;
}
}
using namespace Utils;
#warning LEFT INSEAMNA CA SE MISCA i --> i - p (adica la stanga)
namespace PulaMea {
void amove(int t, int y) { append_move(t, y); }
void astore(int t, vector<bool> a) { append_store(t, a); }
void aand(int t, int x, int y) { append_and(t, x, y); }
void aor(int t, int x, int y) { append_or(t, x, y); }
void axor(int t, int x, int y) { append_xor(t, x, y); }
void anot(int t, int x) { append_not(t, x); }
void aright(int t, int x, int y) { append_left(t, x, y); }
void aleft(int t, int x, int y) { append_right(t, x, y); }
void asum(int t, int x, int y) { append_add(t, x, y); }
void print(int t) { append_print(t); }
}
using namespace PulaMea;
#define plus ashgafshasiuhqeuiasf
const int simple = 99;
const int plus = 98;
void construct_instructions(int s, int n, int k, int q) { // doar S2 acum
int even = 1, weirdeven = 5, odd = 2, thirdparty = 3, aux = 4;
astore(simple, ceil(multiply(concat(multiply(tobits(1), k), multiply(tobits(0), k)), (BSIZE / (2 * k)))));
astore(plus, ceil(multiply(concat(multiply(tobits(1), k + 1), multiply(tobits(0), k - 1)), (BSIZE / (2 * k)))));
aand(even, 0, simple);
//print(0);
aleft(odd, 0, k);
//aand(odd, odd, simple); // nenecesar
//print(odd);
anot(weirdeven, even);
aand(weirdeven, weirdeven, plus);
//print(weirdeven);
//print(odd);
asum(thirdparty, odd, weirdeven);
aand(thirdparty, thirdparty, plus);
//print(thirdparty);
aleft(thirdparty, thirdparty, k);
for(int i = 1; i < k; i *= 2) {
aright(aux, thirdparty, i);
aor(thirdparty, aux, thirdparty);
}
aand(aux, thirdparty, odd);
anot(thirdparty, thirdparty);
aand(thirdparty, thirdparty, even);
asum(0, thirdparty, aux);
//append_print(0);
return;
}
/**
Istenem! Nu poate fi real.
-- Surse verificate
*/
Compilation message
registers.cpp:47:2: warning: #warning LEFT INSEAMNA CA SE MISCA i --> i - p (adica la stanga) [-Wcpp]
47 | #warning LEFT INSEAMNA CA SE MISCA i --> i - p (adica la stanga)
| ^~~~~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
596 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
344 KB |
Incorrect min value |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
344 KB |
Incorrect min value |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
348 KB |
Incorrect sorting |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
348 KB |
Incorrect sorting |
2 |
Halted |
0 ms |
0 KB |
- |