結果

問題 No.1505 Zero-Product Ranges
ユーザー Navier_BoltzmannNavier_Boltzmann
提出日時 2022-10-02 20:51:47
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 186 ms / 2,000 ms
コード長 305 bytes
コンパイル時間 355 ms
コンパイル使用メモリ 86,908 KB
実行使用メモリ 118,736 KB
最終ジャッジ日時 2023-08-26 18:33:36
合計ジャッジ時間 10,039 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 100 ms
73,120 KB
testcase_01 AC 100 ms
72,784 KB
testcase_02 AC 104 ms
72,904 KB
testcase_03 AC 186 ms
118,736 KB
testcase_04 AC 136 ms
105,144 KB
testcase_05 AC 115 ms
86,816 KB
testcase_06 AC 115 ms
86,980 KB
testcase_07 AC 114 ms
84,276 KB
testcase_08 AC 114 ms
85,592 KB
testcase_09 AC 114 ms
84,336 KB
testcase_10 AC 113 ms
85,268 KB
testcase_11 AC 115 ms
86,828 KB
testcase_12 AC 112 ms
83,040 KB
testcase_13 AC 125 ms
93,992 KB
testcase_14 AC 120 ms
91,616 KB
testcase_15 AC 135 ms
104,880 KB
testcase_16 AC 151 ms
106,884 KB
testcase_17 AC 150 ms
106,776 KB
testcase_18 AC 149 ms
106,644 KB
testcase_19 AC 100 ms
72,868 KB
testcase_20 AC 100 ms
73,192 KB
testcase_21 AC 101 ms
73,152 KB
testcase_22 AC 150 ms
106,628 KB
testcase_23 AC 149 ms
106,684 KB
testcase_24 AC 148 ms
106,748 KB
testcase_25 AC 146 ms
103,580 KB
testcase_26 AC 149 ms
106,596 KB
testcase_27 AC 147 ms
103,424 KB
testcase_28 AC 146 ms
103,588 KB
testcase_29 AC 149 ms
106,908 KB
testcase_30 AC 149 ms
106,452 KB
testcase_31 AC 150 ms
106,732 KB
testcase_32 AC 128 ms
91,512 KB
testcase_33 AC 137 ms
91,668 KB
testcase_34 AC 139 ms
93,372 KB
testcase_35 AC 124 ms
88,800 KB
testcase_36 AC 126 ms
90,080 KB
testcase_37 AC 132 ms
91,536 KB
testcase_38 AC 127 ms
91,672 KB
testcase_39 AC 129 ms
91,576 KB
testcase_40 AC 128 ms
91,552 KB
testcase_41 AC 131 ms
93,312 KB
testcase_42 AC 109 ms
77,844 KB
testcase_43 AC 110 ms
78,320 KB
testcase_44 AC 109 ms
78,040 KB
testcase_45 AC 108 ms
78,416 KB
testcase_46 AC 108 ms
78,200 KB
testcase_47 AC 111 ms
78,804 KB
testcase_48 AC 109 ms
77,960 KB
testcase_49 AC 108 ms
77,868 KB
testcase_50 AC 111 ms
78,196 KB
testcase_51 AC 107 ms
78,096 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import *
from itertools import *
from functools import *
from heapq import *
import sys,math
input = sys.stdin.readline

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

ans = N*(N+1)//2
for g,r in groupby(A):
    if g==1:
        n = len(list(r))
        ans -= n*(n+1)//2
print(ans)
0