結果

問題 No.1505 Zero-Product Ranges
ユーザー lllllll88938494
提出日時 2022-01-11 19:57:41
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 335 bytes
コンパイル時間 453 ms
コンパイル使用メモリ 82,220 KB
実行使用メモリ 208,804 KB
最終ジャッジ日時 2024-11-14 12:13:26
合計ジャッジ時間 107,568 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1 WA * 2
other AC * 1 WA * 17 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
        print(n-i)
        continue
    for j in range(i,n):
        dic[ns[j]] += 1
        if dic[0] > 0:
            ans+=1

print(ans)
0