結果

問題 No.489 株に挑戦
ユーザー amowweeamowwee
提出日時 2017-02-25 00:54:13
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 558 bytes
コンパイル時間 207 ms
コンパイル使用メモリ 11,020 KB
実行使用メモリ 15,628 KB
最終ジャッジ日時 2023-08-31 01:10:19
合計ジャッジ時間 5,419 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 176 ms
15,628 KB
testcase_01 AC 123 ms
10,304 KB
testcase_02 AC 16 ms
7,860 KB
testcase_03 AC 15 ms
7,816 KB
testcase_04 AC 16 ms
7,920 KB
testcase_05 AC 16 ms
7,972 KB
testcase_06 AC 16 ms
7,824 KB
testcase_07 AC 15 ms
7,992 KB
testcase_08 AC 15 ms
7,860 KB
testcase_09 AC 15 ms
7,788 KB
testcase_10 AC 15 ms
7,816 KB
testcase_11 AC 16 ms
7,868 KB
testcase_12 AC 15 ms
7,788 KB
testcase_13 AC 16 ms
7,984 KB
testcase_14 AC 16 ms
7,920 KB
testcase_15 AC 27 ms
8,464 KB
testcase_16 AC 203 ms
11,716 KB
testcase_17 AC 49 ms
8,688 KB
testcase_18 AC 123 ms
10,056 KB
testcase_19 AC 98 ms
9,992 KB
testcase_20 AC 202 ms
11,936 KB
testcase_21 AC 63 ms
9,104 KB
testcase_22 AC 33 ms
8,580 KB
testcase_23 AC 133 ms
10,436 KB
testcase_24 AC 226 ms
12,504 KB
testcase_25 AC 16 ms
7,968 KB
testcase_26 TLE -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

N,D,K = map(int, input().split(" "))
x_list = [int(input()) for i in range(N)]
dif_max = 0
max_day = -1

for i in range(N-1):
    if max_day < i:
        max_day, x_max = max(enumerate(x_list[i:min(i+D+1,N)]), key = lambda x: x[1])
        max_day += i
    elif i + D < N and x_list[i+D] > x_max:
        x_max = x_list[i+D]
        max_day = i+D
    
    if x_max - x_list[i] > dif_max:
        buy_day = i
        sell_day = max_day
        dif_max = x_max - x_list[i]

if dif_max > 0:
    print(dif_max * K)
    print(buy_day, sell_day)
else:
    print(0)
0