結果

問題 No.1505 Zero-Product Ranges
ユーザー lllllll88938494
提出日時 2022-01-11 19:58:34
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 316 bytes
コンパイル時間 385 ms
コンパイル使用メモリ 82,064 KB
実行使用メモリ 208,352 KB
最終ジャッジ日時 2024-11-14 12:15:12
合計ジャッジ時間 105,595 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 18 TLE * 31
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import defaultdict

n=int(input())
ns=list(map(int,input().split()))
ans=0

for i in range(n):
    dic= defaultdict(int)
    dic[ns[i]] += 1
    if ns[i] == 0:
        ans += n-i
        continue
    for j in range(i,n):
        dic[ns[j]] += 1
        if dic[0] > 0:
            ans+=1

print(ans)
0