#include "registers.h"
#include <bits/stdc++.h>
using namespace std;
void construct_instructions(int s, int n, int k, int q) {
int m=100,b=2000;
vector<bool> A(b,0);
for (int i=n*k;i<b;i++) A[i]=1; append_store(99,A); append_or(0,0,99);
int r1=98,r2=97,A0=96,A1=95;
for (int i=0;i<b;i++) if ((i/k)%2==0) A[i]=1; else A[i]=0;
append_store(r1,A);
for (int i=0;i<b;i++) if (i%(k*2)==0) A[i]=1; else A[i]=0;
append_store(r2,A);
int a=1;
while (a<n) {
append_right(1,0,a*k);
a*=2;
append_not(2,1);
append_and(2,2,r1);
append_and(0,0,r1);
append_add(3,0,2);
append_right(3,3,k);
append_and(3,3,r2);
append_add(3,3,r1);
append_and(A0,3,0);
append_not(3,3);
append_and(A1,3,1);
append_or(0,A0,A1);
}
}
Compilation message
registers.cpp: In function 'void construct_instructions(int, int, int, int)':
registers.cpp:8:2: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
8 | for (int i=n*k;i<b;i++) A[i]=1; append_store(99,A); append_or(0,0,99);
| ^~~
registers.cpp:8:34: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
8 | for (int i=n*k;i<b;i++) A[i]=1; append_store(99,A); append_or(0,0,99);
| ^~~~~~~~~~~~
registers.cpp:6:6: warning: unused variable 'm' [-Wunused-variable]
6 | int m=100,b=2000;
| ^
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
204 KB |
Output is correct |
4 |
Correct |
1 ms |
204 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
3 |
Correct |
0 ms |
204 KB |
Output is correct |
4 |
Correct |
1 ms |
204 KB |
Output is correct |
5 |
Correct |
1 ms |
204 KB |
Output is correct |
6 |
Correct |
1 ms |
204 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
204 KB |
Incorrect sorting |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
204 KB |
Incorrect sorting |
2 |
Halted |
0 ms |
0 KB |
- |