結果

問題 No.489 株に挑戦
ユーザー kjnhokjnho
提出日時 2017-02-25 01:13:22
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 1,489 bytes
コンパイル時間 165 ms
コンパイル使用メモリ 11,072 KB
実行使用メモリ 58,592 KB
最終ジャッジ日時 2023-09-01 21:47:40
合計ジャッジ時間 19,774 ms
ジャッジサーバーID
(参考情報)
judge16 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 TLE -
testcase_01 WA -
testcase_02 AC 135 ms
30,152 KB
testcase_03 AC 134 ms
30,076 KB
testcase_04 AC 138 ms
30,032 KB
testcase_05 WA -
testcase_06 AC 141 ms
30,080 KB
testcase_07 AC 141 ms
30,040 KB
testcase_08 AC 134 ms
29,912 KB
testcase_09 AC 139 ms
30,048 KB
testcase_10 AC 137 ms
29,988 KB
testcase_11 AC 136 ms
29,864 KB
testcase_12 AC 136 ms
29,936 KB
testcase_13 WA -
testcase_14 AC 135 ms
29,860 KB
testcase_15 AC 149 ms
30,212 KB
testcase_16 TLE -
testcase_17 AC 166 ms
30,616 KB
testcase_18 AC 358 ms
31,652 KB
testcase_19 AC 413 ms
31,880 KB
testcase_20 TLE -
testcase_21 WA -
testcase_22 AC 155 ms
30,364 KB
testcase_23 AC 266 ms
32,264 KB
testcase_24 TLE -
testcase_25 AC 139 ms
30,040 KB
testcase_26 TLE -
testcase_27 WA -
testcase_28 AC 134 ms
29,896 KB
testcase_29 AC 135 ms
30,040 KB
testcase_30 AC 372 ms
35,772 KB
testcase_31 AC 350 ms
35,984 KB
testcase_32 WA -
testcase_33 TLE -
testcase_34 WA -
testcase_35 WA -
testcase_36 AC 178 ms
30,652 KB
testcase_37 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

# coding: utf-8

# from scipy import integrate
import re
from operator import itemgetter
from collections import defaultdict as dd
from collections import Counter
from collections import deque
from collections import namedtuple
import numpy as np
import fractions
import math
from copy import deepcopy as dcopy
import heapq
from math import cos, sin, radians
import itertools

from heapq import *
import bisect
def main():
    N,D,K = map(int, input().split())
    values = [int(input()) for i in range(N)]

    h_window = dcopy(values[:D])
    h_window.sort()

    minimum = min(values[:D])
    w_min_index = values[:D].index(minimum)
    min_index = values[:D].index(minimum)
    maximum = max(values[:D+1])
    max_index = values[:D+1].index(maximum)

    MAX = maximum - minimum

    for j in range(D+1, N):
        del h_window[bisect.bisect_left(h_window, values[j-D-1])]

        if len(h_window) == 0:
            w_min_index = j-1
        elif values[j-1] < h_window[0]:
            w_min_index = j-1

        bisect.insort(h_window, values[j-1])
        minimum = h_window[0]
        tmp = values[j] - minimum
        if tmp > MAX:
            MAX = tmp
            max_index = j
            min_index = w_min_index

    # print(MAX, min_index, max_index)

    if MAX <= 0:
        print(0)
    else:
        print(K*MAX)
        print(min_index, max_index)

if __name__ == "__main__":  # {{{
    try:
        import test
        test.test()
    except:
        main()  # }}}

 
0