답안 #437018

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
437018 2021-06-25T16:06:10 Z model_code 레지스터 (IOI21_registers) C++17
10 / 100
1 ms 652 KB
#include "registers.h"

#include <bits/stdc++.h>
using namespace std;

constexpr int M = 100;
constexpr int B = 2000;

constexpr int kFinalAnswer = M - 1;
constexpr int kExpectedInput = kFinalAnswer - 1;
constexpr int kExpectedOutput = kExpectedInput - 1;
constexpr int kFirstBuffer = kExpectedOutput - 1;
constexpr int kSecondBuffer = kFirstBuffer - 1;

void load(int K, int val, int starting_index, vector<bool> &v) {
  for (int i = 0; i < K; ++i) {
    if (val & (1 << i)) {
      v[starting_index + i] = true;
    }
  }
}

void construct_instructions(int S, int N, int K, int Q) {
  for (int i = 0; i < (1 << K); ++i) {
    for (int j = 0; j < (1 << K); ++j) {
      vector<bool> expected_input(B, false);
      vector<bool> expected_output(B, false);

      load(K, i, 0, expected_input);
      load(K, j, K, expected_input);
      load(K, min(i, j), 0, expected_output);

      append_store(kExpectedInput, expected_input);
      append_store(kExpectedOutput, expected_output);

      append_xor(kFirstBuffer, 0, kExpectedInput);
      for (int bit = 1; bit < 2 * K; ++bit) {
        append_right(kSecondBuffer, kFirstBuffer, 1);
        append_or(kFirstBuffer, kFirstBuffer, kSecondBuffer);
      }

      for (int bit = 1; bit < K; ++bit) {
        append_left(kSecondBuffer, kFirstBuffer, 1);
        append_or(kFirstBuffer, kFirstBuffer, kSecondBuffer);
      }
      append_not(kFirstBuffer, kFirstBuffer);
      append_and(kFirstBuffer, kFirstBuffer, kExpectedOutput);
      append_or(kFinalAnswer, kFinalAnswer, kFirstBuffer);
    }
  }
  append_move(0, kFinalAnswer);
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 332 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 204 KB Wrong answer detected in grader
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 652 KB Wrong answer detected in grader
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 204 KB Wrong answer detected in grader
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 636 KB Wrong answer detected in grader
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 636 KB Wrong answer detected in grader
2 Halted 0 ms 0 KB -