結果

問題 No.1505 Zero-Product Ranges
ユーザー dango
提出日時 2023-06-25 21:31:29
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 73 ms / 2,000 ms
コード長 221 bytes
コンパイル時間 253 ms
コンパイル使用メモリ 82,560 KB
実行使用メモリ 102,156 KB
最終ジャッジ日時 2024-07-02 15:06:38
合計ジャッジ時間 5,504 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 49
権限があれば一括ダウンロードができます

ソースコード

diff #

def main():
    n = int(input())
    a = list(map(int, input().split()))
    pL = -1
    cN = 0
    for i in range(n):
        if a[i] == 0:
            pL = i
        cN += i - pL
    print(sum(range(n + 1)) - cN)
main()
0