結果

問題 No.2629 A replace B replace C
ユーザー anonymouslyanonymously
提出日時 2024-02-16 22:59:16
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 635 bytes
コンパイル時間 141 ms
コンパイル使用メモリ 11,904 KB
実行使用メモリ 10,864 KB
最終ジャッジ日時 2024-02-16 22:59:22
合計ジャッジ時間 5,050 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 31 ms
10,864 KB
testcase_01 AC 44 ms
10,368 KB
testcase_02 AC 43 ms
10,368 KB
testcase_03 AC 50 ms
10,624 KB
testcase_04 AC 35 ms
10,240 KB
testcase_05 AC 36 ms
10,368 KB
testcase_06 AC 29 ms
10,240 KB
testcase_07 AC 52 ms
10,368 KB
testcase_08 AC 60 ms
10,496 KB
testcase_09 AC 66 ms
10,496 KB
testcase_10 AC 40 ms
10,496 KB
testcase_11 AC 66 ms
10,496 KB
testcase_12 AC 44 ms
10,624 KB
testcase_13 AC 44 ms
10,240 KB
testcase_14 AC 65 ms
10,496 KB
testcase_15 AC 51 ms
10,368 KB
testcase_16 AC 37 ms
10,368 KB
testcase_17 AC 38 ms
10,496 KB
testcase_18 AC 46 ms
10,496 KB
testcase_19 AC 38 ms
10,368 KB
testcase_20 AC 41 ms
10,368 KB
testcase_21 AC 64 ms
10,496 KB
testcase_22 AC 54 ms
10,368 KB
testcase_23 AC 65 ms
10,496 KB
testcase_24 AC 63 ms
10,496 KB
testcase_25 AC 62 ms
10,496 KB
testcase_26 AC 56 ms
10,368 KB
testcase_27 AC 53 ms
10,368 KB
testcase_28 AC 62 ms
10,496 KB
testcase_29 AC 52 ms
10,368 KB
testcase_30 AC 41 ms
10,240 KB
testcase_31 AC 27 ms
10,624 KB
testcase_32 AC 28 ms
10,496 KB
testcase_33 AC 30 ms
10,724 KB
testcase_34 AC 28 ms
10,368 KB
testcase_35 AC 28 ms
10,496 KB
testcase_36 AC 28 ms
10,624 KB
testcase_37 AC 29 ms
10,496 KB
testcase_38 AC 29 ms
10,624 KB
testcase_39 AC 28 ms
10,368 KB
testcase_40 AC 27 ms
10,624 KB
testcase_41 AC 59 ms
10,368 KB
testcase_42 AC 62 ms
10,496 KB
testcase_43 AC 58 ms
10,496 KB
testcase_44 AC 61 ms
10,368 KB
testcase_45 AC 70 ms
10,496 KB
testcase_46 AC 76 ms
10,624 KB
testcase_47 AC 61 ms
10,496 KB
testcase_48 AC 53 ms
10,368 KB
testcase_49 AC 53 ms
10,368 KB
testcase_50 AC 66 ms
10,496 KB
testcase_51 AC 58 ms
10,368 KB
testcase_52 WA -
testcase_53 WA -
testcase_54 WA -
testcase_55 WA -
testcase_56 WA -
testcase_57 AC 56 ms
10,496 KB
testcase_58 WA -
testcase_59 AC 68 ms
10,496 KB
testcase_60 WA -
testcase_61 AC 28 ms
10,112 KB
testcase_62 AC 30 ms
10,112 KB
testcase_63 AC 28 ms
10,112 KB
testcase_64 AC 27 ms
10,112 KB
testcase_65 AC 28 ms
10,112 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def func(n,s,t):
    if s==t:
        return True
    a=b=c=0
    x=y=z=0
    for i in range(n):
        if s[i]>t[i]:
            return False
        if s[i]=='A':
            a+=1
        elif s[i]=='B':
            b+=1
        elif s[i]=='C':
            c+=1
        if t[i]=='A':
            x+=1
        elif t[i]=='B':
            y+=1
        elif t[i]=='C':
            z+=1
    if a<=x or b==0 or y==0 or b!=y or c>=z:
        return False
    p=b+2*c
    q=y+2*z
    if p>=q:
        return False
    elif (q-p)%2:
        return False
    return a-(q-p)//2==x

print("Yes" if func(int(input()),input(),input()) else "No")
0