結果

問題 No.1505 Zero-Product Ranges
ユーザー lllllll88938494lllllll88938494
提出日時 2022-01-12 00:25:09
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 326 bytes
コンパイル時間 519 ms
コンパイル使用メモリ 82,176 KB
実行使用メモリ 263,824 KB
最終ジャッジ日時 2024-04-26 21:14:18
合計ジャッジ時間 4,558 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 36 ms
51,968 KB
testcase_01 AC 39 ms
51,968 KB
testcase_02 AC 39 ms
51,456 KB
testcase_03 TLE -
testcase_04 AC 76 ms
96,512 KB
testcase_05 AC 65 ms
84,992 KB
testcase_06 AC 67 ms
85,248 KB
testcase_07 AC 63 ms
82,688 KB
testcase_08 AC 65 ms
83,712 KB
testcase_09 AC 77 ms
82,304 KB
testcase_10 AC 56 ms
72,704 KB
testcase_11 AC 61 ms
74,496 KB
testcase_12 AC 56 ms
70,016 KB
testcase_13 AC 66 ms
83,456 KB
testcase_14 AC 64 ms
80,384 KB
testcase_15 AC 73 ms
96,000 KB
testcase_16 AC 97 ms
105,728 KB
testcase_17 AC 158 ms
104,192 KB
testcase_18 AC 92 ms
105,728 KB
testcase_19 AC 63 ms
51,840 KB
testcase_20 AC 76 ms
52,224 KB
testcase_21 AC 75 ms
51,840 KB
testcase_22 AC 192 ms
105,984 KB
testcase_23 AC 165 ms
105,728 KB
testcase_24 AC 146 ms
103,936 KB
testcase_25 AC 145 ms
100,352 KB
testcase_26 AC 100 ms
105,984 KB
testcase_27 AC 91 ms
102,912 KB
testcase_28 AC 94 ms
102,656 KB
testcase_29 AC 93 ms
106,112 KB
testcase_30 AC 98 ms
105,088 KB
testcase_31 AC 96 ms
105,728 KB
testcase_32 AC 74 ms
85,760 KB
testcase_33 AC 105 ms
88,192 KB
testcase_34 AC 70 ms
88,064 KB
testcase_35 AC 63 ms
80,384 KB
testcase_36 AC 68 ms
82,304 KB
testcase_37 AC 108 ms
88,960 KB
testcase_38 AC 68 ms
84,224 KB
testcase_39 AC 67 ms
84,224 KB
testcase_40 AC 110 ms
88,960 KB
testcase_41 AC 73 ms
88,192 KB
testcase_42 AC 55 ms
66,048 KB
testcase_43 AC 54 ms
65,024 KB
testcase_44 AC 50 ms
63,872 KB
testcase_45 AC 51 ms
64,640 KB
testcase_46 AC 54 ms
65,792 KB
testcase_47 AC 51 ms
65,792 KB
testcase_48 AC 57 ms
66,176 KB
testcase_49 AC 49 ms
62,720 KB
testcase_50 AC 52 ms
64,128 KB
testcase_51 AC 54 ms
65,024 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

print(total-h)

0