結果

問題 No.1505 Zero-Product Ranges
ユーザー HAGI_TAROHAGI_TARO
提出日時 2021-08-30 17:28:11
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 110 ms / 2,000 ms
コード長 236 bytes
コンパイル時間 581 ms
コンパイル使用メモリ 86,704 KB
実行使用メモリ 104,468 KB
最終ジャッジ日時 2023-08-15 17:01:10
合計ジャッジ時間 8,411 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
71,152 KB
testcase_01 AC 70 ms
71,280 KB
testcase_02 AC 68 ms
71,080 KB
testcase_03 AC 110 ms
103,852 KB
testcase_04 AC 110 ms
104,216 KB
testcase_05 AC 85 ms
86,044 KB
testcase_06 AC 85 ms
85,676 KB
testcase_07 AC 83 ms
82,808 KB
testcase_08 AC 84 ms
84,096 KB
testcase_09 AC 83 ms
82,840 KB
testcase_10 AC 85 ms
84,240 KB
testcase_11 AC 86 ms
85,872 KB
testcase_12 AC 83 ms
82,084 KB
testcase_13 AC 93 ms
92,848 KB
testcase_14 AC 91 ms
90,476 KB
testcase_15 AC 104 ms
104,248 KB
testcase_16 AC 106 ms
104,376 KB
testcase_17 AC 106 ms
104,400 KB
testcase_18 AC 106 ms
104,212 KB
testcase_19 AC 74 ms
71,312 KB
testcase_20 AC 70 ms
71,112 KB
testcase_21 AC 69 ms
71,156 KB
testcase_22 AC 106 ms
104,240 KB
testcase_23 AC 106 ms
104,188 KB
testcase_24 AC 106 ms
104,468 KB
testcase_25 AC 102 ms
101,112 KB
testcase_26 AC 105 ms
104,220 KB
testcase_27 AC 104 ms
100,940 KB
testcase_28 AC 103 ms
101,072 KB
testcase_29 AC 106 ms
104,232 KB
testcase_30 AC 106 ms
104,372 KB
testcase_31 AC 107 ms
104,080 KB
testcase_32 AC 90 ms
88,988 KB
testcase_33 AC 90 ms
88,768 KB
testcase_34 AC 93 ms
90,876 KB
testcase_35 AC 88 ms
85,580 KB
testcase_36 AC 89 ms
87,148 KB
testcase_37 AC 91 ms
89,056 KB
testcase_38 AC 90 ms
88,888 KB
testcase_39 AC 89 ms
88,804 KB
testcase_40 AC 90 ms
89,000 KB
testcase_41 AC 93 ms
90,872 KB
testcase_42 AC 75 ms
76,204 KB
testcase_43 AC 78 ms
76,780 KB
testcase_44 AC 75 ms
76,168 KB
testcase_45 AC 78 ms
76,596 KB
testcase_46 AC 76 ms
76,200 KB
testcase_47 AC 79 ms
76,740 KB
testcase_48 AC 75 ms
76,320 KB
testcase_49 AC 75 ms
76,336 KB
testcase_50 AC 78 ms
76,024 KB
testcase_51 AC 77 ms
76,464 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
A = list(map(int,input().split()))
cou = 0
r = 0
for i in range(n):
    if A[i] == 0:
        t = i - r + 1
        cou += t * (t-1) // 2
        r = i + 1
t = n - r + 1
cou += t * (t-1) // 2
print(n * (n+1) // 2 - cou)
0