結果
| 問題 | No.2629 A replace B replace C |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-02-15 10:57:40 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
AC
|
| 実行時間 | 39 ms / 2,000 ms |
| コード長 | 443 bytes |
| 記録 | |
| コンパイル時間 | 464 ms |
| コンパイル使用メモリ | 85,416 KB |
| 実行使用メモリ | 75,520 KB |
| 最終ジャッジ日時 | 2026-04-15 07:57:24 |
| 合計ジャッジ時間 | 5,453 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge1_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 5 |
| other | AC * 61 |
ソースコード
n = int(input())
s = input()
t = input()
AB, AC, BC = 0, 0, 0
ans = 1
for i in range(len(s)):
if s[i] == t[i]:
continue
elif s[i] > t[i]:
ans = 0
elif s[i] == "A" and t[i] == "B":
AB += 1
elif s[i] == "A" and t[i] == "C":
AC += 1
elif s[i] == "B" and t[i] == "C":
BC += 1
if AB != BC:
ans = 0
if AC > 0 and BC == 0:
ans = 0
if ans:
print("Yes")
else:
print("No")