답안 #282834

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
282834 2020-08-25T04:05:25 Z muhammad_hokimiyon Vision Program (IOI19_vision) C++14
컴파일 오류
0 ms 0 KB
#include "vision.h"
#include <bits/stdc++.h>

using namespace std;

int dist( int x1 , int y1 , int x2 , int y2 )
{
    return abs(x1 - x2) + abs(y1 - y2);
}

void construct_network(int H, int W, int K)
{
    int n = H;
    int m = W;
    vector < pair < int , int > > ask;
	for( int i = 0; i < n; i++ ){
        for( int j = 0; j < m; j++ ){
            for( int h = i; h < n; h++ ){
                for( int g = 0; g < m; g++ ){
                    int x = dist( i , j , h , g );
                    if( x == K ){
                        vector < int > g;
                        g.push_back( i * m + j );
                        g.push_back( h * m + g );
                        ask.push_back( add_and(g) );
                    }
                }
            }
        }
	}
	vector < int > g;
	for( int i = n * m; i < n * m + (int)ask.size(); i++ ){
        g.push_back(i);
	}
	int ans = add_or( g );
}

Compilation message

vision.cpp: In function 'void construct_network(int, int, int)':
vision.cpp:24:44: error: no match for 'operator+' (operand types are 'int' and 'std::vector<int>')
   24 |                         g.push_back( h * m + g );
      |                                      ~~~~~ ^ ~
      |                                        |     |
      |                                        int   std::vector<int>
In file included from /usr/include/c++/9/bits/stl_algobase.h:67,
                 from /usr/include/c++/9/vector:60,
                 from vision.h:5,
                 from vision.cpp:1:
/usr/include/c++/9/bits/stl_iterator.h:423:5: note: candidate: 'template<class _Iterator> std::reverse_iterator<_Iterator> std::operator+(typename std::reverse_iterator<_Iterator>::difference_type, const std::reverse_iterator<_Iterator>&)'
  423 |     operator+(typename reverse_iterator<_Iterator>::difference_type __n,
      |     ^~~~~~~~
/usr/include/c++/9/bits/stl_iterator.h:423:5: note:   template argument deduction/substitution failed:
vision.cpp:24:46: note:   'std::vector<int>' is not derived from 'const std::reverse_iterator<_Iterator>'
   24 |                         g.push_back( h * m + g );
      |                                              ^
In file included from /usr/include/c++/9/bits/stl_algobase.h:67,
                 from /usr/include/c++/9/vector:60,
                 from vision.h:5,
                 from vision.cpp:1:
/usr/include/c++/9/bits/stl_iterator.h:1219:5: note: candidate: 'template<class _Iterator> std::move_iterator<_IteratorL> std::operator+(typename std::move_iterator<_IteratorL>::difference_type, const std::move_iterator<_IteratorL>&)'
 1219 |     operator+(typename move_iterator<_Iterator>::difference_type __n,
      |     ^~~~~~~~
/usr/include/c++/9/bits/stl_iterator.h:1219:5: note:   template argument deduction/substitution failed:
vision.cpp:24:46: note:   'std::vector<int>' is not derived from 'const std::move_iterator<_IteratorL>'
   24 |                         g.push_back( h * m + g );
      |                                              ^
In file included from /usr/include/c++/9/vector:68,
                 from vision.h:5,
                 from vision.cpp:1:
/usr/include/c++/9/bits/stl_bvector.h:303:3: note: candidate: 'std::_Bit_iterator std::operator+(std::ptrdiff_t, const std::_Bit_iterator&)'
  303 |   operator+(ptrdiff_t __n, const _Bit_iterator& __x)
      |   ^~~~~~~~
/usr/include/c++/9/bits/stl_bvector.h:303:49: note:   no known conversion for argument 2 from 'std::vector<int>' to 'const std::_Bit_iterator&'
  303 |   operator+(ptrdiff_t __n, const _Bit_iterator& __x)
      |                            ~~~~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/9/bits/stl_bvector.h:393:3: note: candidate: 'std::_Bit_const_iterator std::operator+(std::ptrdiff_t, const std::_Bit_const_iterator&)'
  393 |   operator+(ptrdiff_t __n, const _Bit_const_iterator& __x)
      |   ^~~~~~~~
/usr/include/c++/9/bits/stl_bvector.h:393:55: note:   no known conversion for argument 2 from 'std::vector<int>' to 'const std::_Bit_const_iterator&'
  393 |   operator+(ptrdiff_t __n, const _Bit_const_iterator& __x)
      |                            ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
In file included from /usr/include/c++/9/string:55,
                 from vision.h:6,
                 from vision.cpp:1:
/usr/include/c++/9/bits/basic_string.h:6020:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Alloc> std::operator+(const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&, const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&)'
 6020 |     operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
      |     ^~~~~~~~
/usr/include/c++/9/bits/basic_string.h:6020:5: note:   template argument deduction/substitution failed:
vision.cpp:24:46: note:   mismatched types 'const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>' and 'int'
   24 |                         g.push_back( h * m + g );
      |                                              ^
In file included from /usr/include/c++/9/string:56,
                 from vision.h:6,
                 from vision.cpp:1:
/usr/include/c++/9/bits/basic_string.tcc:1158:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Alloc> std::operator+(const _CharT*, const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&)'
 1158 |     operator+(const _CharT* __lhs,
      |     ^~~~~~~~
/usr/include/c++/9/bits/basic_string.tcc:1158:5: note:   template argument deduction/substitution failed:
vision.cpp:24:46: note:   mismatched types 'const _CharT*' and 'int'
   24 |                         g.push_back( h * m + g );
      |                                              ^
In file included from /usr/include/c++/9/string:56,
                 from vision.h:6,
                 from vision.cpp:1:
/usr/include/c++/9/bits/basic_string.tcc:1174:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Alloc> std::operator+(_CharT, const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&)'
 1174 |     operator+(_CharT __lhs, const basic_string<_CharT, _Traits, _Alloc>& __rhs)
      |     ^~~~~~~~
/usr/include/c++/9/bits/basic_string.tcc:1174:5: note:   template argument deduction/substitution failed:
vision.cpp:24:46: note:   'std::vector<int>' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>'
   24 |                         g.push_back( h * m + g );
      |                                              ^
In file included from /usr/include/c++/9/string:55,
                 from vision.h:6,
                 from vision.cpp:1:
/usr/include/c++/9/bits/basic_string.h:6057:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Alloc> std::operator+(const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&, const _CharT*)'
 6057 |     operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
      |     ^~~~~~~~
/usr/include/c++/9/bits/basic_string.h:6057:5: note:   template argument deduction/substitution failed:
vision.cpp:24:46: note:   mismatched types 'const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>' and 'int'
   24 |                         g.push_back( h * m + g );
      |                                              ^
In file included from /usr/include/c++/9/string:55,
                 from vision.h:6,
                 from vision.cpp:1:
/usr/include/c++/9/bits/basic_string.h:6073:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Alloc> std::operator+(const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&, _CharT)'
 6073 |     operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs, _CharT __rhs)
      |     ^~~~~~~~
/usr/include/c++/9/bits/basic_string.h:6073:5: note:   template argument deduction/substitution failed:
vision.cpp:24:46: note:   mismatched types 'const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>' and 'int'
   24 |                         g.push_back( h * m + g );
      |                                              ^
In file included from /usr/include/c++/9/string:55,
                 from vision.h:6,
                 from vision.cpp:1:
/usr/include/c++/9/bits/basic_string.h:6085:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Alloc> std::operator+(std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&&, const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&)'
 6085 |     operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs,
      |     ^~~~~~~~
/usr/include/c++/9/bits/basic_string.h:6085:5: note:   template argument deduction/substitution failed:
vision.cpp:24:46: note:   mismatched types 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>' and 'int'
   24 |                         g.push_back( h * m + g );
      |                                              ^
In file included from /usr/include/c++/9/string:55,
                 from vision.h:6,
                 from vision.cpp:1:
/usr/include/c++/9/bits/basic_string.h:6091:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Alloc> std::operator+(const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&, std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&&)'
 6091 |     operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
      |     ^~~~~~~~
/usr/include/c++/9/bits/basic_string.h:6091:5: note:   template argument deduction/substitution failed:
vision.cpp:24:46: note:   mismatched types 'const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>' and 'int'
   24 |                         g.push_back( h * m + g );
      |                                              ^
In file included from /usr/include/c++/9/string:55,
                 from vision.h:6,
                 from vision.cpp:1:
/usr/include/c++/9/bits/basic_string.h:6097:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Alloc> std::operator+(std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&&, std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&&)'
 6097 |     operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs,
      |     ^~~~~~~~
/usr/include/c++/9/bits/basic_string.h:6097:5: note:   template argument deduction/substitution failed:
vision.cpp:24:46: note:   mismatched types 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>' and 'int'
   24 |                         g.push_back( h * m + g );
      |                                              ^
In file included from /usr/include/c++/9/string:55,
                 from vision.h:6,
                 from vision.cpp:1:
/usr/include/c++/9/bits/basic_string.h:6109:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Alloc> std::operator+(const _CharT*, std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&&)'
 6109 |     operator+(const _CharT* __lhs,
      |     ^~~~~~~~
/usr/include/c++/9/bits/basic_string.h:6109:5: note:   template argument deduction/substitution failed:
vision.cpp:24:46: note:   mismatched types 'const _CharT*' and 'int'
   24 |                         g.push_back( h * m + g );
      |                                              ^
In file included from /usr/include/c++/9/string:55,
                 from vision.h:6,
                 from vision.cpp:1:
/usr/include/c++/9/bits/basic_string.h:6115:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Alloc> std::operator+(_CharT, std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&&)'
 6115 |     operator+(_CharT __lhs,
      |     ^~~~~~~~
/usr/include/c++/9/bits/basic_string.h:6115:5: note:   template argument deduction/substitution failed:
vision.cpp:24:46: note:   'std::vector<int>' is not derived from 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>'
   24 |                         g.push_back( h * m + g );
      |                                              ^
In file included from /usr/include/c++/9/string:55,
                 from vision.h:6,
                 from vision.cpp:1:
/usr/include/c++/9/bits/basic_string.h:6121:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Alloc> std::operator+(std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&&, const _CharT*)'
 6121 |     operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs,
      |     ^~~~~~~~
/usr/include/c++/9/bits/basic_string.h:6121:5: note:   template argument deduction/substitution failed:
vision.cpp:24:46: note:   mismatched types 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>' and 'int'
   24 |                         g.push_back( h * m + g );
      |                                              ^
In file included from /usr/include/c++/9/string:55,
                 from vision.h:6,
                 from vision.cpp:1:
/usr/include/c++/9/bits/basic_string.h:6127:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Alloc> std::operator+(std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&&, _CharT)'
 6127 |     operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs,
      |     ^~~~~~~~
/usr/include/c++/9/bits/basic_string.h:6127:5: note:   template argument deduction/substitution failed:
vision.cpp:24:46: note:   mismatched types 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>' and 'int'
   24 |                         g.push_back( h * m + g );
      |                                              ^
In file included from /usr/include/c++/9/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:54,
                 from vision.cpp:2:
/usr/include/c++/9/complex:327:5: note: candidate: 'template<class _Tp> std::complex<_Tp> std::operator+(const std::complex<_Tp>&, const std::complex<_Tp>&)'
  327 |     operator+(const complex<_Tp>& __x, const complex<_Tp>& __y)
      |     ^~~~~~~~
/usr/include/c++/9/complex:327:5: note:   template argument deduction/substitution failed:
vision.cpp:24:46: note:   mismatched types 'const std::complex<_Tp>' and 'int'
   24 |                         g.push_back( h * m + g );
      |                                              ^
In file included from /usr/include/c++/9/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:54,
                 from vision.cpp:2:
/usr/include/c++/9/complex:336:5: note: candidate: 'template<class _Tp> std::complex<_Tp> std::operator+(const std::complex<_Tp>&, const _Tp&)'
  336 |     operator+(const complex<_Tp>& __x, const _Tp& __y)
      |     ^~~~~~~~
/usr/include/c++/9/complex:336:5: note:   template argument deduction/substitution failed:
vision.cpp:24:46: note:   mismatched types 'const std::complex<_Tp>' and 'int'
   24 |                         g.push_back( h * m + g );
      |                                              ^
In file included from /usr/include/c++/9/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:54,
                 from vision.cpp:2:
/usr/include/c++/9/complex:345:5: note: candidate: 'template<class _Tp> std::complex<_Tp> std::operator+(const _Tp&, const std::complex<_Tp>&)'
  345 |     operator+(const _Tp& __x, const complex<_Tp>& __y)
      |     ^~~~~~~~
/usr/include/c++/9/complex:345:5: note:   template argument deduction/substitution failed:
vision.cpp:24:46: note:   'std::vector<int>' is not derived from 'const std::complex<_Tp>'
   24 |                         g.push_back( h * m + g );
      |                                              ^
In file included from /usr/include/c++/9/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:54,
                 from vision.cpp:2:
/usr/include/c++/9/complex:446:5: note: candidate: 'template<class _Tp> std::complex<_Tp> std::operator+(const std::complex<_Tp>&)'
  446 |     operator+(const complex<_Tp>& __x)
      |     ^~~~~~~~
/usr/include/c++/9/complex:446:5: note:   template argument deduction/substitution failed:
vision.cpp:24:46: note:   mismatched types 'const std::complex<_Tp>' and 'int'
   24 |                         g.push_back( h * m + g );
      |                                              ^
In file included from /usr/include/c++/9/deque:67,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:68,
                 from vision.cpp:2:
/usr/include/c++/9/bits/stl_deque.h:393:5: note: candidate: 'template<class _Tp, class _Ref, class _Ptr> std::_Deque_iterator<_Tp, _Ref, _Ptr> std::operator+(std::ptrdiff_t, const std::_Deque_iterator<_Tp, _Ref, _Ptr>&)'
  393 |     operator+(ptrdiff_t __n, const _Deque_iterator<_Tp, _Ref, _Ptr>& __x)
      |     ^~~~~~~~
/usr/include/c++/9/bits/stl_deque.h:393:5: note:   template argument deduction/substitution failed:
vision.cpp:24:46: note:   'std::vector<int>' is not derived from 'const std::_Deque_iterator<_Tp, _Ref, _Ptr>'
   24 |                         g.push_back( h * m + g );
      |                                              ^
In file included from /usr/include/c++/9/valarray:603,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:95,
                 from vision.cpp:2:
/usr/include/c++/9/bits/valarray_after.h:405:5: note: candidate: 'template<class _Dom1, class _Dom2> std::_Expr<std::__detail::_BinClos<std::__plus, std::_Expr, std::_Expr, _Dom1, _Dom2>, typename std::__fun<std::__plus, typename _Dom1::value_type>::result_type> std::operator+(const std::_Expr<_Dom1, typename _Dom1::value_type>&, const std::_Expr<_Dom2, typename _Dom2::value_type>&)'
  405 |     _DEFINE_EXPR_BINARY_OPERATOR(+, __plus)
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/9/bits/valarray_after.h:405:5: note:   template argument deduction/substitution failed:
vision.cpp:24:46: note:   mismatched types 'const std::_Expr<_Dom1, typename _Dom1::value_type>' and 'int'
   24 |                         g.push_back( h * m + g );
      |                                              ^
In file included from /usr/include/c++/9/valarray:603,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:95,
                 from vision.cpp:2:
/usr/include/c++/9/bits/valarray_after.h:405:5: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__plus, std::_Expr, std::_Constant, _Dom, typename _Dom::value_type>, typename std::__fun<std::__plus, typename _Dom1::value_type>::result_type> std::operator+(const std::_Expr<_Dom1, typename _Dom1::value_type>&, const typename _Dom::value_type&)'
  405 |     _DEFINE_EXPR_BINARY_OPERATOR(+, __plus)
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/9/bits/valarray_after.h:405:5: note:   template argument deduction/substitution failed:
vision.cpp:24:46: note:   mismatched types 'const std::_Expr<_Dom1, typename _Dom1::value_type>' and 'int'
   24 |                         g.push_back( h * m + g );
      |