結果

問題 No.2629 A replace B replace C
ユーザー flygonflygon
提出日時 2024-02-16 22:16:30
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 600 bytes
コンパイル時間 322 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 66,556 KB
最終ジャッジ日時 2024-02-16 22:16:36
合計ジャッジ時間 5,996 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 51 ms
64,480 KB
testcase_01 AC 56 ms
65,988 KB
testcase_02 AC 61 ms
65,988 KB
testcase_03 AC 58 ms
66,556 KB
testcase_04 AC 56 ms
65,996 KB
testcase_05 AC 56 ms
65,988 KB
testcase_06 AC 53 ms
63,792 KB
testcase_07 AC 56 ms
65,988 KB
testcase_08 AC 53 ms
63,772 KB
testcase_09 AC 52 ms
63,740 KB
testcase_10 AC 56 ms
65,980 KB
testcase_11 AC 57 ms
65,980 KB
testcase_12 AC 56 ms
65,980 KB
testcase_13 AC 56 ms
65,992 KB
testcase_14 AC 52 ms
63,772 KB
testcase_15 AC 57 ms
65,980 KB
testcase_16 AC 55 ms
65,988 KB
testcase_17 AC 56 ms
65,988 KB
testcase_18 AC 55 ms
65,984 KB
testcase_19 AC 56 ms
65,992 KB
testcase_20 AC 55 ms
65,988 KB
testcase_21 AC 52 ms
63,740 KB
testcase_22 AC 49 ms
63,792 KB
testcase_23 AC 49 ms
63,732 KB
testcase_24 AC 51 ms
63,740 KB
testcase_25 AC 51 ms
63,772 KB
testcase_26 AC 48 ms
63,780 KB
testcase_27 AC 49 ms
63,792 KB
testcase_28 AC 49 ms
63,740 KB
testcase_29 AC 50 ms
63,792 KB
testcase_30 AC 49 ms
63,796 KB
testcase_31 AC 55 ms
65,980 KB
testcase_32 AC 53 ms
65,860 KB
testcase_33 AC 55 ms
66,488 KB
testcase_34 AC 52 ms
65,860 KB
testcase_35 AC 51 ms
65,864 KB
testcase_36 AC 54 ms
66,528 KB
testcase_37 AC 55 ms
65,852 KB
testcase_38 AC 56 ms
65,980 KB
testcase_39 AC 54 ms
65,860 KB
testcase_40 AC 55 ms
65,852 KB
testcase_41 AC 49 ms
63,792 KB
testcase_42 WA -
testcase_43 AC 52 ms
63,772 KB
testcase_44 WA -
testcase_45 AC 49 ms
63,728 KB
testcase_46 AC 53 ms
64,312 KB
testcase_47 AC 50 ms
63,772 KB
testcase_48 WA -
testcase_49 AC 49 ms
63,792 KB
testcase_50 AC 49 ms
63,772 KB
testcase_51 AC 52 ms
63,788 KB
testcase_52 WA -
testcase_53 WA -
testcase_54 WA -
testcase_55 WA -
testcase_56 WA -
testcase_57 AC 53 ms
63,772 KB
testcase_58 WA -
testcase_59 AC 50 ms
63,728 KB
testcase_60 WA -
testcase_61 AC 41 ms
55,592 KB
testcase_62 AC 41 ms
55,592 KB
testcase_63 AC 44 ms
55,592 KB
testcase_64 AC 42 ms
55,592 KB
testcase_65 AC 40 ms
55,592 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
sys.setrecursionlimit(5*10**5)
input = sys.stdin.readline
from collections import defaultdict, deque, Counter
from heapq import heappop, heappush
from bisect import bisect_left, bisect_right
from math import gcd

n = int(input())
s = input().rstrip()
t = input().rstrip()

all = 0
ok = 1
cnt = 0
for i in range(n):
    if (ord(s[i])) > ord(t[i]):
        ok = 0
    all += ord(t[i]) - ord(s[i])
    cnt += (ord(t[i]) - ord(s[i])) >= 1

if ok and all% 2 == 0:
    if all == 0:
        print('Yes')
    elif cnt == 1:
        print('No')
    else:
        print('Yes')

else:
    print('No')
0