結果

問題 No.921 ずんだアロー
ユーザー koukou
提出日時 2019-11-08 22:29:19
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 93 ms / 2,000 ms
コード長 228 bytes
コンパイル時間 993 ms
コンパイル使用メモリ 10,600 KB
実行使用メモリ 19,720 KB
最終ジャッジ日時 2023-10-13 04:05:00
合計ジャッジ時間 3,505 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
8,124 KB
testcase_01 AC 16 ms
8,076 KB
testcase_02 AC 16 ms
8,184 KB
testcase_03 AC 16 ms
8,196 KB
testcase_04 AC 16 ms
8,072 KB
testcase_05 AC 15 ms
8,068 KB
testcase_06 AC 15 ms
8,152 KB
testcase_07 AC 16 ms
8,208 KB
testcase_08 AC 16 ms
8,252 KB
testcase_09 AC 16 ms
8,176 KB
testcase_10 AC 87 ms
18,600 KB
testcase_11 AC 91 ms
19,444 KB
testcase_12 AC 32 ms
10,584 KB
testcase_13 AC 69 ms
15,588 KB
testcase_14 AC 76 ms
16,664 KB
testcase_15 AC 51 ms
13,612 KB
testcase_16 AC 21 ms
8,896 KB
testcase_17 AC 78 ms
17,180 KB
testcase_18 AC 46 ms
19,500 KB
testcase_19 AC 47 ms
19,552 KB
testcase_20 AC 47 ms
19,432 KB
testcase_21 AC 47 ms
19,500 KB
testcase_22 AC 47 ms
19,632 KB
testcase_23 AC 93 ms
19,720 KB
testcase_24 AC 48 ms
19,432 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from itertools import groupby

n, *a = map(int, open(0).read().split())
g = [len(list(g)) for k, g in groupby(a)]
ans = 0
flg = 1
for x in g:
	if flg:
		ans += x
		flg = 0
	else:
		ans += x - 1
		if x == 1:
			flg = 1
print(ans)
0