-
Notifications
You must be signed in to change notification settings - Fork 0
/
FACEBOOK.cpp
70 lines (57 loc) · 1.03 KB
/
FACEBOOK.cpp
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#include <iostream>
#include <vector>
using namespace std;
#define ll long long
int main() {
ll t;
cin>>t;
while(t--)
{
ll n;
cin>>n;
vector<ll> l(n);
vector<ll> c(n);
int maxi=0;
int ind=0;
//taking input
for(int i=0;i<n;i++)
{
cin>>l[i];
// cin>>c[i];
if(l[i]>maxi)
{
maxi=l[i];
ind=i;
}
}
for(int i=0;i<n;i++)
cin>>c[i];
// for(int i=0;i<n;i++)
// cout<<l[i]<<" ";
// cout<<maxi<<" "<<ind<<endl;
//continue;
vector<ll> indi;
for(int i=0;i<n;i++)
{
if(l[i]==maxi)
indi.push_back(i);
}
if(indi.size()==1)
{
cout<<ind+1<<endl;
continue;
}
int max_comment=0;
int ans=0;
for(auto it:indi)
{
if(c[it]>max_comment)
{
max_comment=c[it];
ans=it;
}
}
cout<<ans+1<<endl;
}
return 0;
}