結果

問題 No.1505 Zero-Product Ranges
ユーザー lllllll88938494lllllll88938494
提出日時 2022-01-12 00:27:58
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 88 ms / 2,000 ms
コード長 309 bytes
コンパイル時間 303 ms
コンパイル使用メモリ 81,920 KB
実行使用メモリ 102,400 KB
最終ジャッジ日時 2024-04-26 21:14:52
合計ジャッジ時間 5,013 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 38 ms
51,712 KB
testcase_01 AC 38 ms
51,456 KB
testcase_02 AC 39 ms
52,096 KB
testcase_03 AC 75 ms
96,256 KB
testcase_04 AC 76 ms
96,128 KB
testcase_05 AC 60 ms
73,856 KB
testcase_06 AC 55 ms
73,728 KB
testcase_07 AC 55 ms
70,016 KB
testcase_08 AC 55 ms
72,064 KB
testcase_09 AC 53 ms
70,528 KB
testcase_10 AC 55 ms
72,704 KB
testcase_11 AC 58 ms
74,880 KB
testcase_12 AC 53 ms
69,376 KB
testcase_13 AC 65 ms
82,688 KB
testcase_14 AC 63 ms
80,128 KB
testcase_15 AC 74 ms
95,616 KB
testcase_16 AC 83 ms
102,400 KB
testcase_17 AC 84 ms
102,016 KB
testcase_18 AC 81 ms
102,144 KB
testcase_19 AC 40 ms
52,096 KB
testcase_20 AC 38 ms
51,584 KB
testcase_21 AC 39 ms
52,224 KB
testcase_22 AC 83 ms
102,144 KB
testcase_23 AC 81 ms
101,120 KB
testcase_24 AC 83 ms
101,248 KB
testcase_25 AC 80 ms
97,664 KB
testcase_26 AC 84 ms
101,248 KB
testcase_27 AC 79 ms
97,664 KB
testcase_28 AC 80 ms
98,432 KB
testcase_29 AC 86 ms
101,760 KB
testcase_30 AC 88 ms
101,504 KB
testcase_31 AC 83 ms
101,248 KB
testcase_32 AC 66 ms
81,792 KB
testcase_33 AC 64 ms
81,280 KB
testcase_34 AC 64 ms
82,944 KB
testcase_35 AC 60 ms
77,056 KB
testcase_36 AC 63 ms
78,080 KB
testcase_37 AC 65 ms
80,896 KB
testcase_38 AC 64 ms
80,512 KB
testcase_39 AC 64 ms
81,280 KB
testcase_40 AC 66 ms
81,536 KB
testcase_41 AC 69 ms
84,096 KB
testcase_42 AC 49 ms
62,848 KB
testcase_43 AC 49 ms
63,872 KB
testcase_44 AC 49 ms
64,128 KB
testcase_45 AC 48 ms
64,000 KB
testcase_46 AC 48 ms
62,848 KB
testcase_47 AC 50 ms
64,640 KB
testcase_48 AC 50 ms
62,848 KB
testcase_49 AC 50 ms
61,952 KB
testcase_50 AC 49 ms
63,104 KB
testcase_51 AC 48 ms
63,744 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