結果
問題 |
No.1505 Zero-Product Ranges
|
ユーザー |
![]() |
提出日時 | 2021-09-30 00:59:19 |
言語 | PyPy3 (7.3.15) |
結果 |
TLE
|
実行時間 | - |
コード長 | 296 bytes |
コンパイル時間 | 153 ms |
コンパイル使用メモリ | 82,036 KB |
実行使用メモリ | 120,536 KB |
最終ジャッジ日時 | 2024-07-17 03:35:05 |
合計ジャッジ時間 | 4,084 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 1 TLE * 1 -- * 47 |
ソースコード
n = int(input()) a = list(map(int, input().split())) li0 = [x for x in range(n) if a[x] == 0] ans = 0 if 0 not in a: print(0) exit() for i in range(n-1): if a[i] == 0: ans += n - i if i >= li0[0]: li0.pop(0) else: if len(li0) == 0: break ans += n - i - (li0[0]-i) print(ans)