답안 #818281

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
818281 2023-08-10T04:16:23 Z PixelCat 레지스터 (IOI21_registers) C++17
33 / 100
1 ms 468 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 a[i]
  3  current min
  4  a[i]
  5  many 1's if min < a[i]
  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);
    For(i, 1, n - 1) {
        append_left(2, 2, k);
        append_and(4, 0, 2);
        append_right(4, 4, k * i);

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

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

/*

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

*/
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 468 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 468 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 212 KB Wrong answer detected in grader
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 340 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 340 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -