結果

問題 No.2629 A replace B replace C
ユーザー hato336hato336
提出日時 2024-02-16 21:30:28
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 180 ms / 2,000 ms
コード長 1,157 bytes
コンパイル時間 179 ms
コンパイル使用メモリ 81,572 KB
実行使用メモリ 89,016 KB
最終ジャッジ日時 2024-02-16 21:30:52
合計ジャッジ時間 13,085 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 152 ms
89,016 KB
testcase_01 AC 156 ms
88,888 KB
testcase_02 AC 157 ms
88,888 KB
testcase_03 AC 160 ms
88,888 KB
testcase_04 AC 154 ms
88,760 KB
testcase_05 AC 160 ms
88,888 KB
testcase_06 AC 145 ms
88,888 KB
testcase_07 AC 155 ms
88,888 KB
testcase_08 AC 160 ms
88,888 KB
testcase_09 AC 157 ms
88,888 KB
testcase_10 AC 157 ms
88,888 KB
testcase_11 AC 158 ms
88,888 KB
testcase_12 AC 172 ms
88,888 KB
testcase_13 AC 154 ms
88,888 KB
testcase_14 AC 160 ms
88,888 KB
testcase_15 AC 156 ms
88,888 KB
testcase_16 AC 158 ms
88,888 KB
testcase_17 AC 158 ms
88,888 KB
testcase_18 AC 169 ms
88,888 KB
testcase_19 AC 155 ms
88,888 KB
testcase_20 AC 160 ms
88,888 KB
testcase_21 AC 160 ms
88,888 KB
testcase_22 AC 156 ms
88,888 KB
testcase_23 AC 160 ms
88,888 KB
testcase_24 AC 158 ms
88,888 KB
testcase_25 AC 163 ms
88,888 KB
testcase_26 AC 165 ms
88,888 KB
testcase_27 AC 154 ms
88,888 KB
testcase_28 AC 180 ms
88,888 KB
testcase_29 AC 154 ms
88,888 KB
testcase_30 AC 154 ms
88,760 KB
testcase_31 AC 145 ms
88,376 KB
testcase_32 AC 147 ms
88,248 KB
testcase_33 AC 148 ms
88,248 KB
testcase_34 AC 147 ms
88,376 KB
testcase_35 AC 143 ms
88,248 KB
testcase_36 AC 147 ms
88,376 KB
testcase_37 AC 143 ms
88,376 KB
testcase_38 AC 143 ms
88,248 KB
testcase_39 AC 152 ms
88,376 KB
testcase_40 AC 148 ms
88,248 KB
testcase_41 AC 157 ms
88,888 KB
testcase_42 AC 157 ms
88,888 KB
testcase_43 AC 156 ms
88,888 KB
testcase_44 AC 156 ms
88,888 KB
testcase_45 AC 157 ms
88,888 KB
testcase_46 AC 161 ms
88,888 KB
testcase_47 AC 160 ms
88,888 KB
testcase_48 AC 154 ms
88,888 KB
testcase_49 AC 158 ms
88,888 KB
testcase_50 AC 165 ms
88,888 KB
testcase_51 AC 159 ms
88,888 KB
testcase_52 AC 157 ms
88,888 KB
testcase_53 AC 150 ms
88,760 KB
testcase_54 AC 158 ms
88,888 KB
testcase_55 AC 161 ms
88,888 KB
testcase_56 AC 150 ms
88,760 KB
testcase_57 AC 161 ms
88,888 KB
testcase_58 AC 152 ms
88,888 KB
testcase_59 AC 160 ms
88,888 KB
testcase_60 AC 157 ms
88,888 KB
testcase_61 AC 143 ms
84,920 KB
testcase_62 AC 136 ms
84,920 KB
testcase_63 AC 131 ms
84,920 KB
testcase_64 AC 133 ms
84,920 KB
testcase_65 AC 130 ms
84,920 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import collections,sys,math,functools,operator,itertools,bisect,heapq,decimal,string,time,random
#sys.setrecursionlimit(10**9)
#sys.set_int_max_str_digits(0)
#input = sys.stdin.readline
n = int(input())
#alist = list(map(int,input().split()))
#alist = []
s = input()
#n,m = map(int,input().split())
#for i in range(n):
#    alist.append(list(map(int,input().split())))
t = input()

ss = []
tt = []
ab = 0
ac = 0
bc = 0
for i in range(n):
    if s[i] == 'A' and t[i] == 'A':
        continue
    if s[i] == 'A' and t[i] == 'B':
        ab += 1
    if s[i] == 'A' and t[i] == 'C':
        ac += 1
    if s[i] == 'B' and t[i] == 'A':
        print('No')
        exit()
    if s[i] == 'B' and t[i] == 'B':
        continue
    if s[i] == 'B' and t[i] == 'C':
        bc += 1
    if s[i] == 'C' and t[i] == 'A':
        print('No')
        exit()
    if s[i] == 'C' and t[i] == 'B':
        print('No')
        exit()
    if s[i] == 'C' and t[i] == 'C':
        continue
    
if bc == 0:
    if ac == ab == 0:
        print('Yes')
        exit()
    print('No')
    exit()
else:
    ac = 0
    if ab == bc:
        print('Yes')
    else:
        print('No')
    
0