Submission #818234

# Submission time Handle Problem Language Result Execution time Memory
818234 2023-08-10T04:08:01 Z PixelCat Bit Shift Registers (IOI21_registers) C++17
21 / 100
1 ms 340 KB
#include "registers.h"

#ifdef NYAOWO
#include "grader.cpp"
#endif

#include <bits/stdc++.h>
#define For(i, a, b) for(int i = a; i <= b; i++)
#define Forr(i, a, b) for(int i = a; i >= b; i--)
#define F first
#define S second
#define sz(x) ((int)x.size())
#define all(x) x.begin(), x.end()
#define eb emplace_back
// #define int LL
using namespace std;
using i32 = int32_t;
using LL = long long;
using pii = pair<int, int>;

// #define DEBUG
#ifdef DEBUG
#define PRINT(x) append_print(x)
#else
#define PRINT(x)
#endif

/*

function signatures:
  void append_move(int t, int x)
  void append_store(int t, std::vector<bool> v)
  void append_and(int t, int x, int y)
  void append_or(int t, int x, int y)
  void append_xor(int t, int x, int y)
  void append_not(int t, int x)
  void append_left(int t, int x, int p)
  void append_right(int t, int x, int p)
  void append_add(int t, int x, int y)
  void append_print(int t)

registers:
  0  input/output
  1  literal number one
  2  mask for lowest k bits
  3  a[0]
  4  a[1]
  5  many 1's if a[0] < a[1]
  6  complement of m[5]

*/

void construct_instructions(int s, int n, int k, int q) {
    assert(s == 0);

    vector<bool> one(2000, 0);
    one[0] = 1;
    append_store(1, one);
    vector<bool> mask(2000, 0);
    For(i, 0, k - 1) mask[i] = 1;
    append_store(2, mask);

    append_and(3, 0, 2);
    append_left(4, 2, k);
    append_and(4, 0, 4);
    append_right(4, 4, k);
    PRINT(3);
    PRINT(4);

    append_not(5, 4);
    append_add(5, 5, 1);
    append_add(5, 5, 3);
    append_right(5, 5, 1990);
    append_not(6, 5);
    PRINT(5);
    PRINT(6);

    append_and(5, 5, 3);
    append_and(6, 6, 4);
    append_add(0, 5, 6);
}

/*

0 2 1 1000
0 0
0 1
1 0
1 1
-1

move 1 0
right 1 1 1
and 0 0 1
0
0
0
1


1 2 1 1000
0 0
0 1
1 0
1 1
-1

move 1 0
right 1 1 1
and 2 0 1
or 3 0 1
left 3 3 1
or 0 2 3
0 0
0 1
0 1
1 1

*/
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Incorrect min value
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Incorrect min value
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 340 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 340 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -