結果

問題 No.1505 Zero-Product Ranges
ユーザー DrDrpilotDrDrpilot
提出日時 2022-01-24 15:49:09
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 101 ms / 2,000 ms
コード長 197 bytes
コンパイル時間 85 ms
コンパイル使用メモリ 10,652 KB
実行使用メモリ 11,476 KB
最終ジャッジ日時 2023-08-21 03:59:54
合計ジャッジ時間 6,242 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,856 KB
testcase_01 AC 16 ms
7,960 KB
testcase_02 AC 16 ms
7,852 KB
testcase_03 AC 85 ms
11,272 KB
testcase_04 AC 101 ms
11,268 KB
testcase_05 AC 43 ms
9,336 KB
testcase_06 AC 41 ms
9,488 KB
testcase_07 AC 35 ms
8,980 KB
testcase_08 AC 38 ms
9,048 KB
testcase_09 AC 36 ms
9,120 KB
testcase_10 AC 45 ms
8,980 KB
testcase_11 AC 50 ms
9,412 KB
testcase_12 AC 39 ms
8,964 KB
testcase_13 AC 68 ms
10,300 KB
testcase_14 AC 61 ms
10,152 KB
testcase_15 AC 99 ms
11,276 KB
testcase_16 AC 97 ms
11,308 KB
testcase_17 AC 97 ms
11,360 KB
testcase_18 AC 96 ms
11,448 KB
testcase_19 AC 16 ms
7,848 KB
testcase_20 AC 16 ms
7,856 KB
testcase_21 AC 16 ms
7,776 KB
testcase_22 AC 97 ms
11,336 KB
testcase_23 AC 95 ms
11,344 KB
testcase_24 AC 90 ms
11,296 KB
testcase_25 AC 90 ms
11,296 KB
testcase_26 AC 92 ms
11,320 KB
testcase_27 AC 89 ms
11,264 KB
testcase_28 AC 90 ms
11,268 KB
testcase_29 AC 95 ms
11,476 KB
testcase_30 AC 97 ms
11,260 KB
testcase_31 AC 91 ms
11,464 KB
testcase_32 AC 57 ms
10,164 KB
testcase_33 AC 53 ms
9,680 KB
testcase_34 AC 59 ms
10,020 KB
testcase_35 AC 48 ms
9,460 KB
testcase_36 AC 50 ms
9,488 KB
testcase_37 AC 55 ms
9,932 KB
testcase_38 AC 54 ms
9,700 KB
testcase_39 AC 54 ms
9,796 KB
testcase_40 AC 56 ms
9,900 KB
testcase_41 AC 61 ms
10,300 KB
testcase_42 AC 21 ms
8,160 KB
testcase_43 AC 23 ms
8,568 KB
testcase_44 AC 21 ms
8,460 KB
testcase_45 AC 23 ms
8,336 KB
testcase_46 AC 20 ms
8,164 KB
testcase_47 AC 24 ms
8,596 KB
testcase_48 AC 21 ms
8,416 KB
testcase_49 AC 18 ms
8,316 KB
testcase_50 AC 21 ms
8,396 KB
testcase_51 AC 23 ms
8,396 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n=int(input())
cnt=0
a=list(map(int,input().split()))+[0]
now=0
for i in range(n+1):
    if a[i]==1:
        now+=1
    else:
        cnt+=now*(now+1)//2
        now=0
ans=n*(n+1)//2-cnt
print(ans)
0