Məsələlər
Əsgərlər sırası
include <bits/stdc++.h>
using namespace std;
int main() { iosbase::syncwith_stdio(0); cin.tie(0);
int n, x;
cin >> n;
stack<pair<int,int>> s;
s.push({1000000000,-1});
for(int i=0; i<n; i++){
cin >> x;
while(s.top().first <= x){
s.pop();
}
cout << s.top().second << " ";
s.push({x,i});
}
}