結果

問題 No.1505 Zero-Product Ranges
ユーザー wolgnikwolgnik
提出日時 2021-05-14 22:11:20
言語 PyPy3
(7.3.13)
結果
AC  
実行時間 119 ms / 2,000 ms
コード長 238 bytes
コンパイル時間 1,060 ms
コンパイル使用メモリ 86,700 KB
実行使用メモリ 104,252 KB
最終ジャッジ日時 2023-07-25 06:58:16
合計ジャッジ時間 8,354 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 74 ms
71,372 KB
testcase_01 AC 73 ms
71,216 KB
testcase_02 AC 74 ms
71,416 KB
testcase_03 AC 119 ms
103,724 KB
testcase_04 AC 109 ms
103,668 KB
testcase_05 AC 97 ms
85,728 KB
testcase_06 AC 93 ms
85,496 KB
testcase_07 AC 91 ms
83,028 KB
testcase_08 AC 94 ms
84,316 KB
testcase_09 AC 89 ms
83,288 KB
testcase_10 AC 87 ms
84,268 KB
testcase_11 AC 87 ms
85,472 KB
testcase_12 AC 87 ms
81,956 KB
testcase_13 AC 95 ms
92,544 KB
testcase_14 AC 96 ms
90,372 KB
testcase_15 AC 106 ms
103,800 KB
testcase_16 AC 114 ms
104,064 KB
testcase_17 AC 114 ms
103,980 KB
testcase_18 AC 119 ms
104,252 KB
testcase_19 AC 73 ms
71,064 KB
testcase_20 AC 72 ms
71,232 KB
testcase_21 AC 71 ms
71,120 KB
testcase_22 AC 115 ms
103,976 KB
testcase_23 AC 119 ms
104,040 KB
testcase_24 AC 114 ms
103,940 KB
testcase_25 AC 111 ms
100,648 KB
testcase_26 AC 113 ms
103,860 KB
testcase_27 AC 109 ms
100,688 KB
testcase_28 AC 114 ms
100,796 KB
testcase_29 AC 116 ms
103,876 KB
testcase_30 AC 118 ms
104,052 KB
testcase_31 AC 116 ms
103,736 KB
testcase_32 AC 97 ms
88,548 KB
testcase_33 AC 97 ms
88,648 KB
testcase_34 AC 101 ms
90,768 KB
testcase_35 AC 95 ms
85,832 KB
testcase_36 AC 95 ms
87,196 KB
testcase_37 AC 98 ms
88,784 KB
testcase_38 AC 97 ms
88,700 KB
testcase_39 AC 105 ms
88,884 KB
testcase_40 AC 98 ms
88,784 KB
testcase_41 AC 99 ms
90,440 KB
testcase_42 AC 84 ms
76,052 KB
testcase_43 AC 87 ms
76,900 KB
testcase_44 AC 82 ms
76,244 KB
testcase_45 AC 83 ms
76,556 KB
testcase_46 AC 86 ms
76,372 KB
testcase_47 AC 85 ms
76,896 KB
testcase_48 AC 84 ms
76,132 KB
testcase_49 AC 83 ms
76,500 KB
testcase_50 AC 83 ms
76,120 KB
testcase_51 AC 84 ms
76,292 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline
N = int(input())
a = list(map(int, input().split()))
res = N * (N + 1) // 2
r = 0
for l in range(N):
  if a[l] == 0: continue
  if r < l: r = l
  while r < N and a[r]: r += 1
  res -= r - l
print(res)
0