結果
| 問題 |
No.1505 Zero-Product Ranges
|
| コンテスト | |
| ユーザー |
lllllll88938494
|
| 提出日時 | 2022-01-12 00:27:58 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 83 ms / 2,000 ms |
| コード長 | 309 bytes |
| コンパイル時間 | 511 ms |
| コンパイル使用メモリ | 82,472 KB |
| 実行使用メモリ | 103,520 KB |
| 最終ジャッジ日時 | 2024-11-14 12:19:38 |
| 合計ジャッジ時間 | 5,324 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 49 |
ソースコード
n=int(input())
ns=list(map(int,input().split()))
s=0
box=[]
for i in range(n):
if ns[i] == 1:
s += 1
if i == n-1:
box.append(s)
else:
if s > 0:
box.append(s)
s=0
h=0
for i in box:
h += (i+1)*i // 2
total = (n+1)*n // 2
print(total-h)
lllllll88938494