結果

問題 No.2629 A replace B replace C
ユーザー PNJPNJ
提出日時 2024-02-16 21:30:30
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 456 bytes
コンパイル時間 224 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 80,888 KB
最終ジャッジ日時 2024-02-16 21:30:52
合計ジャッジ時間 6,202 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 45 ms
66,572 KB
testcase_01 AC 63 ms
74,308 KB
testcase_02 AC 62 ms
73,944 KB
testcase_03 AC 74 ms
80,888 KB
testcase_04 AC 57 ms
68,452 KB
testcase_05 AC 59 ms
72,852 KB
testcase_06 AC 52 ms
66,344 KB
testcase_07 AC 62 ms
71,980 KB
testcase_08 WA -
testcase_09 AC 60 ms
75,592 KB
testcase_10 AC 68 ms
76,220 KB
testcase_11 AC 66 ms
77,276 KB
testcase_12 AC 74 ms
80,708 KB
testcase_13 AC 70 ms
73,212 KB
testcase_14 AC 58 ms
75,248 KB
testcase_15 AC 64 ms
76,304 KB
testcase_16 AC 61 ms
74,068 KB
testcase_17 AC 62 ms
74,372 KB
testcase_18 AC 59 ms
72,940 KB
testcase_19 AC 55 ms
68,416 KB
testcase_20 AC 58 ms
70,464 KB
testcase_21 AC 58 ms
72,624 KB
testcase_22 AC 55 ms
72,212 KB
testcase_23 WA -
testcase_24 AC 56 ms
71,992 KB
testcase_25 AC 55 ms
72,004 KB
testcase_26 WA -
testcase_27 AC 55 ms
71,128 KB
testcase_28 WA -
testcase_29 WA -
testcase_30 AC 58 ms
68,416 KB
testcase_31 AC 61 ms
74,700 KB
testcase_32 AC 58 ms
73,256 KB
testcase_33 AC 60 ms
73,708 KB
testcase_34 AC 56 ms
70,436 KB
testcase_35 AC 58 ms
73,408 KB
testcase_36 AC 61 ms
74,176 KB
testcase_37 AC 61 ms
75,160 KB
testcase_38 AC 59 ms
73,744 KB
testcase_39 AC 53 ms
68,384 KB
testcase_40 AC 58 ms
73,184 KB
testcase_41 AC 60 ms
69,264 KB
testcase_42 AC 58 ms
72,916 KB
testcase_43 AC 57 ms
72,640 KB
testcase_44 AC 55 ms
71,864 KB
testcase_45 AC 60 ms
75,476 KB
testcase_46 AC 65 ms
75,536 KB
testcase_47 AC 55 ms
71,860 KB
testcase_48 AC 55 ms
71,132 KB
testcase_49 AC 52 ms
66,464 KB
testcase_50 AC 60 ms
75,568 KB
testcase_51 WA -
testcase_52 AC 46 ms
66,976 KB
testcase_53 AC 43 ms
61,836 KB
testcase_54 AC 45 ms
63,884 KB
testcase_55 AC 43 ms
63,884 KB
testcase_56 AC 43 ms
61,836 KB
testcase_57 WA -
testcase_58 AC 45 ms
64,140 KB
testcase_59 AC 58 ms
74,344 KB
testcase_60 AC 46 ms
64,908 KB
testcase_61 AC 38 ms
53,460 KB
testcase_62 AC 36 ms
53,460 KB
testcase_63 AC 37 ms
53,460 KB
testcase_64 AC 42 ms
53,460 KB
testcase_65 AC 37 ms
53,460 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
S = input()
T = input()
ans = 'Yes'
B = []
C = []
for i in range(N):
  if S[i] == T[i]:
    continue
  if T[i] == 'A':
    ans = 'No'
  elif T[i] == 'B':
    if S[i] == 'A':
      B.append((0,i))
    else:
      ans = 'No'
  else:
    if S[i] == 'A':
      B.append((1,i))
    else:
      C.append(i)

while len(B) and len(C):
  f,i = B.pop()
  j = C.pop()
  if f:
    C.append(i)
if len(B):
  ans = 'No'
if len(C):
  ans = 'No'
print(ans)
0