結果

問題 No.2030 Googol Strings
ユーザー H3PO4H3PO4
提出日時 2022-08-05 22:11:38
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 649 ms / 2,000 ms
コード長 488 bytes
コンパイル時間 134 ms
コンパイル使用メモリ 12,416 KB
実行使用メモリ 14,524 KB
最終ジャッジ日時 2024-09-15 19:09:06
合計ジャッジ時間 5,857 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 111 ms
10,624 KB
testcase_01 AC 31 ms
10,624 KB
testcase_02 AC 32 ms
11,136 KB
testcase_03 AC 29 ms
10,496 KB
testcase_04 AC 165 ms
10,368 KB
testcase_05 AC 109 ms
10,368 KB
testcase_06 AC 190 ms
13,028 KB
testcase_07 AC 350 ms
14,524 KB
testcase_08 AC 350 ms
14,524 KB
testcase_09 AC 442 ms
10,624 KB
testcase_10 AC 451 ms
10,496 KB
testcase_11 AC 455 ms
10,496 KB
testcase_12 AC 409 ms
10,624 KB
testcase_13 AC 470 ms
10,496 KB
testcase_14 AC 192 ms
10,624 KB
testcase_15 AC 649 ms
10,880 KB
testcase_16 AC 349 ms
11,008 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def solve(x, y):
    # XならTrue, YならFalseを返す
    flag = False
    if len(x) > len(y):
        flag = True
        x, y = y, x
    lx = len(x)
    ly = len(y)
    for i in range(2 * ly):
        ilx = i % lx
        ily = i % ly
        if x[ilx] > y[ily]:
            return True ^ flag
        elif x[ilx] < y[ily]:
            return False ^ flag

    return flag


T = int(input())
for _ in range(T):
    x = input()
    y = input()
    print("X" if solve(x, y) else "Y")
0