結果

問題 No.1505 Zero-Product Ranges
ユーザー raven7959raven7959
提出日時 2021-08-10 11:11:30
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 77 ms / 2,000 ms
コード長 203 bytes
コンパイル時間 1,045 ms
コンパイル使用メモリ 81,664 KB
実行使用メモリ 98,180 KB
最終ジャッジ日時 2023-10-23 18:37:39
合計ジャッジ時間 6,262 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
53,404 KB
testcase_01 AC 37 ms
53,404 KB
testcase_02 AC 36 ms
53,404 KB
testcase_03 AC 74 ms
98,172 KB
testcase_04 AC 74 ms
98,172 KB
testcase_05 AC 54 ms
73,528 KB
testcase_06 AC 53 ms
73,476 KB
testcase_07 AC 50 ms
70,748 KB
testcase_08 AC 52 ms
71,900 KB
testcase_09 AC 51 ms
70,796 KB
testcase_10 AC 53 ms
71,880 KB
testcase_11 AC 53 ms
75,556 KB
testcase_12 AC 49 ms
69,768 KB
testcase_13 AC 60 ms
82,528 KB
testcase_14 AC 59 ms
80,436 KB
testcase_15 AC 71 ms
95,992 KB
testcase_16 AC 75 ms
98,180 KB
testcase_17 AC 76 ms
98,180 KB
testcase_18 AC 76 ms
98,176 KB
testcase_19 AC 37 ms
53,404 KB
testcase_20 AC 37 ms
53,404 KB
testcase_21 AC 37 ms
53,404 KB
testcase_22 AC 76 ms
98,136 KB
testcase_23 AC 76 ms
98,100 KB
testcase_24 AC 76 ms
98,020 KB
testcase_25 AC 71 ms
92,768 KB
testcase_26 AC 75 ms
98,016 KB
testcase_27 AC 71 ms
94,860 KB
testcase_28 AC 73 ms
94,896 KB
testcase_29 AC 77 ms
98,112 KB
testcase_30 AC 77 ms
98,168 KB
testcase_31 AC 76 ms
98,028 KB
testcase_32 AC 59 ms
78,708 KB
testcase_33 AC 58 ms
78,624 KB
testcase_34 AC 60 ms
80,496 KB
testcase_35 AC 55 ms
75,572 KB
testcase_36 AC 56 ms
76,972 KB
testcase_37 AC 59 ms
78,684 KB
testcase_38 AC 58 ms
78,588 KB
testcase_39 AC 59 ms
78,624 KB
testcase_40 AC 58 ms
78,684 KB
testcase_41 AC 60 ms
80,560 KB
testcase_42 AC 44 ms
61,912 KB
testcase_43 AC 46 ms
64,536 KB
testcase_44 AC 44 ms
61,912 KB
testcase_45 AC 44 ms
62,180 KB
testcase_46 AC 43 ms
61,908 KB
testcase_47 AC 45 ms
64,544 KB
testcase_48 AC 43 ms
61,908 KB
testcase_49 AC 43 ms
59,860 KB
testcase_50 AC 45 ms
61,912 KB
testcase_51 AC 45 ms
62,180 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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