Problem minstack
User Jude
Submission Time 2026-03-12 08:51:10
Score 0
Max Time N/A
Max Memory N/A

Compile Error

minstack.cpp: In function ‘void push(int)’:
minstack.cpp:8:71: error: no matching function for call to ‘min(int&, long long int&)’
8 | int new_min = minStack.empty() ? x : min(x, minStack.back().second);
| ^
In file included from /usr/include/c++/9/algorithm:61,
from minstack.cpp:1:
/usr/include/c++/9/bits/stl_algobase.h:198:5: note: candidate: ‘template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)’
198 | min(const _Tp& __a, const _Tp& __b)
| ^~~
/usr/include/c++/9/bits/stl_algobase.h:198:5: note: template argument deduction/substitution failed:
minstack.cpp:8:71: note: deduced conflicting types for parameter ‘const _Tp’ (‘int’ and ‘long long int’)
8 | int new_min = minStack.empty() ? x : min(x, minStack.back().second);
| ^