結果

問題 No.1505 Zero-Product Ranges
ユーザー nohakai3nohakai3
提出日時 2022-07-02 20:31:10
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 118 ms / 2,000 ms
コード長 203 bytes
コンパイル時間 98 ms
コンパイル使用メモリ 10,624 KB
実行使用メモリ 11,468 KB
最終ジャッジ日時 2023-08-18 12:40:05
合計ジャッジ時間 5,770 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 14 ms
7,840 KB
testcase_01 AC 14 ms
7,944 KB
testcase_02 AC 13 ms
7,764 KB
testcase_03 AC 64 ms
11,336 KB
testcase_04 AC 118 ms
11,460 KB
testcase_05 AC 32 ms
9,472 KB
testcase_06 AC 31 ms
9,460 KB
testcase_07 AC 27 ms
8,900 KB
testcase_08 AC 35 ms
9,000 KB
testcase_09 AC 30 ms
9,068 KB
testcase_10 AC 50 ms
8,992 KB
testcase_11 AC 54 ms
9,468 KB
testcase_12 AC 41 ms
8,896 KB
testcase_13 AC 76 ms
10,164 KB
testcase_14 AC 70 ms
9,972 KB
testcase_15 AC 106 ms
11,332 KB
testcase_16 AC 95 ms
11,276 KB
testcase_17 AC 97 ms
11,260 KB
testcase_18 AC 93 ms
11,168 KB
testcase_19 AC 13 ms
7,844 KB
testcase_20 AC 14 ms
7,764 KB
testcase_21 AC 13 ms
7,964 KB
testcase_22 AC 94 ms
11,400 KB
testcase_23 AC 88 ms
11,324 KB
testcase_24 AC 89 ms
11,380 KB
testcase_25 AC 83 ms
11,352 KB
testcase_26 AC 92 ms
11,468 KB
testcase_27 AC 90 ms
11,296 KB
testcase_28 AC 86 ms
11,236 KB
testcase_29 AC 84 ms
11,452 KB
testcase_30 AC 90 ms
11,252 KB
testcase_31 AC 90 ms
11,348 KB
testcase_32 AC 54 ms
9,948 KB
testcase_33 AC 50 ms
9,604 KB
testcase_34 AC 53 ms
9,936 KB
testcase_35 AC 43 ms
9,364 KB
testcase_36 AC 45 ms
9,368 KB
testcase_37 AC 51 ms
9,968 KB
testcase_38 AC 47 ms
9,508 KB
testcase_39 AC 50 ms
9,732 KB
testcase_40 AC 49 ms
9,856 KB
testcase_41 AC 55 ms
10,220 KB
testcase_42 AC 17 ms
8,200 KB
testcase_43 AC 20 ms
8,256 KB
testcase_44 AC 18 ms
8,136 KB
testcase_45 AC 20 ms
8,324 KB
testcase_46 AC 17 ms
8,204 KB
testcase_47 AC 20 ms
8,544 KB
testcase_48 AC 17 ms
8,296 KB
testcase_49 AC 16 ms
8,272 KB
testcase_50 AC 18 ms
8,180 KB
testcase_51 AC 19 ms
8,316 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

c=0
l=0
for i in range(n):
    if A[i] == 1:
        continue
    t=i-l+1
    c+=t*(t-1)//2
    l=i+1

t=n-l+1
c+=t*(t-1)//2
ans=(n+1)*n//2 - c
print(ans)
0