Untitled
user_5668965
c_cpp
a year ago
446 B
14
Indexable
#include <bits/stdc++.h>
using namespace std;
int main() {
#ifdef _DEBUG
freopen("input.txt", "r", stdin);
// freopen("output.txt", "w", stdout);
#endif
int t;
cin >> t;
while (t--) {
int n;
cin >> n;
vector<int> a(n);
for (auto &it : a) cin >> it;
int pos = n - 1;
while (pos > 0 && a[pos - 1] >= a[pos]) --pos;
while (pos > 0 && a[pos - 1] <= a[pos]) --pos;
cout << pos << endl;
}
return 0;
}Editor is loading...
Leave a Comment