結果

問題 No.921 ずんだアロー
ユーザー stngstng
提出日時 2022-08-14 19:58:11
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 420 bytes
コンパイル時間 304 ms
コンパイル使用メモリ 81,572 KB
実行使用メモリ 75,464 KB
最終ジャッジ日時 2024-04-08 20:01:31
合計ジャッジ時間 3,301 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 35 ms
53,460 KB
testcase_01 WA -
testcase_02 AC 37 ms
53,460 KB
testcase_03 AC 36 ms
53,460 KB
testcase_04 AC 36 ms
53,460 KB
testcase_05 AC 36 ms
53,460 KB
testcase_06 AC 40 ms
53,460 KB
testcase_07 AC 35 ms
53,460 KB
testcase_08 AC 36 ms
53,460 KB
testcase_09 AC 36 ms
53,460 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 45 ms
62,860 KB
testcase_13 WA -
testcase_14 AC 55 ms
73,196 KB
testcase_15 AC 50 ms
67,904 KB
testcase_16 AC 43 ms
62,108 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 57 ms
75,428 KB
testcase_24 AC 57 ms
75,464 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
a = [int(i) for i in input().split()]

now = 10**9
li = [0]*n

for i in range(n-1):
    if a[i] == a[i+1]:
        li[i] = 1
        li[i+1] = 1
    else:
        continue

idx = 0
for i in range(n):
    if idx+1 >= n:
        break
    if li[idx] == 0 and li[idx+1] == 0:
        li[idx] = 1
        idx += 2
    else:
        idx += 1

if li[n-2] == 0 and li[n-1] == 0:
    li[n-1] = 1

print(sum(li))
0