結果

問題 No.576 E869120 and Rings
ユーザー maspymaspy
提出日時 2020-05-09 00:41:23
言語 PyPy3
(7.3.15)
結果
MLE  
実行時間 -
コード長 739 bytes
コンパイル時間 629 ms
コンパイル使用メモリ 87,364 KB
実行使用メモリ 273,120 KB
最終ジャッジ日時 2023-09-17 04:28:04
合計ジャッジ時間 22,944 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 MLE -
testcase_01 MLE -
testcase_02 MLE -
testcase_03 MLE -
testcase_04 MLE -
testcase_05 MLE -
testcase_06 MLE -
testcase_07 MLE -
testcase_08 MLE -
testcase_09 MLE -
testcase_10 MLE -
testcase_11 MLE -
testcase_12 MLE -
testcase_13 MLE -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
from collections import deque

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

N, K = map(int, readline().split())
A = tuple(map(float, read().rstrip().decode()))
A = A + A

def test(x):
    Acum = [0.0] * (N+N+1)
    for i in range(N+N):
        Acum[i+1] = Acum[i] + A[i] - x
    q = deque([0])
    for k in range(K, N+N+1):
        while q[0] < k - N:
            q.popleft()
        if Acum[q[0]] < Acum[k]:
            return True
        i = k - K + 1
        x = Acum[i]
        while q and Acum[q[-1]] > x:
            q.pop()
        q.append(i)
    return False

vals = [0, 1]
for _ in range(22):
    x = sum(vals) / 2
    vals[1 - test(x)] = x

print(vals[0])
0