結果

問題 No.2030 Googol Strings
ユーザー V_MelvilleV_Melville
提出日時 2022-08-05 23:03:47
言語 C++23
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,057 bytes
コンパイル時間 6,265 ms
コンパイル使用メモリ 315,748 KB
実行使用メモリ 7,032 KB
最終ジャッジ日時 2023-10-14 00:47:50
合計ジャッジ時間 7,496 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 34 ms
4,352 KB
testcase_01 AC 17 ms
4,352 KB
testcase_02 AC 15 ms
4,348 KB
testcase_03 AC 2 ms
4,352 KB
testcase_04 WA -
testcase_05 AC 14 ms
4,348 KB
testcase_06 AC 29 ms
5,612 KB
testcase_07 AC 37 ms
7,032 KB
testcase_08 AC 38 ms
6,952 KB
testcase_09 AC 19 ms
4,352 KB
testcase_10 AC 18 ms
4,348 KB
testcase_11 AC 19 ms
4,348 KB
testcase_12 AC 36 ms
4,352 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 36 ms
4,348 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/extc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()

using std::cin;
using std::cout;
using std::vector;
using std::string;
using std::istream;
using std::ostream;
using ll = long long;

int main() {
    int t;
    cin >> t;
    
    while (t--) {
        string x, y;
        cin >> x >> y;
        int n1 = x.size();
        int n2 = y.size();
        if (n1 > n2) {
            if (x.substr(0, n2) == y) {
                if (y[0] > x[n2]) puts("Y");
                else puts("X");
            }
            else {
                if (x > y) puts("X");
                else puts("Y");
            }
        }
        else if (n1 == n2) {
            if (x > y) puts("X");
            else puts("Y");
        }
        else {
            if (y.substr(0, n1) == x) {
                if (x[0] > y[n1]) puts("X");
                else puts("Y");
            }
            else {
                if (x < y) puts("Y");
                else puts("X");
            }
        }
    }
    
    return 0;
}
0