結果

問題 No.1505 Zero-Product Ranges
ユーザー 👑 KazunKazun
提出日時 2021-05-14 22:10:39
言語 PyPy3
(7.3.13)
結果
AC  
実行時間 121 ms / 2,000 ms
コード長 182 bytes
コンパイル時間 488 ms
コンパイル使用メモリ 86,760 KB
実行使用メモリ 107,388 KB
最終ジャッジ日時 2023-07-25 06:57:06
合計ジャッジ時間 7,880 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 76 ms
71,248 KB
testcase_01 AC 75 ms
71,184 KB
testcase_02 AC 76 ms
71,268 KB
testcase_03 AC 118 ms
106,828 KB
testcase_04 AC 115 ms
106,764 KB
testcase_05 AC 92 ms
86,752 KB
testcase_06 AC 94 ms
87,028 KB
testcase_07 AC 92 ms
84,116 KB
testcase_08 AC 92 ms
85,036 KB
testcase_09 AC 90 ms
83,844 KB
testcase_10 AC 93 ms
85,020 KB
testcase_11 AC 92 ms
86,744 KB
testcase_12 AC 88 ms
82,772 KB
testcase_13 AC 103 ms
94,404 KB
testcase_14 AC 101 ms
92,132 KB
testcase_15 AC 115 ms
107,128 KB
testcase_16 AC 119 ms
107,248 KB
testcase_17 AC 120 ms
107,264 KB
testcase_18 AC 120 ms
107,284 KB
testcase_19 AC 73 ms
71,288 KB
testcase_20 AC 73 ms
71,156 KB
testcase_21 AC 74 ms
71,396 KB
testcase_22 AC 118 ms
107,320 KB
testcase_23 AC 119 ms
107,208 KB
testcase_24 AC 119 ms
106,944 KB
testcase_25 AC 114 ms
103,736 KB
testcase_26 AC 119 ms
106,948 KB
testcase_27 AC 117 ms
103,716 KB
testcase_28 AC 116 ms
103,912 KB
testcase_29 AC 120 ms
107,140 KB
testcase_30 AC 121 ms
107,388 KB
testcase_31 AC 119 ms
107,100 KB
testcase_32 AC 99 ms
90,336 KB
testcase_33 AC 100 ms
90,308 KB
testcase_34 AC 99 ms
92,060 KB
testcase_35 AC 95 ms
87,032 KB
testcase_36 AC 96 ms
88,460 KB
testcase_37 AC 101 ms
90,516 KB
testcase_38 AC 98 ms
90,120 KB
testcase_39 AC 100 ms
90,180 KB
testcase_40 AC 99 ms
90,180 KB
testcase_41 AC 102 ms
92,432 KB
testcase_42 AC 82 ms
76,452 KB
testcase_43 AC 84 ms
77,080 KB
testcase_44 AC 82 ms
76,256 KB
testcase_45 AC 81 ms
76,480 KB
testcase_46 AC 82 ms
76,080 KB
testcase_47 AC 80 ms
76,980 KB
testcase_48 AC 81 ms
76,212 KB
testcase_49 AC 80 ms
76,204 KB
testcase_50 AC 82 ms
76,092 KB
testcase_51 AC 82 ms
76,500 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N=int(input())
A=list(map(int,input().split()))+[0]

X=N*(N+1)//2
chain=0
for a in A:
    if a==1:
        chain+=1
    else:
        X-=chain*(chain+1)//2
        chain=0

print(X)
0