-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path1454B.cpp
More file actions
34 lines (32 loc) · 812 Bytes
/
Copy path1454B.cpp
File metadata and controls
34 lines (32 loc) · 812 Bytes
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
#include "bits/stdc++.h"
#pragma GCC optimize "trapv"
using i64 = long long int;
using namespace std;
int nxt(){int x; cin >> x; return x;}
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define inarr(a,n) for(int i = 0; i < n; ++i) cin >> a[i];
//
int solve(){
int n;cin >> n;
vector<int> a(n);
generate_n(a.begin(), n, nxt);
map<int,int> x;
for(auto& i : a)x[i]++;
for(auto& i : x){
if(i.second>1)continue;
for(int k=0;k<n;++k){
if(a[k] == i.first) return k+1;
}
}
return -1;
}
int main(){
cin.tie(nullptr);cout.tie(nullptr);ios::sync_with_stdio(false);
int testt = 1;
cin >> testt;
for (int i = 0; i < testt; ++i) {
// cout << "Case #" << i << ": ";
cout << solve() << "\n";
}
}