結果

問題 No.1505 Zero-Product Ranges
ユーザー marroncastlemarroncastle
提出日時 2021-05-14 22:14:05
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 75 ms / 2,000 ms
コード長 202 bytes
コンパイル時間 172 ms
コンパイル使用メモリ 82,136 KB
実行使用メモリ 98,804 KB
最終ジャッジ日時 2024-04-10 00:33:29
合計ジャッジ時間 4,476 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 35 ms
52,688 KB
testcase_01 AC 37 ms
53,572 KB
testcase_02 AC 35 ms
52,620 KB
testcase_03 AC 72 ms
97,504 KB
testcase_04 AC 69 ms
97,044 KB
testcase_05 AC 52 ms
74,636 KB
testcase_06 AC 50 ms
74,364 KB
testcase_07 AC 45 ms
71,872 KB
testcase_08 AC 50 ms
72,784 KB
testcase_09 AC 47 ms
71,340 KB
testcase_10 AC 49 ms
72,420 KB
testcase_11 AC 50 ms
74,404 KB
testcase_12 AC 46 ms
70,056 KB
testcase_13 AC 57 ms
83,600 KB
testcase_14 AC 55 ms
80,500 KB
testcase_15 AC 69 ms
96,700 KB
testcase_16 AC 72 ms
98,804 KB
testcase_17 AC 73 ms
97,300 KB
testcase_18 AC 75 ms
97,160 KB
testcase_19 AC 35 ms
53,524 KB
testcase_20 AC 34 ms
52,220 KB
testcase_21 AC 35 ms
52,348 KB
testcase_22 AC 71 ms
97,076 KB
testcase_23 AC 73 ms
97,168 KB
testcase_24 AC 74 ms
97,248 KB
testcase_25 AC 68 ms
94,460 KB
testcase_26 AC 73 ms
97,404 KB
testcase_27 AC 70 ms
93,468 KB
testcase_28 AC 70 ms
95,132 KB
testcase_29 AC 72 ms
98,136 KB
testcase_30 AC 74 ms
98,164 KB
testcase_31 AC 73 ms
96,972 KB
testcase_32 AC 57 ms
79,976 KB
testcase_33 AC 54 ms
78,300 KB
testcase_34 AC 54 ms
80,296 KB
testcase_35 AC 50 ms
74,140 KB
testcase_36 AC 53 ms
76,208 KB
testcase_37 AC 56 ms
79,056 KB
testcase_38 AC 53 ms
78,912 KB
testcase_39 AC 55 ms
77,752 KB
testcase_40 AC 56 ms
79,640 KB
testcase_41 AC 56 ms
81,760 KB
testcase_42 AC 40 ms
62,088 KB
testcase_43 AC 43 ms
63,888 KB
testcase_44 AC 41 ms
62,728 KB
testcase_45 AC 41 ms
62,912 KB
testcase_46 AC 39 ms
61,376 KB
testcase_47 AC 40 ms
63,396 KB
testcase_48 AC 40 ms
62,516 KB
testcase_49 AC 41 ms
60,100 KB
testcase_50 AC 41 ms
62,608 KB
testcase_51 AC 40 ms
62,860 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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