結果
問題 |
No.2629 A replace B replace C
|
ユーザー |
|
提出日時 | 2025-07-19 11:34:03 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 591 bytes |
コンパイル時間 | 587 ms |
コンパイル使用メモリ | 82,732 KB |
実行使用メモリ | 92,664 KB |
最終ジャッジ日時 | 2025-07-19 11:34:11 |
合計ジャッジ時間 | 6,295 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 WA * 1 |
other | AC * 60 WA * 1 |
ソースコード
N = int(input()) S = list(input()) T = list(input()) S1 = [] T1 = [] ans = "Yes" for i in range(N): if S[i]=="A": if T[i]=="B" or T[i]=="C": S1.append("A") T1.append(T[i]) elif S[i]=="B": if T[i]=="A": ans = "No" break elif T[i]=="C": S1.append("B") T1.append("C") else: # S[i]=="C" if T[i]!="C": ans = "No" break if ans=="Yes": if N==1 or (S1.count("A")!=T1.count("C")) or S1.count("A")==0 or S1.count("B")==0: ans = "No" print(ans)