시도 횟수: 1회
해결한 시간: 27:02
<aside> 💡
$1≤N≤100$ 이므로 나이브하게 검사하면 된다.
</aside>
#include <bits/stdc++.h>
#define FASTIO ios_base::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);
using namespace std;
typedef long long ll;
int n;
int main()
{
FASTIO;
cin >> n;
vector<int> a(n);
for(int i = 0; i<n; i++) cin >> a[i];
for(int i = 0; i<n; i++){
bool flag = false;
for(int j = i-1; j>=0; j--){
if(a[j] > a[i]){
cout << j+1 <<"\\n";
flag = true;
break;
}
}
if(!flag) cout << "-1\\n";
}
return 0;
}
$N$의 제한을 잘못봐서 어려운 문제인줄 알았다.