結果
| 問題 | No.2629 A replace B replace C |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-02-15 10:57:40 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 56 ms / 2,000 ms |
| コード長 | 443 bytes |
| 記録 | |
| コンパイル時間 | 573 ms |
| コンパイル使用メモリ | 82,392 KB |
| 実行使用メモリ | 75,776 KB |
| 最終ジャッジ日時 | 2024-09-28 19:03:28 |
| 合計ジャッジ時間 | 4,707 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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")