Untitled

 avatar
unknown
plain_text
a year ago
501 B
4
Indexable
#include <bits/stdc++.h>

using namespace std;

int a[100001];

int main()
{
    freopen("BKID.INP","r",stdin);
    freopen("BKID.OUT","w",stdout);

    int n; cin >> n;
    int cnt = 0;
    for(int i = 0; i < n; i++) cin >> a[i];

    for(int i = 1; i < n; i++){
        if(a[i-1] > a[i]){
            cout << i - cnt << endl;
            cnt = 0;
        }
        else{
            cout << i+1 << endl;
            a[i] = a[i-1]; ++cnt;
        }
    }

    return 0;
}
Editor is loading...
Leave a Comment