알고리즘

[알고리즘] 백준 11557 - Yangjojang of The Year

blueberrysoda 2024. 8. 2. 23:48
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std; 

int N, T;

int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    cin >> T;

    string s; 
    int cnt; 
    while(T--){
        cin >> N;
        vector<pair<int, string>> V;
        for(int i=0; i<N; i++){
            cin >> s >> cnt;
            V.push_back({cnt, s});
        }
        sort(V.begin(), V.end(), greater<>());
        cout << V.front().second << "\n";
    }
    return 0;
}