結果

問題 No.489 株に挑戦
ユーザー pekempeypekempey
提出日時 2017-02-27 22:14:11
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 955 ms / 1,000 ms
コード長 859 bytes
コンパイル時間 313 ms
コンパイル使用メモリ 87,096 KB
実行使用メモリ 86,832 KB
最終ジャッジ日時 2023-09-02 13:16:39
合計ジャッジ時間 16,962 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 715 ms
84,952 KB
testcase_01 AC 505 ms
83,432 KB
testcase_02 AC 76 ms
73,428 KB
testcase_03 AC 75 ms
73,052 KB
testcase_04 AC 76 ms
73,312 KB
testcase_05 AC 79 ms
73,384 KB
testcase_06 AC 90 ms
78,156 KB
testcase_07 AC 88 ms
78,320 KB
testcase_08 AC 76 ms
73,412 KB
testcase_09 AC 96 ms
78,248 KB
testcase_10 AC 94 ms
78,260 KB
testcase_11 AC 94 ms
78,376 KB
testcase_12 AC 93 ms
78,304 KB
testcase_13 AC 98 ms
78,156 KB
testcase_14 AC 95 ms
78,276 KB
testcase_15 AC 178 ms
80,892 KB
testcase_16 AC 808 ms
85,968 KB
testcase_17 AC 197 ms
80,836 KB
testcase_18 AC 612 ms
83,816 KB
testcase_19 AC 493 ms
84,304 KB
testcase_20 AC 757 ms
85,360 KB
testcase_21 AC 346 ms
84,996 KB
testcase_22 AC 238 ms
82,612 KB
testcase_23 AC 487 ms
84,056 KB
testcase_24 AC 914 ms
86,212 KB
testcase_25 AC 97 ms
78,264 KB
testcase_26 AC 728 ms
85,560 KB
testcase_27 AC 948 ms
86,832 KB
testcase_28 AC 76 ms
73,508 KB
testcase_29 AC 77 ms
73,572 KB
testcase_30 AC 703 ms
84,948 KB
testcase_31 AC 685 ms
85,204 KB
testcase_32 AC 631 ms
83,796 KB
testcase_33 AC 955 ms
86,088 KB
testcase_34 AC 842 ms
86,064 KB
testcase_35 AC 446 ms
83,100 KB
testcase_36 AC 258 ms
81,556 KB
testcase_37 AC 515 ms
84,404 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = 1 << 17
INF = 10 ** 9
n, d, K = map(int, input().split())
x = [int(input()) for _ in range(n)]

dat = [(INF, INF)] * (N * 2)

def seg_update(k, v):
    global dat
    dat[k + N] = (v, k)
    k += N
    while k > 1:
        dat[k >> 1] = min(dat[k], dat[k ^ 1])
        k >>= 1

mn = (INF, INF)
l = 0
r = 0
def sub(k, ll, rr):
    global mn
    if l <= ll and rr <= r:
        mn = min(mn, dat[k])
        return
    mm = (ll + rr) // 2
    if mm > l:
        sub(k * 2 + 0, ll, mm)
    if mm < r:
        sub(k * 2 + 1, mm, rr)

for i in range(n):
    seg_update(i, x[i])

opt = (0, 0, 0)
for i in range(1, n):
    sub(1, 0, N)
    j = max(0, i - d)
    l = j
    r = i
    mn = (INF, INF)
    sub(1, 0, N)
    val = mn
    opt = max(opt, (x[i] - val[0], -val[1], -i))

if opt[0] == 0:
    print(0)
else:
    print(opt[0] * K)
    print(-opt[1], -opt[2])
0