結果

問題 No.1505 Zero-Product Ranges
ユーザー ああいいああいい
提出日時 2021-12-25 11:54:51
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 159 ms / 2,000 ms
コード長 288 bytes
コンパイル時間 256 ms
コンパイル使用メモリ 11,876 KB
実行使用メモリ 14,056 KB
最終ジャッジ日時 2023-10-21 12:42:47
合計ジャッジ時間 7,352 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 28 ms
10,116 KB
testcase_01 AC 27 ms
10,116 KB
testcase_02 AC 26 ms
10,116 KB
testcase_03 AC 93 ms
14,056 KB
testcase_04 AC 136 ms
14,056 KB
testcase_05 AC 79 ms
11,272 KB
testcase_06 AC 74 ms
11,636 KB
testcase_07 AC 60 ms
11,056 KB
testcase_08 AC 66 ms
11,048 KB
testcase_09 AC 64 ms
11,112 KB
testcase_10 AC 61 ms
11,128 KB
testcase_11 AC 67 ms
11,388 KB
testcase_12 AC 56 ms
10,940 KB
testcase_13 AC 92 ms
12,280 KB
testcase_14 AC 81 ms
12,024 KB
testcase_15 AC 126 ms
13,320 KB
testcase_16 AC 150 ms
14,056 KB
testcase_17 AC 151 ms
14,056 KB
testcase_18 AC 157 ms
14,056 KB
testcase_19 AC 27 ms
10,116 KB
testcase_20 AC 25 ms
10,116 KB
testcase_21 AC 24 ms
10,116 KB
testcase_22 AC 159 ms
13,268 KB
testcase_23 AC 143 ms
13,356 KB
testcase_24 AC 148 ms
13,340 KB
testcase_25 AC 135 ms
13,232 KB
testcase_26 AC 144 ms
13,340 KB
testcase_27 AC 134 ms
13,536 KB
testcase_28 AC 142 ms
13,288 KB
testcase_29 AC 148 ms
13,436 KB
testcase_30 AC 156 ms
14,048 KB
testcase_31 AC 148 ms
13,308 KB
testcase_32 AC 89 ms
11,912 KB
testcase_33 AC 82 ms
11,648 KB
testcase_34 AC 90 ms
12,060 KB
testcase_35 AC 74 ms
11,272 KB
testcase_36 AC 82 ms
11,396 KB
testcase_37 AC 88 ms
11,904 KB
testcase_38 AC 81 ms
11,628 KB
testcase_39 AC 84 ms
11,652 KB
testcase_40 AC 87 ms
11,904 KB
testcase_41 AC 95 ms
12,016 KB
testcase_42 AC 32 ms
10,264 KB
testcase_43 AC 36 ms
10,308 KB
testcase_44 AC 34 ms
10,256 KB
testcase_45 AC 34 ms
10,308 KB
testcase_46 AC 31 ms
10,232 KB
testcase_47 AC 36 ms
10,440 KB
testcase_48 AC 34 ms
10,312 KB
testcase_49 AC 28 ms
10,208 KB
testcase_50 AC 33 ms
10,308 KB
testcase_51 AC 39 ms
10,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
A = list(map(int,input().split()))

import sys

ans = 0
right = 0
for left in range(N):
    while right < N and A[right] == 1:
        right += 1
    if right == N:
        print(ans)
        exit()
    ans += N - right
    if left == right:
        right += 1
print(ans)
0