結果

問題 No.2209 Flip and Reverse
ユーザー FromBooskaFromBooska
提出日時 2023-02-22 08:52:43
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 129 ms / 2,000 ms
コード長 697 bytes
コンパイル時間 1,100 ms
コンパイル使用メモリ 87,120 KB
実行使用メモリ 83,488 KB
最終ジャッジ日時 2023-09-29 18:24:31
合計ジャッジ時間 8,407 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
71,396 KB
testcase_01 AC 71 ms
71,320 KB
testcase_02 AC 73 ms
71,412 KB
testcase_03 AC 70 ms
71,100 KB
testcase_04 AC 76 ms
71,324 KB
testcase_05 AC 76 ms
71,420 KB
testcase_06 AC 77 ms
71,160 KB
testcase_07 AC 73 ms
71,288 KB
testcase_08 AC 119 ms
83,028 KB
testcase_09 AC 74 ms
71,428 KB
testcase_10 AC 76 ms
71,340 KB
testcase_11 AC 75 ms
71,340 KB
testcase_12 AC 73 ms
71,528 KB
testcase_13 AC 72 ms
71,412 KB
testcase_14 AC 129 ms
83,468 KB
testcase_15 AC 128 ms
83,196 KB
testcase_16 AC 129 ms
83,344 KB
testcase_17 AC 129 ms
83,464 KB
testcase_18 AC 127 ms
83,416 KB
testcase_19 AC 128 ms
83,188 KB
testcase_20 AC 126 ms
83,172 KB
testcase_21 AC 129 ms
83,448 KB
testcase_22 AC 126 ms
83,380 KB
testcase_23 AC 126 ms
83,328 KB
testcase_24 AC 123 ms
83,488 KB
testcase_25 AC 123 ms
83,284 KB
testcase_26 AC 122 ms
83,300 KB
testcase_27 AC 123 ms
83,244 KB
testcase_28 AC 114 ms
83,220 KB
testcase_29 AC 113 ms
83,480 KB
testcase_30 AC 113 ms
83,384 KB
testcase_31 AC 112 ms
83,176 KB
testcase_32 AC 110 ms
83,164 KB
testcase_33 AC 119 ms
83,096 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

# S head, S tailを用意し、それぞれTと何個違うかdiffを数える
# headで合うためにはdiffは偶数必要、tailで合うためにはdiffは奇数必要
# 偶数のhead diff, 奇数のtail diffで小さいほうが答え
# 両方ない場合もあるのだろうか。。。

N = int(input())
S_head = input()
S_tail = S_head[::-1]
T = input()

S_head_diff = 0
for i in range(N):
    if S_head[i] != T[i]:
        S_head_diff += 1

S_tail_diff = 0
for i in range(N):
    if S_tail[i] != T[i]:
        S_tail_diff += 1

ans_list = []
if S_head_diff %2 == 0:
    ans_list.append(S_head_diff)
if S_tail_diff %2 == 1:
    ans_list.append(S_tail_diff)
ans = min(ans_list)
print(ans)
0