백준 11557 c++
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
void input_drink(vector<pair<int, string>> &drink)
{
int i;
int N, M;
string name;
cin >> N;
for (i = 0; i < N; i++)
{
cin >> name >> M;
drink.push_back({ M, name });
}
return;
}
void find_answer(vector<pair<int, string>>& drink)
{
sort(drink.begin(), drink.end());
cout << drink.back().second << "\n";
}
void test_case()
{
int testcase;
int i;
cin >> testcase;
for (i = 0; i < testcase; i++)
{
vector<pair<int, string>> drink;
input_drink(drink);
find_answer(drink);
}
return;
}
int main(void)
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
test_case();
return 0;
}