結果

問題 No.1505 Zero-Product Ranges
ユーザー 👑 KazunKazun
提出日時 2021-05-14 22:10:39
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 80 ms / 2,000 ms
コード長 182 bytes
コンパイル時間 162 ms
コンパイル使用メモリ 82,376 KB
実行使用メモリ 101,360 KB
最終ジャッジ日時 2024-04-10 00:28:11
合計ジャッジ時間 4,431 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 33 ms
51,816 KB
testcase_01 AC 33 ms
52,336 KB
testcase_02 AC 33 ms
52,392 KB
testcase_03 AC 70 ms
100,180 KB
testcase_04 AC 70 ms
100,268 KB
testcase_05 AC 50 ms
76,048 KB
testcase_06 AC 50 ms
75,764 KB
testcase_07 AC 47 ms
72,288 KB
testcase_08 AC 48 ms
73,564 KB
testcase_09 AC 48 ms
72,308 KB
testcase_10 AC 49 ms
73,992 KB
testcase_11 AC 51 ms
75,968 KB
testcase_12 AC 48 ms
71,824 KB
testcase_13 AC 57 ms
84,408 KB
testcase_14 AC 56 ms
82,228 KB
testcase_15 AC 73 ms
99,852 KB
testcase_16 AC 79 ms
101,356 KB
testcase_17 AC 79 ms
100,776 KB
testcase_18 AC 75 ms
100,664 KB
testcase_19 AC 33 ms
52,076 KB
testcase_20 AC 33 ms
51,696 KB
testcase_21 AC 33 ms
51,940 KB
testcase_22 AC 72 ms
100,360 KB
testcase_23 AC 74 ms
101,360 KB
testcase_24 AC 72 ms
99,780 KB
testcase_25 AC 73 ms
96,848 KB
testcase_26 AC 75 ms
100,592 KB
testcase_27 AC 75 ms
97,208 KB
testcase_28 AC 73 ms
97,644 KB
testcase_29 AC 78 ms
100,080 KB
testcase_30 AC 80 ms
100,284 KB
testcase_31 AC 78 ms
101,276 KB
testcase_32 AC 55 ms
79,992 KB
testcase_33 AC 58 ms
79,900 KB
testcase_34 AC 57 ms
82,828 KB
testcase_35 AC 51 ms
75,476 KB
testcase_36 AC 53 ms
77,596 KB
testcase_37 AC 54 ms
80,888 KB
testcase_38 AC 54 ms
79,016 KB
testcase_39 AC 54 ms
79,408 KB
testcase_40 AC 55 ms
79,460 KB
testcase_41 AC 56 ms
83,452 KB
testcase_42 AC 40 ms
62,396 KB
testcase_43 AC 40 ms
64,532 KB
testcase_44 AC 40 ms
64,248 KB
testcase_45 AC 42 ms
63,424 KB
testcase_46 AC 39 ms
61,840 KB
testcase_47 AC 41 ms
64,824 KB
testcase_48 AC 39 ms
61,724 KB
testcase_49 AC 40 ms
61,360 KB
testcase_50 AC 41 ms
61,968 KB
testcase_51 AC 42 ms
63,364 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