제출 #294241

#제출 시각아이디문제언어결과실행 시간메모리
294241Muhammetali모임들 (IOI18_meetings)C++11
컴파일 에러
0 ms0 KiB
#include "meetings.h" #include <bits/stdc++.h> #define mp make_pair #define f first #define s second #define sz(x) (int)(x).size() #define rsz resize #define ins insert #define ft front() #define bk back() #define pf push_front #define pb push_back #define eb emplace_back #define lb lower_bound #define ub upper_bound using namespace std; typedef long long ll; typedef long double ld; typedef pair<int,int> pi; typedef pair<ll,ll> pl; typedef vector<int> vi; typedef vector<bool> vb; typedef vector<ll> vl; typedef vector<pi> vpi; typedef vector<pl> vpl; template<class T>bool tmin(T& a,T b){if(a>b){a=b;return 1;}return 0;} template<class T>bool tmax(T& a,T b){if(a<b){a=b;return 1;}return 0;} vector<int> C; ll jem[5000][5000]; std::vector<long long> minimum_costs(std::vector<int> H, std::vector<int> L,std::vector<int> R) { for (int i=0;i<sz(H);i++) { ll mx=0; for (int j=0;j<i;j++) { mx=max(mx,H[j]); jem[i][j]=mx; } mx=0; for (int j=i;j<=sz(H);j++) { mx=max(mx,H[j]); jem[i][j]=mx; } } for (int i=0;i<sz(L);i++) { ll res=INT_MAX; for (int j=L[i];j<=R[i];j++) { ll sum=0; for (int k=L[i];j<=R[i];j++) { sum+=jem[j][k]; } res=min(res,sum); } C.pb(res); } return C; }

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

meetings.cpp: In function 'std::vector<long long int> minimum_costs(std::vector<int>, std::vector<int>, std::vector<int>)':
meetings.cpp:37:18: error: no matching function for call to 'max(ll&, __gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type&)'
   37 |    mx=max(mx,H[j]);
      |                  ^
In file included from /usr/include/c++/9/vector:60,
                 from meetings.h:3,
                 from meetings.cpp:1:
/usr/include/c++/9/bits/stl_algobase.h:222:5: note: candidate: 'template<class _Tp> const _Tp& std::max(const _Tp&, const _Tp&)'
  222 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/9/bits/stl_algobase.h:222:5: note:   template argument deduction/substitution failed:
meetings.cpp:37:18: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'})
   37 |    mx=max(mx,H[j]);
      |                  ^
In file included from /usr/include/c++/9/vector:60,
                 from meetings.h:3,
                 from meetings.cpp:1:
/usr/include/c++/9/bits/stl_algobase.h:268:5: note: candidate: 'template<class _Tp, class _Compare> const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  268 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/9/bits/stl_algobase.h:268:5: note:   template argument deduction/substitution failed:
meetings.cpp:37:18: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'})
   37 |    mx=max(mx,H[j]);
      |                  ^
In file included from /usr/include/c++/9/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:65,
                 from meetings.cpp:2:
/usr/include/c++/9/bits/stl_algo.h:3456:5: note: candidate: 'template<class _Tp> _Tp std::max(std::initializer_list<_Tp>)'
 3456 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/9/bits/stl_algo.h:3456:5: note:   template argument deduction/substitution failed:
meetings.cpp:37:18: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   37 |    mx=max(mx,H[j]);
      |                  ^
In file included from /usr/include/c++/9/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:65,
                 from meetings.cpp:2:
/usr/include/c++/9/bits/stl_algo.h:3462:5: note: candidate: 'template<class _Tp, class _Compare> _Tp std::max(std::initializer_list<_Tp>, _Compare)'
 3462 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/9/bits/stl_algo.h:3462:5: note:   template argument deduction/substitution failed:
meetings.cpp:37:18: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   37 |    mx=max(mx,H[j]);
      |                  ^
meetings.cpp:43:18: error: no matching function for call to 'max(ll&, __gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type&)'
   43 |    mx=max(mx,H[j]);
      |                  ^
In file included from /usr/include/c++/9/vector:60,
                 from meetings.h:3,
                 from meetings.cpp:1:
/usr/include/c++/9/bits/stl_algobase.h:222:5: note: candidate: 'template<class _Tp> const _Tp& std::max(const _Tp&, const _Tp&)'
  222 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/9/bits/stl_algobase.h:222:5: note:   template argument deduction/substitution failed:
meetings.cpp:43:18: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'})
   43 |    mx=max(mx,H[j]);
      |                  ^
In file included from /usr/include/c++/9/vector:60,
                 from meetings.h:3,
                 from meetings.cpp:1:
/usr/include/c++/9/bits/stl_algobase.h:268:5: note: candidate: 'template<class _Tp, class _Compare> const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  268 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/9/bits/stl_algobase.h:268:5: note:   template argument deduction/substitution failed:
meetings.cpp:43:18: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'})
   43 |    mx=max(mx,H[j]);
      |                  ^
In file included from /usr/include/c++/9/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:65,
                 from meetings.cpp:2:
/usr/include/c++/9/bits/stl_algo.h:3456:5: note: candidate: 'template<class _Tp> _Tp std::max(std::initializer_list<_Tp>)'
 3456 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/9/bits/stl_algo.h:3456:5: note:   template argument deduction/substitution failed:
meetings.cpp:43:18: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   43 |    mx=max(mx,H[j]);
      |                  ^
In file included from /usr/include/c++/9/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:65,
                 from meetings.cpp:2:
/usr/include/c++/9/bits/stl_algo.h:3462:5: note: candidate: 'template<class _Tp, class _Compare> _Tp std::max(std::initializer_list<_Tp>, _Compare)'
 3462 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/9/bits/stl_algo.h:3462:5: note:   template argument deduction/substitution failed:
meetings.cpp:43:18: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   43 |    mx=max(mx,H[j]);
      |                  ^
meetings.cpp:61:9: error: could not convert 'C' from 'vector<int>' to 'vector<long long int>'
   61 |  return C;
      |         ^
      |         |
      |         vector<int>