Submission #836475

#TimeUsernameProblemLanguageResultExecution timeMemory
836475IS_RushdiMeetings (IOI18_meetings)C++17
Compilation error
0 ms0 KiB
#include "meetings.h" #include <bits/stdc++.h> using namespace std; #define ll long long vector<long long> minimum_costs(vector<int> H, vector<int> L,vector<int> R) { ll q = L.size(); ll n = H.size(); vector<ll> ans(q); vector<vector<ll>> mn(n,vector<ll>(n,1e18)); for(ll i = 0; i < n; i++){ mn[i][i] = H[i]; ll curr = H[i]; for(ll j = i-1; j >= 0; j--){ curr = min(curr,H[j]); mn[j][i] = curr; }curr = H[i]; for(ll j = i+1; j < n; j++){ curr = min(curr,H[j]); mn[j][i] = curr; } } for(ll i = 0; i < n; i++){ for(ll j = 1; j < n; j++){ mn[j][i] += mn[j-1][i]; } } for(ll v = 0; v < q; v++){ ll l = L[v]; ll r = R[v]; ll cnt = 1e18; for(ll i = l; i <= r; i++){ if(l == 0)cnt = min(cnt,mn[r][i]); else cnt = min(cnt,mn[r][i]-mn[l-1][i]); } ans[v] = cnt; } return ans; } // ll main(){ // }

Compilation message (stderr)

meetings.cpp: In function 'std::vector<long long int> minimum_costs(std::vector<int>, std::vector<int>, std::vector<int>)':
meetings.cpp:14:29: error: no matching function for call to 'min(long long int&, __gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type&)'
   14 |         curr = min(curr,H[j]);
      |                             ^
In file included from /usr/include/c++/10/vector:60,
                 from meetings.h:3,
                 from meetings.cpp:1:
/usr/include/c++/10/bits/stl_algobase.h:230:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  230 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/10/bits/stl_algobase.h:230:5: note:   template argument deduction/substitution failed:
meetings.cpp:14:29: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'})
   14 |         curr = min(curr,H[j]);
      |                             ^
In file included from /usr/include/c++/10/vector:60,
                 from meetings.h:3,
                 from meetings.cpp:1:
/usr/include/c++/10/bits/stl_algobase.h:278:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
  278 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/10/bits/stl_algobase.h:278:5: note:   template argument deduction/substitution failed:
meetings.cpp:14:29: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'})
   14 |         curr = min(curr,H[j]);
      |                             ^
In file included from /usr/include/c++/10/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from meetings.cpp:2:
/usr/include/c++/10/bits/stl_algo.h:3468:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(std::initializer_list<_Tp>)'
 3468 |     min(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/10/bits/stl_algo.h:3468:5: note:   template argument deduction/substitution failed:
meetings.cpp:14:29: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   14 |         curr = min(curr,H[j]);
      |                             ^
In file included from /usr/include/c++/10/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from meetings.cpp:2:
/usr/include/c++/10/bits/stl_algo.h:3474:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(std::initializer_list<_Tp>, _Compare)'
 3474 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/10/bits/stl_algo.h:3474:5: note:   template argument deduction/substitution failed:
meetings.cpp:14:29: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   14 |         curr = min(curr,H[j]);
      |                             ^
meetings.cpp:18:29: error: no matching function for call to 'min(long long int&, __gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type&)'
   18 |         curr = min(curr,H[j]);
      |                             ^
In file included from /usr/include/c++/10/vector:60,
                 from meetings.h:3,
                 from meetings.cpp:1:
/usr/include/c++/10/bits/stl_algobase.h:230:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  230 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/10/bits/stl_algobase.h:230:5: note:   template argument deduction/substitution failed:
meetings.cpp:18:29: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'})
   18 |         curr = min(curr,H[j]);
      |                             ^
In file included from /usr/include/c++/10/vector:60,
                 from meetings.h:3,
                 from meetings.cpp:1:
/usr/include/c++/10/bits/stl_algobase.h:278:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
  278 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/10/bits/stl_algobase.h:278:5: note:   template argument deduction/substitution failed:
meetings.cpp:18:29: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'})
   18 |         curr = min(curr,H[j]);
      |                             ^
In file included from /usr/include/c++/10/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from meetings.cpp:2:
/usr/include/c++/10/bits/stl_algo.h:3468:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(std::initializer_list<_Tp>)'
 3468 |     min(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/10/bits/stl_algo.h:3468:5: note:   template argument deduction/substitution failed:
meetings.cpp:18:29: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   18 |         curr = min(curr,H[j]);
      |                             ^
In file included from /usr/include/c++/10/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from meetings.cpp:2:
/usr/include/c++/10/bits/stl_algo.h:3474:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(std::initializer_list<_Tp>, _Compare)'
 3474 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/10/bits/stl_algo.h:3474:5: note:   template argument deduction/substitution failed:
meetings.cpp:18:29: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   18 |         curr = min(curr,H[j]);
      |                             ^