Untitled

mail@pastecode.io avatar
unknown
plain_text
2 months ago
501 B
1
Indexable
Never
#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;
}
Leave a Comment