結果

問題 No.1505 Zero-Product Ranges
ユーザー wolgnikwolgnik
提出日時 2021-05-14 22:11:20
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 84 ms / 2,000 ms
コード長 238 bytes
コンパイル時間 273 ms
コンパイル使用メモリ 82,212 KB
実行使用メモリ 101,596 KB
最終ジャッジ日時 2024-04-10 00:28:55
合計ジャッジ時間 4,605 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 38 ms
52,624 KB
testcase_01 AC 33 ms
53,012 KB
testcase_02 AC 34 ms
52,620 KB
testcase_03 AC 77 ms
97,924 KB
testcase_04 AC 70 ms
96,216 KB
testcase_05 AC 55 ms
77,372 KB
testcase_06 AC 55 ms
76,668 KB
testcase_07 AC 53 ms
74,704 KB
testcase_08 AC 53 ms
75,520 KB
testcase_09 AC 52 ms
72,372 KB
testcase_10 AC 48 ms
72,716 KB
testcase_11 AC 51 ms
75,288 KB
testcase_12 AC 46 ms
70,292 KB
testcase_13 AC 56 ms
82,368 KB
testcase_14 AC 55 ms
81,360 KB
testcase_15 AC 69 ms
96,524 KB
testcase_16 AC 78 ms
101,596 KB
testcase_17 AC 81 ms
99,756 KB
testcase_18 AC 84 ms
100,872 KB
testcase_19 AC 36 ms
52,760 KB
testcase_20 AC 36 ms
52,268 KB
testcase_21 AC 37 ms
52,708 KB
testcase_22 AC 80 ms
99,788 KB
testcase_23 AC 82 ms
100,524 KB
testcase_24 AC 77 ms
98,600 KB
testcase_25 AC 76 ms
95,604 KB
testcase_26 AC 81 ms
98,796 KB
testcase_27 AC 76 ms
95,696 KB
testcase_28 AC 76 ms
96,896 KB
testcase_29 AC 77 ms
100,740 KB
testcase_30 AC 79 ms
100,780 KB
testcase_31 AC 75 ms
99,168 KB
testcase_32 AC 58 ms
81,880 KB
testcase_33 AC 58 ms
80,048 KB
testcase_34 AC 61 ms
83,652 KB
testcase_35 AC 57 ms
79,808 KB
testcase_36 AC 54 ms
77,604 KB
testcase_37 AC 59 ms
80,696 KB
testcase_38 AC 56 ms
80,804 KB
testcase_39 AC 60 ms
82,564 KB
testcase_40 AC 60 ms
81,060 KB
testcase_41 AC 60 ms
83,508 KB
testcase_42 AC 44 ms
64,096 KB
testcase_43 AC 48 ms
67,304 KB
testcase_44 AC 43 ms
64,360 KB
testcase_45 AC 45 ms
65,320 KB
testcase_46 AC 44 ms
63,688 KB
testcase_47 AC 45 ms
65,128 KB
testcase_48 AC 45 ms
65,308 KB
testcase_49 AC 45 ms
63,872 KB
testcase_50 AC 43 ms
63,304 KB
testcase_51 AC 44 ms
64,064 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