dd

mail@pastecode.io avatar
unknown
c_cpp
8 months ago
276 B
1
Indexable
Never
#include <iostream>
using namespace std;

int main()
{
	int a;
	int v, s;
	int max = 0;
	int d = -1;
	cin >> a;
    for (int i = 1; i <= a; i++)
	{
		cin >> v >> s;
		if (s == 1)
		{
			if (v > max)
			{
				d = i;
				max = v;
			}
		}
	}
	cout << d;
}