結果

問題 No.2030 Googol Strings
ユーザー H3PO4H3PO4
提出日時 2022-08-05 22:11:38
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 523 ms / 2,000 ms
コード長 488 bytes
コンパイル時間 1,145 ms
コンパイル使用メモリ 10,856 KB
実行使用メモリ 10,924 KB
最終ジャッジ日時 2023-10-13 23:17:44
合計ジャッジ時間 4,986 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 80 ms
7,888 KB
testcase_01 AC 16 ms
7,844 KB
testcase_02 AC 17 ms
8,616 KB
testcase_03 AC 14 ms
7,860 KB
testcase_04 AC 134 ms
7,688 KB
testcase_05 AC 77 ms
7,876 KB
testcase_06 AC 140 ms
10,532 KB
testcase_07 AC 267 ms
10,876 KB
testcase_08 AC 264 ms
10,924 KB
testcase_09 AC 345 ms
7,664 KB
testcase_10 AC 347 ms
8,144 KB
testcase_11 AC 356 ms
8,176 KB
testcase_12 AC 355 ms
7,812 KB
testcase_13 AC 377 ms
7,764 KB
testcase_14 AC 146 ms
7,864 KB
testcase_15 AC 523 ms
8,336 KB
testcase_16 AC 274 ms
8,632 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