結果

問題 No.2629 A replace B replace C
ユーザー 👑 tipstar0125tipstar0125
提出日時 2024-02-19 16:45:21
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 397 bytes
コンパイル時間 349 ms
コンパイル使用メモリ 81,572 KB
実行使用メモリ 94,456 KB
最終ジャッジ日時 2024-02-19 16:45:28
合計ジャッジ時間 6,193 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 79 ms
94,456 KB
testcase_01 AC 43 ms
70,596 KB
testcase_02 AC 44 ms
70,384 KB
testcase_03 AC 48 ms
77,612 KB
testcase_04 AC 39 ms
62,464 KB
testcase_05 AC 44 ms
68,116 KB
testcase_06 AC 41 ms
65,772 KB
testcase_07 AC 44 ms
71,108 KB
testcase_08 WA -
testcase_09 AC 68 ms
86,964 KB
testcase_10 AC 44 ms
73,204 KB
testcase_11 AC 52 ms
78,388 KB
testcase_12 AC 47 ms
76,180 KB
testcase_13 AC 44 ms
69,988 KB
testcase_14 AC 67 ms
86,172 KB
testcase_15 AC 55 ms
74,148 KB
testcase_16 AC 43 ms
70,224 KB
testcase_17 AC 44 ms
70,920 KB
testcase_18 AC 52 ms
73,348 KB
testcase_19 AC 41 ms
67,800 KB
testcase_20 AC 43 ms
70,276 KB
testcase_21 AC 71 ms
85,740 KB
testcase_22 AC 71 ms
82,536 KB
testcase_23 WA -
testcase_24 AC 68 ms
85,580 KB
testcase_25 AC 66 ms
83,712 KB
testcase_26 WA -
testcase_27 AC 62 ms
81,332 KB
testcase_28 WA -
testcase_29 WA -
testcase_30 AC 50 ms
73,916 KB
testcase_31 AC 42 ms
65,436 KB
testcase_32 AC 39 ms
65,328 KB
testcase_33 AC 45 ms
69,256 KB
testcase_34 AC 37 ms
62,648 KB
testcase_35 AC 37 ms
65,044 KB
testcase_36 AC 40 ms
68,580 KB
testcase_37 AC 38 ms
67,840 KB
testcase_38 AC 39 ms
67,804 KB
testcase_39 AC 37 ms
64,804 KB
testcase_40 AC 37 ms
65,472 KB
testcase_41 AC 49 ms
73,648 KB
testcase_42 AC 56 ms
77,892 KB
testcase_43 AC 52 ms
77,452 KB
testcase_44 AC 52 ms
76,884 KB
testcase_45 AC 57 ms
80,228 KB
testcase_46 AC 65 ms
80,704 KB
testcase_47 AC 51 ms
76,948 KB
testcase_48 AC 52 ms
75,620 KB
testcase_49 AC 47 ms
70,656 KB
testcase_50 AC 55 ms
78,928 KB
testcase_51 WA -
testcase_52 AC 51 ms
71,988 KB
testcase_53 AC 41 ms
65,084 KB
testcase_54 AC 44 ms
67,528 KB
testcase_55 AC 39 ms
67,768 KB
testcase_56 AC 39 ms
64,880 KB
testcase_57 WA -
testcase_58 AC 41 ms
67,880 KB
testcase_59 AC 69 ms
86,596 KB
testcase_60 AC 43 ms
69,252 KB
testcase_61 AC 31 ms
53,332 KB
testcase_62 AC 31 ms
53,332 KB
testcase_63 AC 31 ms
53,332 KB
testcase_64 AC 32 ms
53,332 KB
testcase_65 AC 31 ms
53,332 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N=int(input())
S=list(input())
T=list(input())
QA=[]
QB=[]
for i in range(N):
    if S[i]>T[i]:
        print("No")
        exit(0)
    if S[i]<T[i]:
        if S[i]=="A":QA.append(i)
        elif S[i]=="B":QB.append(i)

while len(QA)*len(QB):
    a_idx=QA.pop()
    b_idx=QB.pop()
    S[a_idx]="B"
    S[b_idx]="C"
    if S[a_idx]!=T[a_idx]:QB.append(a_idx)

if S==T:print("Yes")
else:print("No")
0