답안 #164563

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
164563 2019-11-21T13:53:48 Z NachoLibre Vision Program (IOI19_vision) C++14
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>
using namespace std;
#include "vision.h"

int h, w, c0, c1, d;

int pti(int i, int j) {
    return w * i + j;
}

vector<int> md (int i, int d) {
    /* 0 - /
       1 - \ */
    vector<int> v;
    int j;
    if (d) {
        j = h - 1;
        if(i >= w) {
            j -= i - w + 1;
            i = w - 1;
        }
    } else {
        j = 0;
        if(i >= w) {
            j += i - w + 1;
            i = w - 1;
        }
    }
    while (i >= 0 && j >= 0 && j < h) {
        if (d) --j;
        else ++j;
        --i;
        v.push_back (pti(i, j));
    }
    return v;
}

int amatmata (int k) {
    vector<int> v;
    d = add_or({c0});
    for(int i = 0; i < w + h - 1; ++i) {
        d = add_or ({d, md (i - k, 0)});
        v.push_back (add_and ({d, md (i, 0)}));
    }
    d = add_or({c0});
    for(int i = 0; i < w + h - 1; ++i) {
        d = add_or({d, md (i - k, 1)});
        v.push_back(add_and ({d, md (i, 1)}));
    }
    return add_or(v);
}

void contruct_network (int H, int W, int K) {
    if (H * W == 2) {
        add_or ({0});
        return;
    }
    c0 = add_and ({0, 1, 2});
    c1 = add_not (c0);
    h = H;
    w = W;
    add_and({amatmata (K), add_not (amatmata (K + 1))});
}

Compilation message

vision.cpp: In function 'int amatmata(int)':
vision.cpp:42:39: error: could not convert '{d, md(int, int)(0)}' from '<brace-enclosed initializer list>' to 'std::vector<int>'
         d = add_or ({d, md (i - k, 0)});
                                       ^
vision.cpp:43:45: error: could not convert '{d, md(int, int)(0)}' from '<brace-enclosed initializer list>' to 'std::vector<int>'
         v.push_back (add_and ({d, md (i, 0)}));
                                             ^
vision.cpp:47:38: error: could not convert '{d, md(int, int)(1)}' from '<brace-enclosed initializer list>' to 'std::vector<int>'
         d = add_or({d, md (i - k, 1)});
                                      ^
vision.cpp:48:44: error: could not convert '{d, md(int, int)(1)}' from '<brace-enclosed initializer list>' to 'std::vector<int>'
         v.push_back(add_and ({d, md (i, 1)}));
                                            ^