結果

問題 No.1505 Zero-Product Ranges
ユーザー nrktnrkt
提出日時 2021-05-17 17:35:54
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 96 ms / 2,000 ms
コード長 718 bytes
コンパイル時間 203 ms
コンパイル使用メモリ 82,048 KB
実行使用メモリ 99,456 KB
最終ジャッジ日時 2024-04-16 06:26:24
合計ジャッジ時間 5,633 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 50 ms
54,016 KB
testcase_01 AC 50 ms
54,528 KB
testcase_02 AC 50 ms
54,400 KB
testcase_03 AC 91 ms
98,176 KB
testcase_04 AC 93 ms
98,816 KB
testcase_05 AC 69 ms
76,032 KB
testcase_06 AC 73 ms
75,776 KB
testcase_07 AC 67 ms
72,320 KB
testcase_08 AC 69 ms
73,984 KB
testcase_09 AC 66 ms
72,704 KB
testcase_10 AC 68 ms
74,112 KB
testcase_11 AC 70 ms
75,776 KB
testcase_12 AC 67 ms
71,936 KB
testcase_13 AC 79 ms
84,736 KB
testcase_14 AC 77 ms
81,536 KB
testcase_15 AC 92 ms
98,304 KB
testcase_16 AC 95 ms
99,456 KB
testcase_17 AC 95 ms
99,200 KB
testcase_18 AC 95 ms
99,328 KB
testcase_19 AC 49 ms
54,144 KB
testcase_20 AC 49 ms
54,144 KB
testcase_21 AC 51 ms
54,272 KB
testcase_22 AC 95 ms
98,944 KB
testcase_23 AC 96 ms
98,432 KB
testcase_24 AC 95 ms
98,432 KB
testcase_25 AC 91 ms
94,720 KB
testcase_26 AC 95 ms
98,560 KB
testcase_27 AC 93 ms
95,360 KB
testcase_28 AC 94 ms
95,488 KB
testcase_29 AC 96 ms
99,072 KB
testcase_30 AC 96 ms
99,328 KB
testcase_31 AC 96 ms
98,816 KB
testcase_32 AC 77 ms
80,768 KB
testcase_33 AC 76 ms
79,872 KB
testcase_34 AC 77 ms
82,432 KB
testcase_35 AC 73 ms
76,288 KB
testcase_36 AC 72 ms
77,568 KB
testcase_37 AC 75 ms
80,384 KB
testcase_38 AC 75 ms
79,360 KB
testcase_39 AC 76 ms
79,872 KB
testcase_40 AC 76 ms
80,000 KB
testcase_41 AC 79 ms
82,560 KB
testcase_42 AC 60 ms
63,616 KB
testcase_43 AC 61 ms
65,152 KB
testcase_44 AC 59 ms
64,128 KB
testcase_45 AC 60 ms
64,896 KB
testcase_46 AC 58 ms
63,488 KB
testcase_47 AC 63 ms
65,792 KB
testcase_48 AC 59 ms
63,744 KB
testcase_49 AC 56 ms
62,848 KB
testcase_50 AC 59 ms
64,000 KB
testcase_51 AC 60 ms
65,024 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#!/usr/bin/env python3
 
import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate, chain
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

n = I()
a = LI()
ans = 0
cnt = 0
for i in range(n):
    if a[i] == 0:
        cnt += 1
        ans += cnt * (n - i)
        cnt = 0
    else:
        cnt += 1
print(ans)
0