题目描述
blablabla
样例
#include<iostream>
#include<string>
const int N = 1e5+10;
using namespace std;
int stack[N], tt = 0;
int main(){
int n, x;
cin >> n;
for(int i=0; i<n; i++){
cin >> x;
while(tt&&stack[tt]>=x) tt--;
if(tt == 0) cout << -1 <<" ";
else cout << stack[tt] << " ";
stack[++tt] = x;
}
}