結果
問題 | No.1505 Zero-Product Ranges |
ユーザー |
|
提出日時 | 2022-01-02 18:03:20 |
言語 | PyPy3 (7.3.15) |
結果 |
TLE
|
実行時間 | - |
コード長 | 608 bytes |
コンパイル時間 | 867 ms |
コンパイル使用メモリ | 82,388 KB |
実行使用メモリ | 82,436 KB |
最終ジャッジ日時 | 2024-10-11 21:50:55 |
合計ジャッジ時間 | 3,938 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | TLE * 1 -- * 48 |
ソースコード
N = int(input())A = input().replace(' ', '')all = N * (N + 1) // 2def search_one():a = 0b = len(A)while True:j = (b - a) // 2if '1' * j in A:a = jelse:b = jif b - a < 5:breakreturn bi = Nonecnt = 0while i > 0:i = search_one()found = Falsewhile found == False and i > 0:o = A.count('1' * i)if o > 0:onecnt += (i * (i + 1) // 2) * oA = A.replace('1' * i, '')found = Trueelse:i -= 1print(all - onecnt)