結果
| 問題 | No.1505 Zero-Product Ranges |
| コンテスト | |
| ユーザー |
lllllll88938494
|
| 提出日時 | 2022-01-12 00:25:09 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
AC
|
| 実行時間 | 1,582 ms / 2,000 ms |
| コード長 | 326 bytes |
| 記録 | |
| コンパイル時間 | 188 ms |
| コンパイル使用メモリ | 84,864 KB |
| 実行使用メモリ | 303,576 KB |
| 最終ジャッジ日時 | 2026-05-10 00:05:13 |
| 合計ジャッジ時間 | 6,150 ms |
|
ジャッジサーバーID (参考情報) |
judge1_1 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 49 |
ソースコード
n=int(input())
ns=list(map(int,input().split()))
s=''
box=[]
for i in range(n):
if ns[i] == 1:
s+='1'
if i == n-1:
box.append(s)
else:
if len(s) > 0:
box.append(s)
s=''
h=0
for i in box:
h += (len(i)+1)*len(i) // 2
total = (n+1)*n // 2
print(total-h)
lllllll88938494