#include <bits/stdc++.h>
#define pb push_back
#include "registers.h"
using namespace std;
constexpr static int b = 2000;
vector<bool> v(b);
int n, s, k, q;
void fill_right(int i, int c, int tmp);
void expand_numbers()
{
for (int i = 0; i < n; i++)
for (int j = 0; j < k; j++)
v[i*k+j] = !(i&1);
append_store(99, v);
append_move(1, 0);
append_and(0, 0, 99);
append_not(99, 99);
append_and(1, 1, 99);
append_left(1, 1, (n-1 + (n&1)) * k);
append_or(0, 0, 1);
}
void find_minimum()
{
expand_numbers();
for (int i = 0; i < b; i++)
v[i] = !(i%k);
const int ONES = 9;
append_store(ONES, v);
const int ELEVES = 10;
const int NELEVES = 11;
for (int i = 0; i < b; i++)
v[i] = (i%(2*k)) == (k);
append_store(ELEVES, v);
append_not(NELEVES, ELEVES);
while (n > 1)
{
int step = n / 2;
append_right(1, 0, step * k*2);
append_not(2, 1);
append_add(2, 2, ONES); // 2 is negative 1 right now
append_add(2, 0, 2);
append_and(2, 2, ELEVES);
fill_right(2, k-1, 3);
append_and(2, 2, NELEVES);
append_not(3, 2);
// 2 means 1 is bigger, 3 means 0 is bigger
append_and(1, 1, 2);
append_and(0, 0, 3);
append_or(0, 0, 1);
n -= step;
}
}
void construct_instructions(int ss, int nn, int kk, int qq)
{
s = ss, n = nn, k = kk, q = qq;
if (s == 0)
find_minimum();
}
void fill_right(int i, int c, int tmp)
{
c++;
while (c > 1)
{
if (c&1)
{
c--;
append_right(tmp, i, 1);
}
else
{
c >>= 1;
append_right(tmp, i, c);
}
append_or(i, i, tmp);
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
Incorrect min value |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
Wrong answer detected in grader |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
Incorrect min value |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
Incorrect min value |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
Incorrect sorting |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
Incorrect sorting |
2 |
Halted |
0 ms |
0 KB |
- |