結果
問題 |
No.1183 コイン遊び
|
ユーザー |
![]() |
提出日時 | 2021-04-25 16:28:35 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 1,091 ms / 2,000 ms |
コード長 | 465 bytes |
コンパイル時間 | 201 ms |
コンパイル使用メモリ | 12,544 KB |
実行使用メモリ | 110,808 KB |
最終ジャッジ日時 | 2024-07-04 09:30:34 |
合計ジャッジ時間 | 23,212 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 32 |
ソースコード
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)