結果

問題 No.1505 Zero-Product Ranges
ユーザー lllllll88938494lllllll88938494
提出日時 2022-01-12 00:27:58
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 115 ms / 2,000 ms
コード長 309 bytes
コンパイル時間 488 ms
コンパイル使用メモリ 87,276 KB
実行使用メモリ 107,296 KB
最終ジャッジ日時 2023-08-09 06:22:56
合計ジャッジ時間 7,876 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
71,288 KB
testcase_01 AC 72 ms
71,244 KB
testcase_02 AC 71 ms
71,124 KB
testcase_03 AC 106 ms
104,040 KB
testcase_04 AC 107 ms
104,160 KB
testcase_05 AC 90 ms
86,120 KB
testcase_06 AC 90 ms
85,948 KB
testcase_07 AC 85 ms
83,392 KB
testcase_08 AC 87 ms
84,464 KB
testcase_09 AC 86 ms
83,532 KB
testcase_10 AC 86 ms
84,364 KB
testcase_11 AC 90 ms
85,864 KB
testcase_12 AC 86 ms
82,128 KB
testcase_13 AC 97 ms
92,832 KB
testcase_14 AC 96 ms
90,952 KB
testcase_15 AC 107 ms
104,012 KB
testcase_16 AC 114 ms
107,092 KB
testcase_17 AC 113 ms
107,124 KB
testcase_18 AC 113 ms
107,296 KB
testcase_19 AC 70 ms
71,340 KB
testcase_20 AC 72 ms
71,252 KB
testcase_21 AC 71 ms
71,012 KB
testcase_22 AC 115 ms
107,084 KB
testcase_23 AC 114 ms
106,852 KB
testcase_24 AC 113 ms
106,948 KB
testcase_25 AC 110 ms
103,372 KB
testcase_26 AC 114 ms
106,848 KB
testcase_27 AC 110 ms
103,644 KB
testcase_28 AC 110 ms
103,748 KB
testcase_29 AC 114 ms
106,896 KB
testcase_30 AC 115 ms
107,224 KB
testcase_31 AC 115 ms
106,772 KB
testcase_32 AC 98 ms
90,060 KB
testcase_33 AC 98 ms
89,664 KB
testcase_34 AC 96 ms
91,952 KB
testcase_35 AC 92 ms
86,644 KB
testcase_36 AC 93 ms
87,952 KB
testcase_37 AC 98 ms
89,968 KB
testcase_38 AC 99 ms
89,724 KB
testcase_39 AC 100 ms
89,820 KB
testcase_40 AC 97 ms
89,740 KB
testcase_41 AC 103 ms
92,092 KB
testcase_42 AC 82 ms
76,552 KB
testcase_43 AC 82 ms
77,008 KB
testcase_44 AC 79 ms
76,436 KB
testcase_45 AC 80 ms
76,660 KB
testcase_46 AC 82 ms
76,680 KB
testcase_47 AC 83 ms
77,080 KB
testcase_48 AC 81 ms
76,612 KB
testcase_49 AC 81 ms
76,568 KB
testcase_50 AC 81 ms
76,580 KB
testcase_51 AC 79 ms
76,652 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n=int(input())
ns=list(map(int,input().split()))
s=0
box=[]
for i in range(n):
    if ns[i] == 1:
        s += 1
        if i == n-1:
            box.append(s)
    else:
        if s > 0:
            box.append(s)
        s=0
h=0
for i in box:
    h += (i+1)*i // 2
    
total = (n+1)*n // 2

print(total-h)

0