結果

問題 No.1505 Zero-Product Ranges
ユーザー 👑 KazunKazun
提出日時 2021-05-14 22:10:39
言語 PyPy3
(7.3.8)
結果
AC  
実行時間 122 ms / 2,000 ms
コード長 182 bytes
コンパイル時間 415 ms
使用メモリ 112,192 KB
最終ジャッジ日時 2022-11-25 18:38:12
合計ジャッジ時間 7,612 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
使用メモリ
testcase_00 AC 78 ms
75,712 KB
testcase_01 AC 78 ms
75,676 KB
testcase_02 AC 79 ms
75,444 KB
testcase_03 AC 122 ms
111,992 KB
testcase_04 AC 117 ms
112,000 KB
testcase_05 AC 98 ms
91,668 KB
testcase_06 AC 98 ms
91,700 KB
testcase_07 AC 95 ms
88,588 KB
testcase_08 AC 94 ms
89,604 KB
testcase_09 AC 97 ms
88,676 KB
testcase_10 AC 96 ms
89,772 KB
testcase_11 AC 97 ms
91,908 KB
testcase_12 AC 92 ms
87,488 KB
testcase_13 AC 103 ms
98,924 KB
testcase_14 AC 103 ms
96,948 KB
testcase_15 AC 115 ms
111,856 KB
testcase_16 AC 116 ms
111,792 KB
testcase_17 AC 119 ms
112,132 KB
testcase_18 AC 119 ms
112,188 KB
testcase_19 AC 80 ms
75,648 KB
testcase_20 AC 80 ms
75,512 KB
testcase_21 AC 81 ms
75,716 KB
testcase_22 AC 117 ms
112,072 KB
testcase_23 AC 117 ms
111,672 KB
testcase_24 AC 116 ms
111,796 KB
testcase_25 AC 111 ms
108,168 KB
testcase_26 AC 114 ms
111,752 KB
testcase_27 AC 112 ms
108,268 KB
testcase_28 AC 112 ms
108,568 KB
testcase_29 AC 116 ms
111,932 KB
testcase_30 AC 119 ms
112,192 KB
testcase_31 AC 116 ms
111,868 KB
testcase_32 AC 100 ms
95,288 KB
testcase_33 AC 101 ms
95,276 KB
testcase_34 AC 100 ms
97,088 KB
testcase_35 AC 94 ms
91,432 KB
testcase_36 AC 97 ms
93,136 KB
testcase_37 AC 101 ms
94,808 KB
testcase_38 AC 98 ms
94,692 KB
testcase_39 AC 99 ms
95,016 KB
testcase_40 AC 100 ms
95,240 KB
testcase_41 AC 102 ms
97,280 KB
testcase_42 AC 84 ms
81,052 KB
testcase_43 AC 85 ms
81,812 KB
testcase_44 AC 89 ms
80,936 KB
testcase_45 AC 88 ms
81,248 KB
testcase_46 AC 88 ms
80,852 KB
testcase_47 AC 87 ms
81,820 KB
testcase_48 AC 85 ms
80,912 KB
testcase_49 AC 86 ms
80,888 KB
testcase_50 AC 87 ms
80,904 KB
testcase_51 AC 87 ms
81,320 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