class Solution {
public:
    int minnum;
    stack<int>s;
    vector<int>minv;//存储当前的最小值
    Solution(){
        minv.push_back(10001);
    }
    void push(int value) {
        minnum=(minv.back()>value)?value:minv.back();
        minv.push_back(minnum);
        s.push(value);
    }
    void pop() {
        s.pop();
        minv.pop_back();
    }
    int top() {
        return s.top();
    }
    int min() {
        return minv.back();
    }
};