3761. 唯一最小数
https://www.acwing.com/problem/content/3764/
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<vector>
#include<queue>
#include<stack>
#include<cstring>
#include<unordered_map>
using namespace std;
typedef long long LL;
int T;
const int N = 2e5+5;
int n;
int a[N];
unordered_map<int,int> m;
int main(){
cin >> T;
while(T--){
m.clear();
int ans = -1;
cin >> n;
for(int i = 1; i <= n; i++){
scanf("%d",&a[i]);
if(m[a[i]] != 0){
m[a[i]] = -1;
}
else {
m[a[i]] = i;
}
}
sort(a+1,a+n+1);
for(int i = 1;i <= n; i++){
if(m[a[i]] != -1){
ans = m[a[i]];
break;
}
}
cout<<ans<<endl;
}
return 0;
}
// freopen("testdata.in", "r", stdin);