結果
| 問題 | No.2629 A replace B replace C |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-02-18 17:39:08 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
AC
|
| 実行時間 | 44 ms / 2,000 ms |
| コード長 | 387 bytes |
| 記録 | |
| コンパイル時間 | 155 ms |
| コンパイル使用メモリ | 84,784 KB |
| 実行使用メモリ | 80,676 KB |
| 最終ジャッジ日時 | 2026-04-15 12:14:35 |
| 合計ジャッジ時間 | 4,619 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 5 |
| other | AC * 61 |
ソースコード
n = int(input())
S = input()
T = input()
f = False
ab = 0
bc = 0
for s, t in zip(S, T):
if s == "A" and t == "B":
ab += 1
elif s == "B" and t == "C":
bc += 1
f = True
elif s == "A" and t == "C":
ab += 1
bc += 1
elif s != t:
print("No")
exit()
if (f or ab == 0) and ab == bc:
print("Yes")
else:
print("No")