結果
| 問題 |
No.2629 A replace B replace C
|
| コンテスト | |
| ユーザー |
Cecil
|
| 提出日時 | 2024-02-16 22:41:53 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 554 bytes |
| コンパイル時間 | 293 ms |
| コンパイル使用メモリ | 12,672 KB |
| 実行使用メモリ | 14,484 KB |
| 最終ジャッジ日時 | 2024-09-28 21:18:41 |
| 合計ジャッジ時間 | 5,844 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 5 |
| other | AC * 50 WA * 11 |
ソースコード
from collections import defaultdict as dd
N = int(input())
S = list(input())
T = list(input())
dic = dd(lambda:0)
for i in range(N):
if S[i] == "B" and T[i] == "A":
print("No")
exit()
elif S[i] == "C" and (T[i] == "B" or T[i] == "A"):
print("No")
exit()
elif S[i] == T[i]:
continue
s = S[i]+T[i]
dic[s] += 1
if 0<dic["AB"] and dic["AB"]==dic["BC"] and (dic["BC"] <= dic["AC"] or dic["AC"]==0):
print("Yes")
elif dic["AB"]==dic["AC"]==dic["BC"]==0:
print("Yes")
else:
print("No")
Cecil