結果
| 問題 | No.1505 Zero-Product Ranges |
| コンテスト | |
| ユーザー |
nrkt
|
| 提出日時 | 2021-05-17 17:35:54 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
AC
|
| 実行時間 | 73 ms / 2,000 ms |
| コード長 | 718 bytes |
| 記録 | |
| コンパイル時間 | 262 ms |
| コンパイル使用メモリ | 84,980 KB |
| 実行使用メモリ | 99,584 KB |
| 最終ジャッジ日時 | 2026-04-23 04:35:42 |
| 合計ジャッジ時間 | 5,360 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 49 |
ソースコード
#!/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)
nrkt