#include "registers.h"
#include<bits/stdc++.h>
using namespace std;
using ll = int;
const ll m = 100, b = 2000;
void construct_instructions(int s, int n, int k, int q) {
auto get_num = [&](ll t, ll x, ll i){
append_left(t,x,b-(i+1)*k);
append_right(t,t,b-k);
//append_print(t);
};
if (s==0){
get_num(1,0,0);
vector<bool> one(b,0);
one[0] = true;
append_store(m-1,one);
auto neg = [&](ll t, ll x){
append_not(t,x);
append_add(t,t,m-1);
};
auto abs = [&](ll t, ll x, ll tmp){
neg(t,x);
append_right(tmp,x,b-k);
append_and(tmp,t,tmp);
append_not(t,x);
append_right(t,t,b-k);
append_and(t,t,x);
append_add(t,t,tmp);
};
auto uabs = [&](ll t, ll x, ll tmp){
neg(t,x);
append_not(tmp,x);
append_right(tmp,tmp,b-k*2);
append_and(tmp,t,tmp);
append_right(t,x,b-k*2);
append_and(t,t,x);
append_add(t,t,tmp);
};
for(ll i = 1;i<n;i++){
get_num(2,0,i);
neg(3,2);
append_add(3,1,3);
uabs(4,3,5);
//append_print(4);
//append_print(4);
append_add(3,1,2);
//append_print(3);
append_add(3,3,4);
//append_print(3);
append_left(1,3,b-k-1);
append_right(i+1<n,1,b-k);
}
}
}
Compilation message
registers.cpp: In function 'void construct_instructions(int, int, int, int)':
registers.cpp:22:8: warning: variable 'abs' set but not used [-Wunused-but-set-variable]
22 | auto abs = [&](ll t, ll x, ll tmp){
| ^~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
1 ms |
604 KB |
Output is correct |
3 |
Correct |
1 ms |
600 KB |
Output is correct |
4 |
Correct |
1 ms |
604 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
Wrong answer detected in grader |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
Incorrect sorting |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
Incorrect sorting |
2 |
Halted |
0 ms |
0 KB |
- |