裸题,直接放代码吧.
#include<bits/stdc++.h>
#define UP(x,l,r) for (int x=l;x<=r;++x)
using namespace std;
const int HLZ=21541656;
const int MAXN=2e5+10;
const int P=3e5;
int n,x,ans=0,ans1=0,ansi;
int _[MAXN];
// int a[P+1];
unordered_map<int,int> a;
int hash1 (int x) {
int t=0;
// for (;x;x/=10) t=(t+(x%10)*HLZ+(x&1)+HLZ-114514+P)%P;
return x;
}
int main () {
ios::sync_with_stdio(false);
cin>>n;
UP(i,1,n) cin>>x,++a[hash1(x)];
cin>>n;
UP(i,1,n) cin>>_[i];
UP(i,1,n) {
cin>>x;
if (a[hash1(_[i])]>=ans) {
if (a[hash1(_[i])]==ans) {
if (a[hash1(x)]>ans1) {
ans1=a[hash1(x)],ansi=i;
}
} else ans=a[hash1(_[i])],ans1=a[hash1(x)],ansi=i;
}
}
cout<<ansi<<endl;
}