結果

問題 No.1505 Zero-Product Ranges
ユーザー NatsubiSoganNatsubiSogan
提出日時 2021-05-14 22:14:18
言語 Python3
(3.11.6 + numpy 1.26.0 + scipy 1.11.3)
結果
AC  
実行時間 102 ms / 2,000 ms
コード長 239 bytes
コンパイル時間 225 ms
コンパイル使用メモリ 10,536 KB
実行使用メモリ 11,416 KB
最終ジャッジ日時 2023-07-25 07:04:52
合計ジャッジ時間 5,365 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
7,952 KB
testcase_01 AC 16 ms
7,816 KB
testcase_02 AC 15 ms
7,808 KB
testcase_03 AC 82 ms
11,352 KB
testcase_04 AC 102 ms
11,264 KB
testcase_05 AC 42 ms
9,320 KB
testcase_06 AC 40 ms
9,344 KB
testcase_07 AC 34 ms
8,992 KB
testcase_08 AC 38 ms
8,960 KB
testcase_09 AC 36 ms
9,044 KB
testcase_10 AC 42 ms
9,096 KB
testcase_11 AC 49 ms
9,436 KB
testcase_12 AC 38 ms
8,912 KB
testcase_13 AC 66 ms
10,320 KB
testcase_14 AC 63 ms
10,060 KB
testcase_15 AC 94 ms
11,348 KB
testcase_16 AC 96 ms
11,220 KB
testcase_17 AC 94 ms
11,236 KB
testcase_18 AC 95 ms
11,332 KB
testcase_19 AC 15 ms
7,780 KB
testcase_20 AC 16 ms
7,784 KB
testcase_21 AC 16 ms
7,828 KB
testcase_22 AC 94 ms
11,220 KB
testcase_23 AC 94 ms
11,284 KB
testcase_24 AC 89 ms
11,224 KB
testcase_25 AC 87 ms
11,196 KB
testcase_26 AC 91 ms
11,416 KB
testcase_27 AC 87 ms
11,204 KB
testcase_28 AC 89 ms
11,384 KB
testcase_29 AC 93 ms
11,336 KB
testcase_30 AC 94 ms
11,236 KB
testcase_31 AC 89 ms
11,292 KB
testcase_32 AC 56 ms
9,948 KB
testcase_33 AC 54 ms
9,708 KB
testcase_34 AC 58 ms
10,172 KB
testcase_35 AC 48 ms
9,472 KB
testcase_36 AC 49 ms
9,320 KB
testcase_37 AC 56 ms
9,860 KB
testcase_38 AC 53 ms
9,600 KB
testcase_39 AC 52 ms
9,632 KB
testcase_40 AC 56 ms
9,956 KB
testcase_41 AC 60 ms
10,180 KB
testcase_42 AC 20 ms
8,168 KB
testcase_43 AC 22 ms
8,248 KB
testcase_44 AC 22 ms
8,152 KB
testcase_45 AC 22 ms
8,216 KB
testcase_46 AC 19 ms
8,336 KB
testcase_47 AC 24 ms
8,388 KB
testcase_48 AC 20 ms
8,156 KB
testcase_49 AC 18 ms
8,200 KB
testcase_50 AC 21 ms
8,344 KB
testcase_51 AC 23 ms
8,312 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
a = list(map(int, input().split()))
ans = 0
cur = 0
for i in range(n):
    if a[i] == 1:
        cur += 1
    else:
        ans += cur * (cur + 1) // 2
        cur = 0
print(n * (n + 1) // 2 - (ans + cur * (cur + 1) // 2))
0