結果

問題 No.2629 A replace B replace C
ユーザー moon17
提出日時 2024-02-18 23:33:09
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 330 bytes
コンパイル時間 278 ms
コンパイル使用メモリ 82,392 KB
実行使用メモリ 76,352 KB
最終ジャッジ日時 2024-09-29 00:56:17
合計ジャッジ時間 5,080 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 5
other AC * 45 WA * 16
権限があれば一括ダウンロードができます

ソースコード

diff #

n=int(input())
s=input()
t=input()
a=[0]*2
b=0
for i,j in zip(s,t):
  k=i+j
  if i==j:
    continue
  if k=='BA' or i=='C':
    exit(print('No'))
  if k=='AC':
    a[1]+=1
  if k=='AB':
    a[0]+=1
  if k=='BC':
    b+=1
if a[0]+a[1]*2<b:
  exit(print('No'))
if a[0]+a[1]*2==b or a[0]+a[1]-b==2*b:
  exit(print('Yes'))
print('No')
0