結果

問題 No.201 yukicoderじゃんけん
ユーザー somo_6
提出日時 2015-05-08 23:44:12
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 558 bytes
コンパイル時間 415 ms
コンパイル使用メモリ 59,000 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-07-05 20:44:50
合計ジャッジ時間 1,327 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<algorithm>

using namespace std;

struct person
{
	string name;
	string yuruhuwa;
	string hand;
};
int main()
{
	person player[2];
	for(auto &p : player)
	{
		cin >> p.name >> p.yuruhuwa >> p.hand;
	}
	if(player[0].yuruhuwa==player[1].yuruhuwa){
		cout << "-1" << endl;
		return 0;
	}
	person win = max(player[0],player[1],
		[](const person& a,const person& b){
			return 
				a.yuruhuwa.length()<b.yuruhuwa.length()||
			a.yuruhuwa.length()==b.yuruhuwa.length()&&
				a.yuruhuwa<b.yuruhuwa;
		}
	);
	cout << win.name << endl;
}
0