結果
問題 | No.1505 Zero-Product Ranges |
ユーザー | c-yan |
提出日時 | 2021-05-14 22:16:12 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 147 ms / 2,000 ms |
コード長 | 230 bytes |
コンパイル時間 | 849 ms |
コンパイル使用メモリ | 12,416 KB |
実行使用メモリ | 14,336 KB |
最終ジャッジ日時 | 2024-10-02 01:40:05 |
合計ジャッジ時間 | 6,396 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 49 |
ソースコード
N, *A = map(int, open(0).read().split()) c = 0 l = 0 for i in range(N): if A[i] == 1: continue t = i - l + 1 c += t * (t - 1) // 2 l = i + 1 t = N - l + 1 c += t * (t - 1) // 2 print((N + 1) * N // 2 - c)