結果

問題 No.1183 コイン遊び
ユーザー tktk_snsntktk_snsn
提出日時 2021-04-25 16:28:35
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 1,032 ms / 2,000 ms
コード長 465 bytes
コンパイル時間 260 ms
コンパイル使用メモリ 10,744 KB
実行使用メモリ 105,372 KB
最終ジャッジ日時 2023-09-17 14:08:42
合計ジャッジ時間 21,585 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,816 KB
testcase_01 AC 17 ms
7,848 KB
testcase_02 AC 16 ms
7,944 KB
testcase_03 AC 15 ms
7,988 KB
testcase_04 AC 15 ms
7,880 KB
testcase_05 AC 15 ms
7,764 KB
testcase_06 AC 16 ms
7,812 KB
testcase_07 AC 16 ms
7,812 KB
testcase_08 AC 17 ms
7,792 KB
testcase_09 AC 17 ms
7,940 KB
testcase_10 AC 34 ms
9,324 KB
testcase_11 AC 68 ms
11,720 KB
testcase_12 AC 570 ms
46,128 KB
testcase_13 AC 513 ms
41,712 KB
testcase_14 AC 847 ms
65,316 KB
testcase_15 AC 896 ms
69,668 KB
testcase_16 AC 899 ms
69,360 KB
testcase_17 AC 899 ms
69,728 KB
testcase_18 AC 898 ms
71,092 KB
testcase_19 AC 907 ms
70,780 KB
testcase_20 AC 906 ms
71,736 KB
testcase_21 AC 671 ms
33,892 KB
testcase_22 AC 673 ms
35,140 KB
testcase_23 AC 685 ms
35,936 KB
testcase_24 AC 682 ms
35,784 KB
testcase_25 AC 902 ms
70,672 KB
testcase_26 AC 902 ms
70,708 KB
testcase_27 AC 904 ms
71,708 KB
testcase_28 AC 902 ms
70,780 KB
testcase_29 AC 671 ms
34,940 KB
testcase_30 AC 1,032 ms
105,372 KB
testcase_31 AC 911 ms
70,888 KB
testcase_32 AC 914 ms
70,848 KB
testcase_33 AC 904 ms
69,804 KB
testcase_34 AC 904 ms
69,568 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def RunLengthEncoding(S):
    res = []
    N = len(S)
    i = 0
    while i < N:
        cnt = 1
        while i < N - 1 and S[i] == S[i + 1]:
            cnt += 1
            i += 1
        res.append((S[i], cnt))
        i += 1
    return res


N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

dif = [int(a != b) for a, b in zip(A, B)]
ans = 0
for k, v in RunLengthEncoding(dif):
    if k == 1:
        ans += 1
print(ans)
0