-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCodeForces-1433C.cpp
44 lines (43 loc) · 999 Bytes
/
CodeForces-1433C.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
//
// Created by abdob on 10/29/2022.
//
#include<bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define pb push_back
#define fastread() (ios_base:: sync_with_stdio(false),cin.tie(NULL));
using namespace std;
int main()
{
fastread();
ll t,n,a;
cin>>t;
while(t--){
vector<ll>v;
cin>>n;
ll m = 0;
for(ll i=0; i<n; i++){
cin>>a;
m = max(m,a);
v.pb(a);
}
ll pos = 0;
for(ll i=0; i<n; i++){
if( (v[i] > v[i-1] && v[i] == m) && (i > 0) ){
pos = i+1;
break;
}
else if( (v[i] > v[i+1] && v[i] == m) && (i < n-1) ){
pos = i+1;
break;
}
}
if(pos > 0){
cout<<pos<<endl;
}
else{
cout<<-1<<endl;
}
}
return 0;
}