結果

問題 No.1505 Zero-Product Ranges
ユーザー gorugo30gorugo30
提出日時 2021-05-14 22:07:43
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 78 ms / 2,000 ms
コード長 242 bytes
コンパイル時間 436 ms
コンパイル使用メモリ 82,576 KB
実行使用メモリ 98,492 KB
最終ジャッジ日時 2024-04-10 00:22:50
合計ジャッジ時間 4,533 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 36 ms
52,960 KB
testcase_01 AC 36 ms
53,088 KB
testcase_02 AC 39 ms
52,792 KB
testcase_03 AC 78 ms
97,648 KB
testcase_04 AC 71 ms
97,036 KB
testcase_05 AC 52 ms
75,004 KB
testcase_06 AC 51 ms
75,044 KB
testcase_07 AC 50 ms
71,760 KB
testcase_08 AC 51 ms
73,524 KB
testcase_09 AC 49 ms
70,908 KB
testcase_10 AC 50 ms
73,416 KB
testcase_11 AC 53 ms
74,916 KB
testcase_12 AC 47 ms
69,780 KB
testcase_13 AC 61 ms
83,516 KB
testcase_14 AC 58 ms
80,020 KB
testcase_15 AC 71 ms
96,168 KB
testcase_16 AC 73 ms
97,844 KB
testcase_17 AC 73 ms
97,680 KB
testcase_18 AC 72 ms
98,492 KB
testcase_19 AC 35 ms
52,708 KB
testcase_20 AC 35 ms
52,084 KB
testcase_21 AC 36 ms
53,244 KB
testcase_22 AC 74 ms
97,544 KB
testcase_23 AC 73 ms
97,364 KB
testcase_24 AC 72 ms
96,896 KB
testcase_25 AC 68 ms
94,588 KB
testcase_26 AC 73 ms
97,908 KB
testcase_27 AC 71 ms
94,380 KB
testcase_28 AC 71 ms
93,716 KB
testcase_29 AC 75 ms
97,812 KB
testcase_30 AC 75 ms
97,288 KB
testcase_31 AC 73 ms
98,344 KB
testcase_32 AC 56 ms
79,088 KB
testcase_33 AC 57 ms
78,308 KB
testcase_34 AC 58 ms
80,584 KB
testcase_35 AC 54 ms
75,640 KB
testcase_36 AC 55 ms
76,328 KB
testcase_37 AC 57 ms
79,008 KB
testcase_38 AC 56 ms
78,784 KB
testcase_39 AC 57 ms
77,904 KB
testcase_40 AC 59 ms
79,504 KB
testcase_41 AC 61 ms
81,600 KB
testcase_42 AC 44 ms
62,484 KB
testcase_43 AC 45 ms
63,224 KB
testcase_44 AC 44 ms
63,036 KB
testcase_45 AC 45 ms
63,020 KB
testcase_46 AC 44 ms
61,104 KB
testcase_47 AC 44 ms
64,492 KB
testcase_48 AC 43 ms
61,596 KB
testcase_49 AC 42 ms
61,660 KB
testcase_50 AC 45 ms
61,828 KB
testcase_51 AC 44 ms
64,344 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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