include
include
include
using namespace std;
int main(void) { int N; vector A; vector B; int temp=0;
cin>>N;
for(int i=0;i<N;i++) //输入N个A队列鱼
{
cin>>temp;
A.push_back(temp);
}
for(int j=0;j<N;j++) //输入N个B队列鱼
{
cin>>temp;
B.push_back(temp);
}
vector<int>::reverse_iterator maxpointerA=max_element(A.rbegin(),A.rend());
vector<int>::reverse_iterator maxpointerB=max_element(B.rbegin(),B.rend());
int A_max=*maxpointerA;
int B_max=*maxpointerB;
int A_len=distance(A.rbegin(),maxpointerA);
int B_len=distance(B.rbegin(),maxpointerB);
if(A_max>B_max)
cout<<A_len+1<<endl; //vector的index值是从0开始的,所以需要+1
else
cout<<B_len+1<<endl;
return 0;
}
谢谢指点,大神!!