Advertisement
Saleh127

CF 670C

Oct 8th, 2020
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.86 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. #define ll long long
  4. #define test int t; cin>>t; for(int cs=1;cs<=t;cs++)
  5. map<ll,ll>cine;
  6. int main()
  7. {
  8. ios_base::sync_with_stdio(0);
  9. cin.tie(0);cout.tie(0);
  10.  
  11. ll n,m,i,j,k,l,ans=0;
  12. cin>>n;
  13. ll a[n+5];
  14. for(i=0;i<n;i++)
  15. {
  16. cin>>a[i];
  17. cine[a[i]]++;
  18. }
  19. cin>>m;
  20. ll c[m+3],d[m+3];
  21. for(i=0;i<m;i++)
  22. {
  23. cin>>c[i];
  24. }
  25. for(i=0;i<m;i++)
  26. {
  27. cin>>d[i];
  28. }
  29. ll audi=-10000,suvt=-10000;
  30. for(i=0;i<m;i++)
  31. {
  32. if(audi<cine[c[i]])
  33. {
  34. ans=i+1;
  35. audi=cine[c[i]];
  36. suvt=cine[d[i]];
  37. }
  38. if(audi==cine[c[i]])
  39. {
  40. if(suvt<cine[d[i]])
  41. {
  42. ans=i+1;
  43. suvt=cine[d[i]];
  44. }
  45. }
  46. }
  47. cout<<ans<<endl;
  48. return 0;
  49. }
  50.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement