結果

問題 No.2209 Flip and Reverse
ユーザー lloyzlloyz
提出日時 2023-02-10 21:58:38
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 428 bytes
コンパイル時間 277 ms
コンパイル使用メモリ 87,056 KB
実行使用メモリ 166,260 KB
最終ジャッジ日時 2023-09-21 23:12:39
合計ジャッジ時間 7,176 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
71,552 KB
testcase_01 AC 73 ms
71,384 KB
testcase_02 AC 74 ms
71,484 KB
testcase_03 AC 71 ms
71,600 KB
testcase_04 AC 72 ms
71,500 KB
testcase_05 AC 70 ms
71,316 KB
testcase_06 AC 73 ms
71,320 KB
testcase_07 AC 72 ms
71,300 KB
testcase_08 WA -
testcase_09 AC 70 ms
71,580 KB
testcase_10 AC 72 ms
71,308 KB
testcase_11 AC 72 ms
71,584 KB
testcase_12 AC 71 ms
71,496 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
S = list(input())
T = list(input())

ans = 0
flip = 0
for i in range(n // 2):
    if S[i] != T[n - i - 1] and S[n - i - 1] != T[i]:
        if S[i] == S[n - i - 1]:
            ans += 2
        else:
            flip = 1
    elif S[i] != T[n - i - 1] or S[n - i - 1] != T[i]:
        ans += 1
if n % 2 == 1:
    if S[n // 2] != T[n // 2]:
        ans += 1
if ans % 2 == 0 and flip == 1:
    ans += 2
print(ans)
0