結果

問題 No.1505 Zero-Product Ranges
ユーザー otsunekootsuneko
提出日時 2021-05-14 23:40:33
言語 PyPy3
(7.3.8)
結果
AC  
実行時間 120 ms / 2,000 ms
コード長 177 bytes
コンパイル時間 380 ms
使用メモリ 109,124 KB
最終ジャッジ日時 2022-11-25 23:19:03
合計ジャッジ時間 7,876 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
使用メモリ
testcase_00 AC 82 ms
75,484 KB
testcase_01 AC 80 ms
75,460 KB
testcase_02 AC 82 ms
75,436 KB
testcase_03 AC 115 ms
108,908 KB
testcase_04 AC 117 ms
109,124 KB
testcase_05 AC 101 ms
90,400 KB
testcase_06 AC 98 ms
90,392 KB
testcase_07 AC 95 ms
87,764 KB
testcase_08 AC 96 ms
88,780 KB
testcase_09 AC 94 ms
87,872 KB
testcase_10 AC 95 ms
88,768 KB
testcase_11 AC 100 ms
90,408 KB
testcase_12 AC 95 ms
86,804 KB
testcase_13 AC 103 ms
97,396 KB
testcase_14 AC 102 ms
95,404 KB
testcase_15 AC 116 ms
108,620 KB
testcase_16 AC 119 ms
109,020 KB
testcase_17 AC 120 ms
108,732 KB
testcase_18 AC 119 ms
108,764 KB
testcase_19 AC 83 ms
75,496 KB
testcase_20 AC 84 ms
75,560 KB
testcase_21 AC 84 ms
75,548 KB
testcase_22 AC 116 ms
108,972 KB
testcase_23 AC 116 ms
109,044 KB
testcase_24 AC 115 ms
108,920 KB
testcase_25 AC 113 ms
105,552 KB
testcase_26 AC 116 ms
108,548 KB
testcase_27 AC 115 ms
105,652 KB
testcase_28 AC 113 ms
105,780 KB
testcase_29 AC 118 ms
108,684 KB
testcase_30 AC 118 ms
108,936 KB
testcase_31 AC 118 ms
108,840 KB
testcase_32 AC 103 ms
93,560 KB
testcase_33 AC 103 ms
93,544 KB
testcase_34 AC 106 ms
95,400 KB
testcase_35 AC 100 ms
90,132 KB
testcase_36 AC 100 ms
91,888 KB
testcase_37 AC 102 ms
93,668 KB
testcase_38 AC 102 ms
93,612 KB
testcase_39 AC 102 ms
93,196 KB
testcase_40 AC 102 ms
93,620 KB
testcase_41 AC 105 ms
95,492 KB
testcase_42 AC 89 ms
80,848 KB
testcase_43 AC 90 ms
81,452 KB
testcase_44 AC 89 ms
80,688 KB
testcase_45 AC 90 ms
81,304 KB
testcase_46 AC 88 ms
80,932 KB
testcase_47 AC 89 ms
81,240 KB
testcase_48 AC 89 ms
80,824 KB
testcase_49 AC 89 ms
80,664 KB
testcase_50 AC 89 ms
80,924 KB
testcase_51 AC 91 ms
81,320 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
A = list(map(int,input().split()))

ans = 0
prev = 0
for i in range(N):
    if A[i] == 0:
        ans += (i-prev+1)*(N-i)
        prev = i+1
print(ans)
0