結果

問題 No.2629 A replace B replace C
ユーザー timi
提出日時 2024-02-16 21:39:06
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 407 bytes
コンパイル時間 163 ms
コンパイル使用メモリ 82,308 KB
実行使用メモリ 75,908 KB
最終ジャッジ日時 2024-09-28 19:53:38
合計ジャッジ時間 4,612 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 5
other AC * 45 WA * 16
権限があれば一括ダウンロードができます

ソースコード

diff #

# T=int(input())
# for _ in range(T):
#   x1,y1,x2,y2,X1,Y1,X2,Y2=map(int,input().split())

N=int(input())
S=input()
T=input()
if S==T:
  print('Yes')
  exit()
x,y,z=0,0,0
for i in range(N):
  s,t=S[i],T[i]
  if s>t:
    print('No')
    exit()
  if s=='A' and t=='B':
    x+=1
  elif s=='A' and t=='C':
    y+=1
  else:
    z+=1
if x!=z:
  print('No')
  exit()
if z>0:
  print('Yes')
else:
  print('No')
  
0