結果

問題 No.1505 Zero-Product Ranges
ユーザー lam6er
提出日時 2025-03-20 18:36:37
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 80 ms / 2,000 ms
コード長 228 bytes
コンパイル時間 398 ms
コンパイル使用メモリ 82,236 KB
実行使用メモリ 98,188 KB
最終ジャッジ日時 2025-03-20 18:36:44
合計ジャッジ時間 6,843 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 49
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
A = list(map(int, input().split()))

total = n * (n + 1) // 2
sum_one = 0
current = 0

for a in A:
    if a == 1:
        current += 1
    else:
        current = 0
    sum_one += current

print(total - sum_one)
0