acwing 3761
作者:
疾风劲草
,
2021-08-05 12:47:06
,
所有人可见
,
阅读 288
//https://www.acwing.com/blog/content/1626/ map用法详解
//https://www.acwing.com/solution/content/55118/ map[数值]=vector<下标序列>
#include<iostream>
#include<map>
#include<vector>
using namespace std;
int main()
{
int T;
cin>>T;
while(T--)
{
int n;cin>>n;
map<int,vector<int> >mp;
for(int i=1;i<=n;i++)
{
int x;cin>>x;
mp[x].push_back(i);
}
int res=-1;
for(auto it=mp.begin();it!=mp.end();it++)
if(it->second.size()==1)
{
res=it->second[0];
break;
}
cout<<res<<endl;
}
return 0;
}