실행 실패 (제출 코드 컴파일 에러)
Main.cpp: In function ‘int main()’: Main.cpp:22:50: error: no match for ‘operator+’ (operand types are ‘std::vector<int>::iterator’ and ‘__gnu_cxx::__normal_iterator<int*, std::vector<int> >’) 22 | int dist = distance(v.begin(), v.begin() + it); | ~~~~~~~~~ ^ ~~ | | | | | __normal_iterator<[...],[...]> | __normal_iterator<[...],[...]> In file included from /usr/include/c++/11/bits/stl_algobase.h:67, from /usr/include/c++/11/bits/char_traits.h:39, from /usr/include/c++/11/ios:40, from /usr/include/c++/11/ostream:38, from /usr/include/c++/11/iostream:39, from Main.cpp:1: /usr/include/c++/11/bits/stl_iterator.h:1090:7: note: candidate: ‘constexpr __gnu_cxx::__normal_iterator<_Iterator, _Container> __gnu_cxx::__normal_iterator<_Iterator, _Container>::operator+(__gnu_cxx::__normal_iterator<_Iterator, _Container>::difference_type) const [with _Iterator = int*; _Container = std::vector<int>; __gnu_cxx::__normal_iterator<_Iterator, _Container>::difference_type = long int]’ 1090 | operator+(difference_type __n) const _GLIBCXX_NOEXCEPT | ^~~~~~~~ /usr/include/c++/11/bits/stl_iterator.h:1090:33: note: no known conversion for argument 1 from ‘__gnu_cxx::__normal_iterator<int*, std::vector<int> >’ to ‘__gnu_cxx::__normal_iterator<int*, std::vector<int> >::difference_type’ {aka ‘long int’} 1090 | operator+(difference_type __n) const _GLIBCXX_NOEXCEPT | ~~~~~~~~~~~~~~~~^~~ /usr/include/c++/11/bits/stl_iterator.h:585:5: note: candidate: ‘template<class _Iterator> constexpr std::reverse_iterator<_IteratorL> std::operator+(typename std::reverse_iterator<_IteratorL>::difference_type, const std::reverse_iterator<_IteratorL>&)’ 585 | operator+(typename reverse_iterator<_Iterator>::difference_type __n, | ^~~~~~~~ /usr/include/c++/11/bits/stl_iterator.h:585:5: note: template argument deduction/substitution failed: Main.cpp:22:52: note: ‘__gnu_cxx::__normal_iterator<int*, std::vector<int> >’ is not derived from ‘const std::reverse_iterator<_IteratorL>’ 22 | int dist = distance(v.begin(), v.begin() + it); | ^~ In file included from /usr/include/c++/11/bits/stl_algobase.h:67, from /usr/include/c++/11/bits/char_traits.h:39, from /usr/include/c++/11/ios:40, from /usr/include/c++/11/ostream:38, from /usr/include/c++/11/iostream:39, from Main.cpp:1: /usr/include/c++/11/bits/stl_iterator.h:1700:5: note: candidate: ‘template<class _Iterator> constexpr std::move_iterator<_IteratorL> std::operator+(typename std::move_iterator<_IteratorL>::difference_type, const std::move_iterator<_IteratorL>&)’ 1700 | operator+(typename move_iterator<_Iterator>::difference_type __n, | ^~~~~~~~ /usr/include/c++/11/bits/stl_iterator.h:1700:5: note: template argument deduction/substitution failed: Main.cpp:22:52: note: ‘__gnu_cxx::__normal_iterator<int*, std::vector<int> >’ is not derived from ‘const std::move_iterator<_IteratorL>’ 22 | int dist = distance(v.begin(), v.begin() + it); | ^~ In file included from /usr/include/c++/11/string:55, from /usr/include/c++/11/bits/locale_classes.h:40, from /usr/include/c++/11/bits/ios_base.h:41, from /usr/include/c++/11/ios:42, from /usr/include/c++/11/ostream:38, from /usr/include/c++/11/iostream:39, from Main.cpp:1: /usr/include/c++/11/bits/basic_string.h:6095:5: note: candidate: ‘template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>&, const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>&)’ 6095 | operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/11/bits/basic_string.h:6095:5: note: template argument deduction/substitution failed: Main.cpp:22:52: note: ‘std::vector<int>::iterator’ is not derived from ‘const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>’ 22 | int dist = distance(v.begin(), v.begin() + it); | ^~ In file included from /usr/include/c++/11/string:56, from /usr/include/c++/11/bits/locale_classes.h:40, from /usr/include/c++/11/bits/ios_base.h:41, from /usr/include/c++/11/ios:42, from /usr/include/c++/11/ostream:38, from /usr/include/c++/11/iostream:39, from Main.cpp:1: /usr/include/c++/11/bits/basic_string.tcc:1169:5: note: candidate: ‘template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const _CharT*, const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>&)’ 1169 | operator+(const _CharT* __lhs, | ^~~~~~~~ /usr/include/c++/11/bits/basic_string.tcc:1169:5: note: template argument deduction/substitution failed: Main.cpp:22:52: note: mismatched types ‘const _CharT*’ and ‘__gnu_cxx::__normal_iterator<int*, std::vector<int> >’ 22 | int dist = distance(v.begin(), v.begin() + it); | ^~ In file included from /usr/include/c++/11/string:56, from /usr/include/c++/11/bits/locale_classes.h:40, from /usr/include/c++/11/bits/ios_base.h:41, from /usr/include/c++/11/ios:42, from /usr/include/c++/11/ostream:38, from /usr/include/c++/11/iostream:39, from Main.cpp:1: /usr/include/c++/11/bits/basic_string.tcc:1189:5: note: candidate: ‘template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(_CharT, const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>&)’ 1189 | operator+(_CharT __lhs, const basic_string<_CharT, _Traits, _Alloc>& __rhs) | ^~~~~~~~ /usr/include/c++/11/bits/basic_string.tcc:1189:5: note: template argument deduction/substitution failed: Main.cpp:22:52: note: ‘__gnu_cxx::__normal_iterator<int*, std::vector<int> >’ is not derived from ‘const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>’ 22 | int dist = distance(v.begin(), v.begin() + it); | ^~ In file included from /usr/include/c++/11/string:55, from /usr/include/c++/11/bits/locale_classes.h:40, from /usr/include/c++/11/bits/ios_base.h:41, from /usr/include/c++/11/ios:42, from /usr/include/c++/11/ostream:38, from /usr/include/c++/11/iostream:39, from Main.cpp:1: /usr/include/c++/11/bits/basic_string.h:6132:5: note: candidate: ‘template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>&, const _CharT*)’ 6132 | operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/11/bits/basic_string.h:6132:5: note: template argument deduction/substitution failed: Main.cpp:22:52: note: ‘std::vector<int>::iterator’ is not derived from ‘const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>’ 22 | int dist = distance(v.begin(), v.begin() + it); | ^~ In file included from /usr/include/c++/11/string:55, from /usr/include/c++/11/bits/locale_classes.h:40, from /usr/include/c++/11/bits/ios_base.h:41, from /usr/include/c++/11/ios:42, from /usr/include/c++/11/ostream:38, from /usr/include/c++/11/iostream:39, from Main.cpp:1: /usr/include/c++/11/bits/basic_string.h:6148:5: note: candidate: ‘template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>&, _CharT)’ 6148 | operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs, _CharT __rhs) | ^~~~~~~~ /usr/include/c++/11/bits/basic_string.h:6148:5: note: template argument deduction/substitution failed: Main.cpp:22:52: note: ‘std::vector<int>::iterator’ is not derived from ‘const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>’ 22 | int dist = distance(v.begin(), v.begin() + it); | ^~ In file included from /usr/include/c++/11/string:55, from /usr/include/c++/11/bits/locale_classes.h:40, from /usr/include/c++/11/bits/ios_base.h:41, from /usr/include/c++/11/ios:42, from /usr/include/c++/11/ostream:38, from /usr/include/c++/11/iostream:39, from Main.cpp:1: /usr/include/c++/11/bits/basic_string.h:6160:5: note: candidate: ‘template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(std::__cxx11::basic_string<_CharT, _Traits, _Allocator>&&, const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>&)’ 6160 | operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs, | ^~~~~~~~ /usr/include/c++/11/bits/basic_string.h:6160:5: note: template argument deduction/substitution failed: Main.cpp:22:52: note: ‘std::vector<int>::iterator’ is not derived from ‘std::__cxx11::basic_string<_CharT, _Traits, _Allocator>’ 22 | int dist = distance(v.begin(), v.begin() + it); | ^~ In file included from /usr/include/c++/11/string:55, from /usr/include/c++/11/bits/locale_classes.h:40, from /usr/include/c++/11/bits/ios_base.h:41, from /usr/include/c++/11/ios:42, from /usr/include/c++/11/ostream:38, from /usr/include/c++/11/iostream:39, from Main.cpp:1: /usr/include/c++/11/bits/basic_string.h:6166:5: note: candidate: ‘template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>&, std::__cxx11::basic_string<_CharT, _Traits, _Allocator>&&)’ 6166 | operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/11/bits/basic_string.h:6166:5: note: template argument deduction/substitution failed: Main.cpp:22:52: note: ‘std::vector<int>::iterator’ is not derived from ‘const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>’ 22 | int dist = distance(v.begin(), v.begin() + it); | ^~ In file included from /usr/include/c++/11/string:55, from /usr/include/c++/11/bits/locale_classes.h:40, from /usr/include/c++/11/bits/ios_base.h:41, from /usr/include/c++/11/ios:42, from /usr/include/c++/11/ostream:38, from /usr/include/c++/11/iostream:39, from Main.cpp:1: /usr/include/c++/11/bits/basic_string.h:6172:5: note: candidate: ‘template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(std::__cxx11::basic_string<_CharT, _Traits, _Allocator>&&, std::__cxx11::basic_string<_CharT, _Traits, _Allocator>&&)’ 6172 | operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs, | ^~~~~~~~ /usr/include/c++/11/bits/basic_string.h:6172:5: note: template argument deduction/substitution failed: Main.cpp:22:52: note: ‘std::vector<int>::iterator’ is not derived from ‘std::__cxx11::basic_string<_CharT, _Traits, _Allocator>’ 22 | int dist = distance(v.begin(), v.begin() + it); | ^~ In file included from /usr/include/c++/11/string:55, from /usr/include/c++/11/bits/locale_classes.h:40, from /usr/include/c++/11/bits/ios_base.h:41, from /usr/include/c++/11/ios:42, from /usr/include/c++/11/ostream:38, from /usr/include/c++/11/iostream:39, from Main.cpp:1: /usr/include/c++/11/bits/basic_string.h:6194:5: note: candidate: ‘template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const _CharT*, std::__cxx11::basic_string<_CharT, _Traits, _Allocator>&&)’ 6194 | operator+(const _CharT* __lhs, | ^~~~~~~~ /usr/include/c++/11/bits/basic_string.h:6194:5: note: template argument deduction/substitution failed: Main.cpp:22:52: note: mismatched types ‘const _CharT*’ and ‘__gnu_cxx::__normal_iterator<int*, std::vector<int> >’ 22 | int dist = distance(v.begin(), v.begin() + it); | ^~ In file included from /usr/include/c++/11/string:55, from /usr/include/c++/11/bits/locale_classes.h:40, from /usr/include/c++/11/bits/ios_base.h:41, from /usr/include/c++/11/ios:42, from /usr/include/c++/11/ostream:38, from /usr/include/c++/11/iostream:39, from Main.cpp:1: /usr/include/c++/11/bits/basic_string.h:6200:5: note: candidate: ‘template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(_CharT, std::__cxx11::basic_string<_CharT, _Traits, _Allocator>&&)’ 6200 | operator+(_CharT __lhs, | ^~~~~~~~ /usr/include/c++/11/bits/basic_string.h:6200:5: note: template argument deduction/substitution failed: Main.cpp:22:52: note: ‘__gnu_cxx::__normal_iterator<int*, std::vector<int> >’ is not derived from ‘std::__cxx11::basic_string<_CharT, _Traits, _Allocator>’ 22 | int dist = distance(v.begin(), v.begin() + it); | ^~ In file included from /usr/include/c++/11/string:55, from /usr/include/c++/11/bits/locale_classes.h:40, from /usr/include/c++/11/bits/ios_base.h:41, from /usr/include/c++/11/ios:42, from /usr/include/c++/11/ostream:38, from /usr/include/c++/11/iostream:39, from Main.cpp:1: /usr/include/c++/11/bits/basic_string.h:6206:5: note: candidate: ‘template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(std::__cxx11::basic_string<_CharT, _Traits, _Allocator>&&, const _CharT*)’ 6206 | operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs, | ^~~~~~~~ /usr/include/c++/11/bits/basic_string.h:6206:5: note: template argument deduction/substitution failed: Main.cpp:22:52: note: ‘std::vector<int>::iterator’ is not derived from ‘std::__cxx11::basic_string<_CharT, _Traits, _Allocator>’ 22 | int dist = distance(v.begin(), v.begin() + it); | ^~ In file included from /usr/include/c++/11/string:55, from /usr/include/c++/11/bits/locale_classes.h:40, from /usr/include/c++/11/bits/ios_base.h:41, from /usr/include/c++/11/ios:42, from /usr/include/c++/11/ostream:38, from /usr/include/c++/11/iostream:39, from Main.cpp:1: /usr/include/c++/11/bits/basic_string.h:6212:5: note: candidate: ‘template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(std::__cxx11::basic_string<_CharT, _Traits, _Allocator>&&, _CharT)’ 6212 | operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs, | ^~~~~~~~ /usr/include/c++/11/bits/basic_string.h:6212:5: note: template argument deduction/substitution failed: Main.cpp:22:52: note: ‘std::vector<int>::iterator’ is not derived from ‘std::__cxx11::basic_string<_CharT, _Traits, _Allocator>’ 22 | int dist = distance(v.begin(), v.begin() + it); | ^~ In file included from /usr/include/c++/11/bits/stl_algobase.h:67, from /usr/include/c++/11/bits/char_traits.h:39, from /usr/include/c++/11/ios:40, from /usr/include/c++/11/ostream:38, from /usr/include/c++/11/iostream:39, from Main.cpp:1: /usr/include/c++/11/bits/stl_iterator.h:1276:5: note: candidate: ‘constexpr __gnu_cxx::__normal_iterator<_Iterator, _Container> __gnu_cxx::operator+(typename __gnu_cxx::__normal_iterator<_Iterator, _Container>::difference_type, const __gnu_cxx::__normal_iterator<_Iterator, _Container>&) [with _Iterator = int*; _Container = std::vector<int>; typename __gnu_cxx::__normal_iterator<_Iterator, _Container>::difference_type = long int]’ 1276 | operator+(typename __normal_iterator<_Iterator, _Container>::difference_type | ^~~~~~~~ /usr/include/c++/11/bits/stl_iterator.h:1277:15: note: no known conversion for argument 1 from ‘std::vector<int>::iterator’ to ‘__gnu_cxx::__normal_iterator<int*, std::vector<int> >::difference_type’ {aka ‘long int’} 1276 | operator+(typename __normal_iterator<_Iterator, _Container>::difference_type | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1277 | __n, const __normal_iterator<_Iterator, _Container>& __i) | ^~~
정답 개수:
-
틀린 개수:
-
실행 실패 개수:
-
반례를 발견하지 못했습니다.