제출 #40175

#제출 시각아이디문제언어결과실행 시간메모리
40175leejseo전선 연결 (IOI17_wiring)C++11
컴파일 에러
0 ms0 KiB
#include "wiring.h" #include <algorithm> long long min_total_length(std::vector<int> r, std::vector<int> b) { n = r.size(); m = b.size(); bool a = true; for (int i=0; i<n; i++){ if (r[i] >= b){ a = false; break; } } if (a){ long long ans = 0; for (int i=0; i<n; i++){ ans += r[n-1] - r[i]; } for (int i=0; i<m; i++){ ans += b[i] - b[0]; } ans += std::max(n, m) * (b[0]-r[n-1]); return ans; } return 0; }

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

wiring.cpp: In function 'long long int min_total_length(std::vector<int>, std::vector<int>)':
wiring.cpp:5:2: error: 'n' was not declared in this scope
  n = r.size();
  ^
wiring.cpp:6:2: error: 'm' was not declared in this scope
  m = b.size();
  ^
wiring.cpp:9:18: error: no match for 'operator>=' (operand types are '__gnu_cxx::__alloc_traits<std::allocator<int> >::value_type {aka int}' and 'std::vector<int>')
         if (r[i] >= b){
                  ^
In file included from /usr/include/c++/5/string:52:0,
                 from /usr/include/c++/5/random:40,
                 from /usr/include/c++/5/bits/stl_algo.h:66,
                 from /usr/include/c++/5/algorithm:62,
                 from wiring.cpp:2:
/usr/include/c++/5/bits/basic_string.h:5122:5: note: candidate: template<class _CharT, class _Traits, class _Alloc> bool std::operator>=(const _CharT*, const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&)
     operator>=(const _CharT* __lhs,
     ^
/usr/include/c++/5/bits/basic_string.h:5122:5: note:   template argument deduction/substitution failed:
wiring.cpp:9:21: note:   mismatched types 'const _CharT*' and 'int'
         if (r[i] >= b){
                     ^
In file included from /usr/include/c++/5/string:52:0,
                 from /usr/include/c++/5/random:40,
                 from /usr/include/c++/5/bits/stl_algo.h:66,
                 from /usr/include/c++/5/algorithm:62,
                 from wiring.cpp:2:
/usr/include/c++/5/bits/basic_string.h:5110:5: note: candidate: template<class _CharT, class _Traits, class _Alloc> bool std::operator>=(const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&, const _CharT*)
     operator>=(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
     ^
/usr/include/c++/5/bits/basic_string.h:5110:5: note:   template argument deduction/substitution failed:
wiring.cpp:9:21: note:   mismatched types 'const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>' and '__gnu_cxx::__alloc_traits<std::allocator<int> >::value_type {aka int}'
         if (r[i] >= b){
                     ^
In file included from /usr/include/c++/5/string:52:0,
                 from /usr/include/c++/5/random:40,
                 from /usr/include/c++/5/bits/stl_algo.h:66,
                 from /usr/include/c++/5/algorithm:62,
                 from wiring.cpp:2:
/usr/include/c++/5/bits/basic_string.h:5098:5: note: candidate: template<class _CharT, class _Traits, class _Alloc> bool std::operator>=(const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&, const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&)
     operator>=(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
     ^
/usr/include/c++/5/bits/basic_string.h:5098:5: note:   template argument deduction/substitution failed:
wiring.cpp:9:21: note:   mismatched types 'const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>' and '__gnu_cxx::__alloc_traits<std::allocator<int> >::value_type {aka int}'
         if (r[i] >= b){
                     ^
In file included from /usr/include/c++/5/vector:64:0,
                 from wiring.h:1,
                 from wiring.cpp:1:
/usr/include/c++/5/bits/stl_vector.h:1553:5: note: candidate: template<class _Tp, class _Alloc> bool std::operator>=(const std::vector<_Tp, _Alloc>&, const std::vector<_Tp, _Alloc>&)
     operator>=(const vector<_Tp, _Alloc>& __x, const vector<_Tp, _Alloc>& __y)
     ^
/usr/include/c++/5/bits/stl_vector.h:1553:5: note:   template argument deduction/substitution failed:
wiring.cpp:9:21: note:   mismatched types 'const std::vector<_Tp, _Alloc>' and '__gnu_cxx::__alloc_traits<std::allocator<int> >::value_type {aka int}'
         if (r[i] >= b){
                     ^
In file included from /usr/include/c++/5/bits/stl_algobase.h:67:0,
                 from /usr/include/c++/5/vector:60,
                 from wiring.h:1,
                 from wiring.cpp:1:
/usr/include/c++/5/bits/stl_iterator.h:1131:5: note: candidate: template<class _Iterator> bool std::operator>=(const std::move_iterator<_Iterator>&, const std::move_iterator<_Iterator>&)
     operator>=(const move_iterator<_Iterator>& __x,
     ^
/usr/include/c++/5/bits/stl_iterator.h:1131:5: note:   template argument deduction/substitution failed:
wiring.cpp:9:21: note:   mismatched types 'const std::move_iterator<_Iterator>' and '__gnu_cxx::__alloc_traits<std::allocator<int> >::value_type {aka int}'
         if (r[i] >= b){
                     ^
In file included from /usr/include/c++/5/bits/stl_algobase.h:67:0,
                 from /usr/include/c++/5/vector:60,
                 from wiring.h:1,
                 from wiring.cpp:1:
/usr/include/c++/5/bits/stl_iterator.h:1125:5: note: candidate: template<class _IteratorL, class _IteratorR> bool std::operator>=(const std::move_iterator<_Iterator>&, const std::move_iterator<_IteratorR>&)
     operator>=(const move_iterator<_IteratorL>& __x,
     ^
/usr/include/c++/5/bits/stl_iterator.h:1125:5: note:   template argument deduction/substitution failed:
wiring.cpp:9:21: note:   mismatched types 'const std::move_iterator<_Iterator>' and '__gnu_cxx::__alloc_traits<std::allocator<int> >::value_type {aka int}'
         if (r[i] >= b){
                     ^
In file included from /usr/include/c++/5/bits/stl_algobase.h:67:0,
                 from /usr/include/c++/5/vector:60,
                 from wiring.h:1,
                 from wiring.cpp:1:
/usr/include/c++/5/bits/stl_iterator.h:372:5: note: candidate: template<class _IteratorL, class _IteratorR> bool std::operator>=(const std::reverse_iterator<_Iterator>&, const std::reverse_iterator<_IteratorR>&)
     operator>=(const reverse_iterator<_IteratorL>& __x,
     ^
/usr/include/c++/5/bits/stl_iterator.h:372:5: note:   template argument deduction/substitution failed:
wiring.cpp:9:21: note:   mismatched types 'const std::reverse_iterator<_Iterator>' and '__gnu_cxx::__alloc_traits<std::allocator<int> >::value_type {aka int}'
         if (r[i] >= b){
                     ^
In file included from /usr/include/c++/5/bits/stl_algobase.h:67:0,
                 from /usr/include/c++/5/vector:60,
                 from wiring.h:1,
                 from wiring.cpp:1:
/usr/include/c++/5/bits/stl_iterator.h:322:5: note: candidate: template<class _Iterator> bool std::operator>=(const std::reverse_iterator<_Iterator>&, const std::reverse_iterator<_Iterator>&)
     operator>=(const reverse_iterator<_Iterator>& __x,
     ^
/usr/include/c++/5/bits/stl_iterator.h:322:5: note:   template argument deduction/substitution failed:
wiring.cpp:9:21: note:   mismatched types 'const std::reverse_iterator<_Iterator>' and '__gnu_cxx::__alloc_traits<std::allocator<int> >::value_type {aka int}'
         if (r[i] >= b){
                     ^
In file included from /usr/include/c++/5/bits/stl_algobase.h:64:0,
                 from /usr/include/c++/5/vector:60,
                 from wiring.h:1,
                 from wiring.cpp:1:
/usr/include/c++/5/bits/stl_pair.h:245:5: note: candidate: template<class _T1, class _T2> constexpr bool std::operator>=(const std::pair<_T1, _T2>&, const std::pair<_T1, _T2>&)
     operator>=(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
     ^
/usr/include/c++/5/bits/stl_pair.h:245:5: note:   template argument deduction/substitution failed:
wiring.cpp:9:21: note:   mismatched types 'const std::pair<_T1, _T2>' and '__gnu_cxx::__alloc_traits<std::allocator<int> >::value_type {aka int}'
         if (r[i] >= b){
                     ^
In file included from /usr/include/c++/5/bits/stl_algobase.h:67:0,
                 from /usr/include/c++/5/vector:60,
                 from wiring.h:1,
                 from wiring.cpp:1:
/usr/include/c++/5/bits/stl_iterator.h:898:5: note: candidate: template<class _Iterator, class _Container> bool __gnu_cxx::operator>=(const __gnu_cxx::__normal_iterator<_Iterator, _Container>&, const __gnu_cxx::__normal_iterator<_Iterator, _Container>&)
     operator>=(const __normal_iterator<_Iterator, _Container>& __lhs,
     ^
/usr/include/c++/5/bits/stl_iterator.h:898:5: note:   template argument deduction/substitution failed:
wiring.cpp:9:21: note:   mismatched types 'const __gnu_cxx::__normal_iterator<_Iterator, _Container>' and '__gnu_cxx::__alloc_traits<std::allocator<int> >::value_type {aka int}'
         if (r[i] >= b){
                     ^
In file included from /usr/include/c++/5/bits/stl_algobase.h:67:0,
                 from /usr/include/c++/5/vector:60,
                 from wiring.h:1,
                 from wiring.cpp:1:
/usr/include/c++/5/bits/stl_iterator.h:891:5: note: candidate: template<class _IteratorL, class _IteratorR, class _Container> bool __gnu_cxx::operator>=(const __gnu_cxx::__normal_iterator<_IteratorL, _Container>&, const __gnu_cxx::__normal_iterator<_IteratorR, _Container>&)
     operator>=(const __normal_iterator<_IteratorL, _Container>& __lhs,
     ^
/usr/include/c++/5/bits/stl_iterator.h:891:5: note:   template argument deduction/substitution failed:
wiring.cpp:9:21: note:   mismatched types 'const __gnu_cxx::__normal_iterator<_IteratorL, _Container>' and '__gnu_cxx::__alloc_traits<std::allocator<int> >::value_type {aka int}'
         if (r[i] >= b){
                     ^