結果

問題 No.2629 A replace B replace C
ユーザー ikomaikoma
提出日時 2024-02-16 21:46:36
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 522 bytes
コンパイル時間 172 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 84,660 KB
最終ジャッジ日時 2024-02-16 21:46:48
合計ジャッジ時間 6,092 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 49 ms
73,884 KB
testcase_01 AC 58 ms
75,548 KB
testcase_02 AC 57 ms
74,452 KB
testcase_03 AC 72 ms
81,680 KB
testcase_04 AC 48 ms
65,972 KB
testcase_05 AC 53 ms
71,052 KB
testcase_06 AC 50 ms
67,868 KB
testcase_07 AC 80 ms
73,704 KB
testcase_08 AC 59 ms
74,576 KB
testcase_09 AC 68 ms
81,416 KB
testcase_10 AC 93 ms
80,780 KB
testcase_11 WA -
testcase_12 AC 72 ms
82,576 KB
testcase_13 AC 55 ms
73,844 KB
testcase_14 AC 70 ms
81,424 KB
testcase_15 AC 68 ms
81,424 KB
testcase_16 AC 56 ms
74,456 KB
testcase_17 AC 59 ms
74,424 KB
testcase_18 AC 54 ms
74,140 KB
testcase_19 AC 49 ms
68,132 KB
testcase_20 AC 52 ms
70,804 KB
testcase_21 AC 68 ms
80,072 KB
testcase_22 AC 58 ms
75,040 KB
testcase_23 AC 65 ms
80,056 KB
testcase_24 AC 57 ms
75,228 KB
testcase_25 AC 58 ms
75,400 KB
testcase_26 AC 57 ms
73,112 KB
testcase_27 AC 57 ms
73,704 KB
testcase_28 AC 67 ms
80,208 KB
testcase_29 AC 50 ms
67,868 KB
testcase_30 AC 52 ms
69,000 KB
testcase_31 AC 71 ms
84,660 KB
testcase_32 AC 67 ms
82,432 KB
testcase_33 AC 73 ms
83,456 KB
testcase_34 AC 65 ms
81,408 KB
testcase_35 AC 66 ms
81,552 KB
testcase_36 AC 73 ms
83,496 KB
testcase_37 AC 75 ms
84,224 KB
testcase_38 AC 70 ms
82,124 KB
testcase_39 AC 59 ms
74,332 KB
testcase_40 AC 69 ms
80,704 KB
testcase_41 AC 56 ms
73,392 KB
testcase_42 AC 62 ms
77,056 KB
testcase_43 AC 58 ms
76,044 KB
testcase_44 AC 55 ms
73,688 KB
testcase_45 AC 69 ms
81,416 KB
testcase_46 AC 65 ms
80,508 KB
testcase_47 AC 55 ms
73,812 KB
testcase_48 AC 55 ms
73,844 KB
testcase_49 AC 51 ms
70,400 KB
testcase_50 AC 67 ms
81,552 KB
testcase_51 AC 59 ms
75,672 KB
testcase_52 AC 57 ms
73,112 KB
testcase_53 AC 47 ms
65,824 KB
testcase_54 AC 47 ms
68,004 KB
testcase_55 AC 49 ms
67,868 KB
testcase_56 AC 47 ms
65,820 KB
testcase_57 AC 61 ms
76,812 KB
testcase_58 AC 50 ms
68,296 KB
testcase_59 AC 64 ms
80,052 KB
testcase_60 AC 52 ms
71,048 KB
testcase_61 AC 38 ms
53,460 KB
testcase_62 AC 39 ms
53,460 KB
testcase_63 AC 39 ms
53,460 KB
testcase_64 AC 39 ms
53,460 KB
testcase_65 AC 42 ms
53,460 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline
from collections import defaultdict,deque,Counter

N=int(input())
S=input().strip()
T=input().strip()

cnt = Counter([s+t for s,t in zip(S,T) if s!=t])
def solve(cnt):
    # (B,A) (C,A) があったらNo
    if "BA" in cnt or "CA" in cnt:
        return False
    # (A,C), (B,C) -> (B,C),(C,C)
    if cnt["AC"]>0 and cnt["BC"]==0:
        return False
    n = cnt["AC"]
    cnt[""]
    # (A,B),(B,C) -> (B,B),(C,C)
    return cnt["AB"]==cnt["BC"]

print("Yes" if solve(cnt) else "No")
0