Psst.. new poll here.
Psst.. new forums here.
Microsoft is blocking us again (TY IP Reputation!) so just use oauth login instead. :)
Paste
Pasted as C++ by NguyenVietNamSon ( 3 years ago )
#include <bits/stdc++.h>
using namespace std;
int main(){
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int n;
cin >> n;
int a[n + 1];
for(int i = 1; i <= n; ++i){
cin >> a[i];
int flag = 0;
for(int j = i - 1; j >= 1; --j){
if(a[j] < a[i]){
flag = j;
break;
}
}
cout << flag << " ";
}
return 0;
}
Revise this Paste