結果
| 問題 |
No.201 yukicoderじゃんけん
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2018-12-03 21:53:02 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 3 ms / 5,000 ms |
| コード長 | 793 bytes |
| コンパイル時間 | 520 ms |
| コンパイル使用メモリ | 65,156 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-07-04 19:12:44 |
| 合計ジャッジ時間 | 1,364 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 20 |
ソースコード
#include <iostream>
using namespace std;
struct Player {
string name;
string score;
bool operator<(const Player &other) const {
int n1 = static_cast<int>(score.size()),
n2 = static_cast<int>(other.score.size());
if(n1 < n2) { return true; }
if(n2 < n1) { return false; }
for(int i=0; i<n1; ++i) {
if(score[i] < other.score[i]) { return true; }
if(other.score[i] < score[i]) { return false; }
}
return false; // 等しいとき
}
};
string f(Player o1, Player o2) {
if(o1 < o2) { return o2.name; }
if(o2 < o1) { return o1.name; }
return "-1";
}
int main(void) {
string a, x, unused1, b, y, unused2;
cin >> a >> x >> unused1 >> b >> y >> unused2;
string res = f(Player{a, x}, Player{b, y});
cout << res << '\n';
return 0;
}