답안 #601276

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
601276 2022-07-21T14:48:16 Z PiejanVDC 레지스터 (IOI21_registers) C++17
컴파일 오류
0 ms 0 KB
#include "registers.h"
#include <bits/stdc++.h>
using namespace std;

const int b = 2000;

void construct_instructions(int s, int n, int k, int q) {
    if(k == 1) {
        append_move(1, 0);
        append_right(1, 1, 1);
        append_and(0, 0, 1);
        return;
    }

    append_move(1, 0);
    append_right(1, 1, 2);

    for(int i = 15 ; i >= 0 ; i--) {
        vector<int>v(b, 0);
        for(int j = 0 ; j < 2 ; j++) v[j] = i & (1 << j);
        append_store(2, v);
        append_xor(2, 0, 2);
        for(int j = 0 ; j < 2 ; j++) {
            v.clear();
            v.resize(b, 0);
            v[j] = 1;
            append_store(3, v);
            append_and(3, 2, 3);
            append_right(3, 3, i);
            for(int l = 0 ; l < 2 ; l++) {
                append_and(5, 2, 3);
                append_or(4, 4, 5);
                append_left(3, 3, 1);
            }
            append_not(6, 4);
            append_and(10, 10, 6);
            append_and(11, 4, 0);
            append_or(10, 11, 10);
        }
        v.clear();
        v.resize(b, 0);
        for(int j = 0 ; j < 2 ; j++) v[j] = i & (1 << j);
        append_store(2, v);
        append_xor(2, 1, 2);
        for(int j = 0 ; j < 2 ; j++) {
            v.clear();
            v.resize(b, 0);
            v[j] = 1;
            append_store(3, v);
            append_and(3, 2, 3);
            append_right(3, 3, i);
            for(int l = 0 ; l < 4 ; l++) {
                append_and(5, 2, 3);
                append_or(4, 4, 5);
                append_left(3, 3, 1);
            }
            append_not(6, 4);
            append_and(10, 10, 6);
            append_and(11, 4, 1);
            append_or(10, 11, 10);
        }
    }
    append_move(0, 10);
}

Compilation message

registers.cpp: In function 'void construct_instructions(int, int, int, int)':
registers.cpp:21:25: error: could not convert 'v' from 'vector<int>' to 'vector<bool>'
   21 |         append_store(2, v);
      |                         ^
      |                         |
      |                         vector<int>
registers.cpp:27:29: error: could not convert 'v' from 'vector<int>' to 'vector<bool>'
   27 |             append_store(3, v);
      |                             ^
      |                             |
      |                             vector<int>
registers.cpp:43:25: error: could not convert 'v' from 'vector<int>' to 'vector<bool>'
   43 |         append_store(2, v);
      |                         ^
      |                         |
      |                         vector<int>
registers.cpp:49:29: error: could not convert 'v' from 'vector<int>' to 'vector<bool>'
   49 |             append_store(3, v);
      |                             ^
      |                             |
      |                             vector<int>