제출 #502723

#제출 시각아이디문제언어결과실행 시간메모리
502723wind_reaperVision Program (IOI19_vision)C++17
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> #include "vision.h" using namespace std; int check(int H, int W, int K){ vector<int> add[401], sub[401]; for(int i = 0; i < H; i++) for(int j = 0; j < W; j++){ add[i+j].push_back(i*W + j); sub[i - j + W - 1].push_back(i*W + j); } vector<int> xadd, pxadd, xsub, pxsub, res; for(int d = 0; d < H + W - 2; d++){ xadd.push_back(add_xor(add[d])); pxadd.push_back(add_xor(xadd)); xsub.push_back(add_xor(sub[d])); pxsub.push_back(add_xor(xsub)); if(d >= K){ res.push_back(add_and(xadd[d], pxadd[d-K])); res.push_back(add_and(xsub[d], pxsub[d-K])); } } return add_or(res); } void construct_network(int H, int W, int K){ if(K == H + W - 2) check(H, W, K); else add_xor({check(H, W, K), check(H, W, K + 1)}); }

컴파일 시 표준 에러 (stderr) 메시지

vision.cpp: In function 'int check(int, int, int)':
vision.cpp:25:45: error: could not convert 'xadd.std::vector<int>::operator[](((std::vector<int>::size_type)d))' from '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'} to 'std::vector<int>'
   25 |    res.push_back(add_and(xadd[d], pxadd[d-K]));
      |                                             ^
      |                                             |
      |                                             __gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type {aka int}
vision.cpp:26:45: error: could not convert 'xsub.std::vector<int>::operator[](((std::vector<int>::size_type)d))' from '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'} to 'std::vector<int>'
   26 |    res.push_back(add_and(xsub[d], pxsub[d-K]));
      |                                             ^
      |                                             |
      |                                             __gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type {aka int}