結果

問題 No.1505 Zero-Product Ranges
ユーザー titiatitia
提出日時 2021-05-14 22:12:46
言語 Python3
(3.10.1 + numpy 1.22.3 + scipy 1.8.0)
結果
AC  
実行時間 87 ms / 2,000 ms
コード長 249 bytes
コンパイル時間 59 ms
使用メモリ 11,104 KB
最終ジャッジ日時 2022-11-25 18:42:41
合計ジャッジ時間 4,458 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
使用メモリ
testcase_00 AC 14 ms
7,608 KB
testcase_01 AC 14 ms
7,560 KB
testcase_02 AC 15 ms
7,612 KB
testcase_03 AC 65 ms
10,824 KB
testcase_04 AC 87 ms
10,780 KB
testcase_05 AC 34 ms
8,988 KB
testcase_06 AC 33 ms
8,960 KB
testcase_07 AC 30 ms
8,796 KB
testcase_08 AC 32 ms
8,800 KB
testcase_09 AC 32 ms
8,716 KB
testcase_10 AC 38 ms
8,624 KB
testcase_11 AC 43 ms
9,116 KB
testcase_12 AC 34 ms
8,808 KB
testcase_13 AC 59 ms
9,800 KB
testcase_14 AC 52 ms
9,692 KB
testcase_15 AC 83 ms
10,960 KB
testcase_16 AC 79 ms
10,796 KB
testcase_17 AC 81 ms
10,936 KB
testcase_18 AC 77 ms
10,908 KB
testcase_19 AC 14 ms
7,612 KB
testcase_20 AC 14 ms
7,700 KB
testcase_21 AC 14 ms
7,620 KB
testcase_22 AC 79 ms
10,820 KB
testcase_23 AC 78 ms
11,104 KB
testcase_24 AC 77 ms
10,872 KB
testcase_25 AC 73 ms
10,648 KB
testcase_26 AC 79 ms
10,904 KB
testcase_27 AC 73 ms
10,860 KB
testcase_28 AC 74 ms
10,856 KB
testcase_29 AC 76 ms
11,000 KB
testcase_30 AC 77 ms
10,792 KB
testcase_31 AC 77 ms
10,856 KB
testcase_32 AC 48 ms
9,628 KB
testcase_33 AC 45 ms
9,316 KB
testcase_34 AC 49 ms
9,640 KB
testcase_35 AC 41 ms
9,120 KB
testcase_36 AC 42 ms
9,044 KB
testcase_37 AC 47 ms
9,568 KB
testcase_38 AC 46 ms
9,224 KB
testcase_39 AC 47 ms
9,248 KB
testcase_40 AC 48 ms
9,616 KB
testcase_41 AC 53 ms
9,884 KB
testcase_42 AC 19 ms
7,984 KB
testcase_43 AC 20 ms
8,072 KB
testcase_44 AC 19 ms
7,912 KB
testcase_45 AC 20 ms
7,924 KB
testcase_46 AC 18 ms
8,048 KB
testcase_47 AC 21 ms
8,132 KB
testcase_48 AC 19 ms
8,016 KB
testcase_49 AC 16 ms
7,864 KB
testcase_50 AC 19 ms
8,000 KB
testcase_51 AC 20 ms
8,076 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline

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

ANS=N*(N+1)//2

count=0
for a in A:
    if a!=0:
        count+=1
    else:
        ANS-=count*(count+1)//2
        count=0

ANS-=count*(count+1)//2

print(ANS)
0