結果

問題 No.1505 Zero-Product Ranges
ユーザー ireenaireena
提出日時 2022-02-21 11:00:43
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 107 ms / 2,000 ms
コード長 159 bytes
コンパイル時間 157 ms
コンパイル使用メモリ 10,556 KB
実行使用メモリ 11,420 KB
最終ジャッジ日時 2023-09-12 02:07:20
合計ジャッジ時間 5,407 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
8,120 KB
testcase_01 AC 16 ms
8,092 KB
testcase_02 AC 16 ms
8,212 KB
testcase_03 AC 51 ms
11,420 KB
testcase_04 AC 51 ms
11,368 KB
testcase_05 AC 30 ms
9,088 KB
testcase_06 AC 29 ms
9,024 KB
testcase_07 AC 26 ms
8,716 KB
testcase_08 AC 28 ms
8,860 KB
testcase_09 AC 27 ms
8,852 KB
testcase_10 AC 28 ms
8,752 KB
testcase_11 AC 31 ms
8,976 KB
testcase_12 AC 26 ms
8,680 KB
testcase_13 AC 37 ms
9,648 KB
testcase_14 AC 35 ms
9,536 KB
testcase_15 AC 49 ms
11,248 KB
testcase_16 AC 105 ms
10,128 KB
testcase_17 AC 107 ms
10,016 KB
testcase_18 AC 107 ms
10,092 KB
testcase_19 AC 16 ms
8,164 KB
testcase_20 AC 16 ms
8,160 KB
testcase_21 AC 16 ms
8,180 KB
testcase_22 AC 104 ms
10,188 KB
testcase_23 AC 102 ms
10,120 KB
testcase_24 AC 101 ms
10,144 KB
testcase_25 AC 97 ms
10,144 KB
testcase_26 AC 101 ms
10,232 KB
testcase_27 AC 99 ms
10,252 KB
testcase_28 AC 100 ms
10,280 KB
testcase_29 AC 105 ms
10,164 KB
testcase_30 AC 107 ms
10,208 KB
testcase_31 AC 102 ms
10,148 KB
testcase_32 AC 62 ms
9,528 KB
testcase_33 AC 58 ms
9,076 KB
testcase_34 AC 64 ms
9,512 KB
testcase_35 AC 53 ms
8,992 KB
testcase_36 AC 54 ms
9,144 KB
testcase_37 AC 61 ms
9,336 KB
testcase_38 AC 57 ms
9,164 KB
testcase_39 AC 57 ms
9,076 KB
testcase_40 AC 61 ms
9,272 KB
testcase_41 AC 67 ms
9,580 KB
testcase_42 AC 21 ms
8,344 KB
testcase_43 AC 24 ms
8,368 KB
testcase_44 AC 23 ms
8,292 KB
testcase_45 AC 24 ms
8,320 KB
testcase_46 AC 20 ms
8,260 KB
testcase_47 AC 25 ms
8,228 KB
testcase_48 AC 21 ms
8,244 KB
testcase_49 AC 19 ms
8,340 KB
testcase_50 AC 22 ms
8,424 KB
testcase_51 AC 24 ms
8,472 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from itertools import groupby
N = int(input())
ans = N*(N+1)//2
for v, g in groupby(map(int, input().split())):
    ans -= (l:=len([*g]))*(l+1)//2*v
print(ans)
0