結果

問題 No.921 ずんだアロー
ユーザー koukou
提出日時 2019-11-08 21:30:40
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 269 bytes
コンパイル時間 838 ms
コンパイル使用メモリ 10,720 KB
実行使用メモリ 19,720 KB
最終ジャッジ日時 2023-10-13 03:33:00
合計ジャッジ時間 2,654 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
8,156 KB
testcase_01 AC 16 ms
8,204 KB
testcase_02 AC 16 ms
8,208 KB
testcase_03 AC 16 ms
8,156 KB
testcase_04 AC 16 ms
8,160 KB
testcase_05 AC 16 ms
8,224 KB
testcase_06 AC 16 ms
8,156 KB
testcase_07 AC 16 ms
8,232 KB
testcase_08 AC 15 ms
8,160 KB
testcase_09 AC 15 ms
8,284 KB
testcase_10 AC 120 ms
18,768 KB
testcase_11 WA -
testcase_12 AC 40 ms
10,408 KB
testcase_13 AC 94 ms
15,544 KB
testcase_14 AC 105 ms
16,560 KB
testcase_15 AC 69 ms
13,452 KB
testcase_16 AC 23 ms
8,860 KB
testcase_17 AC 108 ms
17,024 KB
testcase_18 WA -
testcase_19 AC 48 ms
19,460 KB
testcase_20 WA -
testcase_21 AC 48 ms
19,504 KB
testcase_22 WA -
testcase_23 AC 131 ms
19,716 KB
testcase_24 AC 48 ms
19,660 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from itertools import groupby

n, *a = map(int, open(0).read().split())
g = [len(list(g)) for k, g in groupby(a)]
ans1 = ans2 = 0
for i, v in enumerate(g):
	if i % 2:
		ans1 += v
		ans2 += max(v - 2, 0)
	else:
		ans1 += max(v - 2, 0)
		ans2 += v
print(max(ans1, ans2))
0