結果

問題 No.2209 Flip and Reverse
ユーザー AngrySadEightAngrySadEight
提出日時 2022-12-27 15:17:29
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 709 ms / 2,000 ms
コード長 386 bytes
コンパイル時間 250 ms
コンパイル使用メモリ 12,800 KB
実行使用メモリ 14,780 KB
最終ジャッジ日時 2024-05-01 18:59:26
合計ジャッジ時間 15,890 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 34 ms
10,752 KB
testcase_01 AC 30 ms
10,752 KB
testcase_02 AC 29 ms
10,752 KB
testcase_03 AC 29 ms
10,752 KB
testcase_04 AC 28 ms
10,752 KB
testcase_05 AC 30 ms
10,752 KB
testcase_06 AC 28 ms
10,752 KB
testcase_07 AC 28 ms
10,752 KB
testcase_08 AC 675 ms
14,648 KB
testcase_09 AC 28 ms
10,752 KB
testcase_10 AC 28 ms
10,752 KB
testcase_11 AC 29 ms
10,752 KB
testcase_12 AC 29 ms
10,880 KB
testcase_13 AC 28 ms
10,752 KB
testcase_14 AC 680 ms
14,652 KB
testcase_15 AC 676 ms
14,652 KB
testcase_16 AC 709 ms
14,780 KB
testcase_17 AC 686 ms
14,656 KB
testcase_18 AC 628 ms
14,648 KB
testcase_19 AC 614 ms
14,652 KB
testcase_20 AC 680 ms
14,648 KB
testcase_21 AC 684 ms
14,652 KB
testcase_22 AC 679 ms
14,644 KB
testcase_23 AC 633 ms
14,652 KB
testcase_24 AC 596 ms
14,652 KB
testcase_25 AC 683 ms
14,648 KB
testcase_26 AC 630 ms
14,672 KB
testcase_27 AC 616 ms
14,648 KB
testcase_28 AC 593 ms
14,648 KB
testcase_29 AC 608 ms
14,648 KB
testcase_30 AC 569 ms
14,656 KB
testcase_31 AC 709 ms
14,652 KB
testcase_32 AC 573 ms
14,776 KB
testcase_33 AC 662 ms
14,640 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
S = str(input())
T = str(input())

parity_s = 0
parity_t = 0
for i in range(N):
    if S[i] == '1':
        parity_s += 1
    if T[i] == '1':
        parity_t += 1

ans = 0
if parity_s % 2 != parity_t % 2:
    for i in range(N):
        if S[i] != T[N - 1 - i]:
            ans += 1
else:
    for i in range(N):
        if S[i] != T[i]:
            ans += 1

print(ans)
0