結果

問題 No.2030 Googol Strings
ユーザー lloyzlloyz
提出日時 2023-08-26 18:36:04
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 500 bytes
コンパイル時間 382 ms
コンパイル使用メモリ 86,928 KB
実行使用メモリ 165,872 KB
最終ジャッジ日時 2023-08-26 18:36:10
合計ジャッジ時間 5,720 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 110 ms
81,916 KB
testcase_01 AC 76 ms
72,960 KB
testcase_02 AC 85 ms
88,860 KB
testcase_03 AC 62 ms
71,312 KB
testcase_04 AC 103 ms
77,500 KB
testcase_05 AC 86 ms
77,444 KB
testcase_06 AC 131 ms
136,240 KB
testcase_07 AC 165 ms
165,724 KB
testcase_08 AC 170 ms
165,872 KB
testcase_09 TLE -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

from math import gcd
import sys
input = sys.stdin.readline

for _ in range(int(input())):
    S = list(input().rstrip())
    T = list(input().rstrip())
    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