結果

問題 No.489 株に挑戦
ユーザー pekempeypekempey
提出日時 2017-02-27 21:50:00
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 232 ms / 1,000 ms
コード長 807 bytes
コンパイル時間 261 ms
コンパイル使用メモリ 87,288 KB
実行使用メモリ 84,060 KB
最終ジャッジ日時 2023-09-27 05:31:58
合計ジャッジ時間 6,977 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 193 ms
82,992 KB
testcase_01 AC 174 ms
82,128 KB
testcase_02 AC 66 ms
73,448 KB
testcase_03 AC 66 ms
73,484 KB
testcase_04 AC 67 ms
73,192 KB
testcase_05 AC 69 ms
73,336 KB
testcase_06 AC 69 ms
77,836 KB
testcase_07 AC 71 ms
77,756 KB
testcase_08 AC 65 ms
73,184 KB
testcase_09 AC 70 ms
77,668 KB
testcase_10 AC 72 ms
77,860 KB
testcase_11 AC 71 ms
77,856 KB
testcase_12 AC 71 ms
77,668 KB
testcase_13 AC 69 ms
77,672 KB
testcase_14 AC 70 ms
77,852 KB
testcase_15 AC 124 ms
80,604 KB
testcase_16 AC 232 ms
83,432 KB
testcase_17 AC 123 ms
80,452 KB
testcase_18 AC 195 ms
82,040 KB
testcase_19 AC 183 ms
81,868 KB
testcase_20 AC 220 ms
83,512 KB
testcase_21 AC 146 ms
80,956 KB
testcase_22 AC 133 ms
80,808 KB
testcase_23 AC 170 ms
82,204 KB
testcase_24 AC 220 ms
84,060 KB
testcase_25 AC 74 ms
77,736 KB
testcase_26 AC 193 ms
83,064 KB
testcase_27 AC 220 ms
83,980 KB
testcase_28 AC 69 ms
73,472 KB
testcase_29 AC 66 ms
73,344 KB
testcase_30 AC 191 ms
83,512 KB
testcase_31 AC 190 ms
83,596 KB
testcase_32 AC 180 ms
82,208 KB
testcase_33 AC 232 ms
83,844 KB
testcase_34 AC 214 ms
83,000 KB
testcase_35 AC 160 ms
80,916 KB
testcase_36 AC 153 ms
80,920 KB
testcase_37 AC 194 ms
82,736 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, i)
    k += N
    while k > 1:
        dat[k >> 1] = min(dat[k], dat[k ^ 1])
        k >>= 1

def seg_query(l, r):
    l += N
    r += N
    mn = (INF, INF)
    while l < r:
        if l & 1:
            mn = min(mn, dat[l])
            l += 1
        if r & 1:
            mn = min(mn, dat[r - 1])
        l >>= 1
        r >>= 1
    return mn        

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

opt = (0, 0, 0)
for i in range(1, n):
    j = max(0, i - d)
    val = seg_query(j, i)
    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