Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- long long N, x;
- vector < int > a, v;
- int main () {
- cin >> N;
- a = v = vector < int > (N + 1);
- for (int i = 0; i < N; i ++) {
- cin >> a[i];
- v[i] = i - 1;
- cout << v[i] << ' ';
- while (~v[i] && a[v[i]] >= a[i])
- v[i] = v[v[i]], cout << v[i] << ' ';
- cout << '\n';
- }
- return 0;
- }
- s
Advertisement
Add Comment
Please, Sign In to add comment