結果
| 問題 |
No.1505 Zero-Product Ranges
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-05-07 16:22:05 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 86 ms / 2,000 ms |
| コード長 | 227 bytes |
| コンパイル時間 | 213 ms |
| コンパイル使用メモリ | 82,464 KB |
| 実行使用メモリ | 101,120 KB |
| 最終ジャッジ日時 | 2024-11-24 15:51:56 |
| 合計ジャッジ時間 | 6,174 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 49 |
ソースコード
N = int(input())
A = list(map(int, input().split()))
l, r = 0, 0
cnt = 0
while l<N:
while r<N and A[r]!=0:
r+=1
if r<N:
cnt += N-r
if l==r:
l+=1
r+=1
else:
l+=1
print(cnt)