結果

問題 No.2030 Googol Strings
ユーザー lloyzlloyz
提出日時 2023-08-26 18:32:44
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 444 bytes
コンパイル時間 2,639 ms
コンパイル使用メモリ 86,744 KB
実行使用メモリ 165,796 KB
最終ジャッジ日時 2023-08-26 18:32:54
合計ジャッジ時間 8,952 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 161 ms
82,660 KB
testcase_01 AC 88 ms
72,908 KB
testcase_02 AC 95 ms
88,964 KB
testcase_03 AC 64 ms
71,560 KB
testcase_04 AC 142 ms
78,516 KB
testcase_05 AC 95 ms
77,744 KB
testcase_06 AC 134 ms
136,104 KB
testcase_07 AC 172 ms
165,796 KB
testcase_08 AC 173 ms
165,712 KB
testcase_09 TLE -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

from math import gcd

for _ in range(int(input())):
    S = list(input())
    T = list(input())
    n, m = len(S), len(T)
    lcm = n * m // gcd(n, m)
    ans = -1
    for i in range(lcm):
        if S[i % n] > T[i % m]:
            ans = 'X'
            break
        elif S[i % n] < T[i % m]:
            ans = 'Y'
            break
    if ans == -1:
        if n > m:
            ans = 'X'
        else:
            ans = 'Y'
    print(ans)
0