結果

問題 No.2629 A replace B replace C
ユーザー ntudantuda
提出日時 2024-02-17 13:36:30
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 74 ms / 2,000 ms
コード長 394 bytes
コンパイル時間 456 ms
コンパイル使用メモリ 81,572 KB
実行使用メモリ 75,876 KB
最終ジャッジ日時 2024-02-17 13:36:37
合計ジャッジ時間 6,793 ms
ジャッジサーバーID
(参考情報)
judge16 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 40 ms
56,348 KB
testcase_01 AC 59 ms
72,268 KB
testcase_02 AC 54 ms
70,076 KB
testcase_03 AC 59 ms
74,384 KB
testcase_04 AC 50 ms
65,988 KB
testcase_05 AC 51 ms
65,968 KB
testcase_06 AC 46 ms
61,652 KB
testcase_07 AC 63 ms
75,440 KB
testcase_08 AC 68 ms
75,568 KB
testcase_09 AC 71 ms
75,580 KB
testcase_10 AC 55 ms
70,220 KB
testcase_11 AC 72 ms
75,724 KB
testcase_12 AC 58 ms
73,036 KB
testcase_13 AC 56 ms
72,268 KB
testcase_14 AC 71 ms
75,724 KB
testcase_15 AC 67 ms
75,724 KB
testcase_16 AC 55 ms
70,076 KB
testcase_17 AC 53 ms
70,064 KB
testcase_18 AC 55 ms
72,112 KB
testcase_19 AC 52 ms
65,988 KB
testcase_20 AC 53 ms
70,064 KB
testcase_21 AC 70 ms
75,580 KB
testcase_22 AC 67 ms
75,596 KB
testcase_23 AC 68 ms
75,568 KB
testcase_24 AC 67 ms
75,588 KB
testcase_25 AC 68 ms
75,580 KB
testcase_26 AC 63 ms
75,440 KB
testcase_27 AC 65 ms
75,452 KB
testcase_28 AC 69 ms
75,724 KB
testcase_29 AC 53 ms
72,368 KB
testcase_30 AC 58 ms
72,252 KB
testcase_31 AC 44 ms
55,588 KB
testcase_32 AC 45 ms
55,588 KB
testcase_33 AC 43 ms
56,216 KB
testcase_34 AC 42 ms
55,588 KB
testcase_35 AC 43 ms
55,588 KB
testcase_36 AC 42 ms
56,136 KB
testcase_37 AC 42 ms
55,584 KB
testcase_38 AC 42 ms
55,584 KB
testcase_39 AC 43 ms
55,588 KB
testcase_40 AC 43 ms
55,588 KB
testcase_41 AC 63 ms
75,440 KB
testcase_42 AC 71 ms
75,580 KB
testcase_43 AC 70 ms
75,596 KB
testcase_44 AC 66 ms
75,568 KB
testcase_45 AC 73 ms
75,580 KB
testcase_46 AC 71 ms
75,876 KB
testcase_47 AC 65 ms
75,568 KB
testcase_48 AC 66 ms
75,588 KB
testcase_49 AC 62 ms
75,440 KB
testcase_50 AC 74 ms
75,724 KB
testcase_51 AC 68 ms
75,596 KB
testcase_52 AC 63 ms
75,568 KB
testcase_53 AC 50 ms
68,016 KB
testcase_54 AC 55 ms
72,132 KB
testcase_55 AC 53 ms
72,112 KB
testcase_56 AC 52 ms
68,016 KB
testcase_57 AC 70 ms
75,596 KB
testcase_58 AC 55 ms
72,132 KB
testcase_59 AC 68 ms
75,568 KB
testcase_60 AC 64 ms
75,440 KB
testcase_61 AC 42 ms
53,460 KB
testcase_62 AC 41 ms
53,460 KB
testcase_63 AC 41 ms
53,460 KB
testcase_64 AC 37 ms
53,460 KB
testcase_65 AC 41 ms
53,460 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
S = input()
T = input()
if S == T:
    print("Yes")
    exit()

from collections import defaultdict
dic = defaultdict(int)
for i in range(N):
    if S[i] > T[i]:
        print("No")
        exit()
    elif S[i] < T[i]:
        dic[(S[i],T[i])] += 1
if dic[('A','B')] == 0:
    print("No")
    exit()
if dic[('A','B')] != dic[('B','C')]:
    print("No")
    exit()
print("Yes")
0