Untitled
unknown
plain_text
2 years ago
442 B
10
Indexable
#include <iostream>
using namespace std;
int main()
{
int count, age, pol, max = 0, number = 0, i, g = 1;
cin >> count;
for (i = 1; i <= count; i++)
{
cin >> age;
cin >> pol;
if (pol == 1 and age > max)
{
max = age;
number = i;
}
if (pol != 1) g++;
}
if (i == g) cout << "-1" << endl;
else cout << number << endl;
}Editor is loading...