結果

問題 No.2629 A replace B replace C
ユーザー NP
提出日時 2024-02-16 22:48:28
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
TLE  
実行時間 -
コード長 310 bytes
コンパイル時間 117 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 25,572 KB
最終ジャッジ日時 2024-09-28 21:24:12
合計ジャッジ時間 6,641 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample -- * 5
other TLE * 1 -- * 60
権限があれば一括ダウンロードができます

ソースコード

diff #

def can_transform(S, T):
    for i in range(len(S)):
        if S[i] > T[i] or (S[i] == 'A' and T[i] == 'C'):
            return "No"
        S = S[:i] + S[i:].replace(S[i], T[i])
    return "Yes" if S == T else "No"

N = int(input().strip())
S = input().strip()
T = input().strip()

print(can_transform(S, T))
0