hdu 1234

很早以前就已经做过这道题,不过这次做AC steps又做了一遍,用了stl。挺爽的。直接上代码,没什么好说的。
/*
  ID:狂人
  num:09073355
  E-mail:wenboguo@live.com
*/
#include <vector>
#include <list>
#include <assert.h>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <fstream>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <fstream>

using namespace std;

#define REP(i,n) for(int i=0; i<(n); ++i)
#define FOR(i,a,b) for(int i=(a);i<=(b);++i)
#define FORD(i,a,b) for(int i=(a);i>=b;--i)
#define FOREACH(it,c) for(typeof((c).begin()) it=(c).begin();it!=(c).end();++it)
#define ALL(c) (c).begin(),(c).end()

#define debug(x) cerr<< #x << " = " << (x) << "\n";
#define debugv(v) cerr << #v << " = "; FOREACH(it,v) cerr << *it <<","; cerr << "\n";
#define SIZE(a)  (int(a.size()))
#define mp make_pair
#define pb push_back

template<typename T> inline void checkMax(T& a, T b) {if (b>a) a=b;}
template<typename T> inline void checkMin(T& a, T b) {if (b<a) a=b;}

typedef long long LL;
typedef vector<int> VI;
typedef vector<string> VS;
typedef pair<int,int>  ii;
typedef pair<string, string>ss;
typedef long double ld;
const int INF = 0x7ffffff;

struct Node{
	string str1;
	string str2;

	Node(string st1, string st2):str1(st1),str2(st2){}

	bool operator < (const Node &a) const
	{
		return a.str1 < str1;
	}
};

struct Node1{
	string str1;
	string str2;

	Node1(string st1, string st2):str1(st1),str2(st2){}

	bool operator < (const Node1 &a) const
	{
		return a.str1 > str1;
	}
};


int main()
{
//ifstream cin ("aaa.txt");
	int n;
	cin >> n;
	while (n--)
	{
		int m;
		priority_queue <Node>my_que;
		priority_queue <Node1>my_que1;
		string str1, str2, myname;
		cin >> m;
		while (m--)
		{
			cin >> myname;
			cin >> str1;
			cin >> str2;
			my_que.push(Node(str1, myname));
			my_que1.push(Node1(str2, myname));
		}
		cout << my_que.top().str2 << " ";
		cout << my_que1.top().str2 << endl;
	}
//	system("pause");
    return 0;
}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值