Submission #89987

#TimeUsernameProblemLanguageResultExecution timeMemory
89987Retro3014Boxes with souvenirs (IOI15_boxes)C++17
Compilation error
0 ms0 KiB
#include "boxes.h" #include <algorithm> using namespace std; #define MAX_N 10000000 typedef long long ll; ll costf[MAX_N+1], coste[MAX_N+1]; ll answer; long long delivery(int N, int K, int L, int p[]) { for(int i=0; i<N; i++){ costf[i]=2*(ll)p[i]+(i<K?0:costf[i-K]); } for(int i=N-1; i>=0; i--){ coste[i]=(ll)(L-p[i])*2+(i>=N-K?0:coste[i+K]); } answer=min(costf[N-1], coste[0]); if(K>=N){ answer=min(answer, L); } for(int i=0; i<N-1; i++){ answer=min(answer, costf[i]+coste[i+1]); if(i+K+1<N){ answer = min(answer, costf[i]+coste[i+K+1]+(ll)L); } } return answer; }

Compilation message (stderr)

boxes.cpp: In function 'long long int delivery(int, int, int, int*)':
boxes.cpp:23:23: error: no matching function for call to 'min(ll&, int&)'
   answer=min(answer, L);
                       ^
In file included from /usr/include/c++/7/algorithm:61:0,
                 from boxes.cpp:2:
/usr/include/c++/7/bits/stl_algobase.h:195:5: note: candidate: template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)
     min(const _Tp& __a, const _Tp& __b)
     ^~~
/usr/include/c++/7/bits/stl_algobase.h:195:5: note:   template argument deduction/substitution failed:
boxes.cpp:23:23: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   answer=min(answer, L);
                       ^
In file included from /usr/include/c++/7/algorithm:61:0,
                 from boxes.cpp:2:
/usr/include/c++/7/bits/stl_algobase.h:243:5: note: candidate: template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)
     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
     ^~~
/usr/include/c++/7/bits/stl_algobase.h:243:5: note:   template argument deduction/substitution failed:
boxes.cpp:23:23: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   answer=min(answer, L);
                       ^
In file included from /usr/include/c++/7/algorithm:62:0,
                 from boxes.cpp:2:
/usr/include/c++/7/bits/stl_algo.h:3450:5: note: candidate: template<class _Tp> constexpr _Tp std::min(std::initializer_list<_Tp>)
     min(initializer_list<_Tp> __l)
     ^~~
/usr/include/c++/7/bits/stl_algo.h:3450:5: note:   template argument deduction/substitution failed:
boxes.cpp:23:23: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   answer=min(answer, L);
                       ^
In file included from /usr/include/c++/7/algorithm:62:0,
                 from boxes.cpp:2:
/usr/include/c++/7/bits/stl_algo.h:3456:5: note: candidate: template<class _Tp, class _Compare> constexpr _Tp std::min(std::initializer_list<_Tp>, _Compare)
     min(initializer_list<_Tp> __l, _Compare __comp)
     ^~~
/usr/include/c++/7/bits/stl_algo.h:3456:5: note:   template argument deduction/substitution failed:
boxes.cpp:23:23: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   answer=min(answer, L);
                       ^