hdu1234

/**/
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cctype>
#include <iostream>
#include <algorithm>
#include <map>
#include <set>
#include <vector>
#include <string>
#include <stack>
#include <queue>

typedef long long LL;
using namespace std;

int n, t;

int main()
{
    //freopen("in.txt", "r", stdin);
    //freopen("out.txt", "w", stdout);

    scanf("%d", &t);
    while(t--){
        scanf("%d", &n);
        string name, st, ed;
        cin >> name >> st >> ed;
        string ansname1 = name, ansst = st, ansname2 = name, ansed = ed;
        for (int i = 2; i <= n; i++){
            cin >> name >> st >> ed;
            if(ansst > st){
                ansname1 = name;
                ansst = st;
            }
            if(ansed < ed){
                ansed = ed;
                ansname2 = name;
            }
        }
        cout << ansname1 << " " << ansname2 << endl;
    }

    return 0;
}
/**/

 

全部评论

相关推荐

11-07 13:31
怀化学院 Java
勇敢牛牛不怕难:又疯一个
点赞 评论 收藏
分享
点赞 收藏 评论
分享
牛客网
牛客企业服务