Problem minstack
User Wenkai
Submission Time 2023-07-20 00:12:44
Score 0
Max Time N/A
Max Memory N/A

Compile Error

minstack.cpp:3:21: error: no matching function for call to ‘std::stack<int>::stack(<brace-enclosed initializer list>)’
3 | std::stack<int>m{1e9},s;void push(int X){m.push(std::min(X,m.top()));s.push(X);}void pop(){s.pop();m.pop();}int top(){return s.top();}int getMin(){return m.top();}
| ^
In file included from /usr/include/c++/9/stack:61,
from minstack.cpp:1:
/usr/include/c++/9/bits/stl_stack.h:185:2: note: candidate: ‘template<class _Alloc, class _Requires> std::stack<_Tp, _Sequence>::stack(std::stack<_Tp, _Sequence>&&, const _Alloc&)’
185 | stack(stack&& __q, const _Alloc& __a)
| ^~~~~
/usr/include/c++/9/bits/stl_stack.h:185:2: note: template argument deduction/substitution failed:
minstack.cpp:3:21: note: candidate expects 2 arguments, 1 provided
3 | std::stack<int>m{1e9},s;void push(int X){m.push(std::min(X,m.top()));s.push(X);}void pop(){s.pop()