結果

問題 No.489 株に挑戦
ユーザー 6soukiti296soukiti29
提出日時 2017-06-22 19:43:03
言語 Nim
(2.0.2)
結果
TLE  
実行時間 -
コード長 1,013 bytes
コンパイル時間 4,203 ms
コンパイル使用メモリ 70,716 KB
実行使用メモリ 4,868 KB
最終ジャッジ日時 2023-09-12 13:10:04
合計ジャッジ時間 7,722 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 114 ms
4,868 KB
testcase_01 TLE -
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 1 ms
4,380 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 1 ms
4,376 KB
testcase_09 AC 2 ms
4,376 KB
testcase_10 AC 2 ms
4,380 KB
testcase_11 AC 2 ms
4,376 KB
testcase_12 AC 2 ms
4,376 KB
testcase_13 WA -
testcase_14 AC 2 ms
4,376 KB
testcase_15 AC 5 ms
4,376 KB
testcase_16 TLE -
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 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

import sequtils,strutils,algorithm

var
    L : seq[int]
    N,D,K : int
    X = newSeq[int](0)
    x,i,j :int
L = stdin.readline.split.map(parseInt)
(N, D, K) = (L[0], L[1], L[2])
for n in 0..<N:
    x = stdin.readline.parseInt
    X.add(x)
var m,M,Bday,Sday,Max_be,day : int
M = 0
Max_be = 0
var
    InD = newSeq[int](0)
for d in 0..D:
    InD.add(X[d])
InD.sort(system.cmp)

for d,price in X[0..high(X)-D-1]:
    if InD[^1] - X[d] > Max_be:
        day = d
        Max_be = InD[^1] - X[d]
        M = InD[^1]
    InD.delete(InD.binarySearch(X[d]))
    InD.insert(X[d + D + 1],InD.lowerBound(X[d + D + 1]))
for d,price in X[high(X)-D..high(X)]:
    if InD[^1] - price > Max_be:
        day = high(X) - D + d
        Max_be = InD[^1] - X[d]
        M = InD[^1]
    InD.delete(InD.binarySearch(X[high(X) - D + d]))
if day + D > high(X):
    j = high(X)
else:
    j = day + D
Bday = day
for d,x in X[day..j]:
    if x == M:
        Sday = d + day
        break
echo Max_be * K
if Max_be > 0:
    echo Bday," ",Sday
0