結果

問題 No.489 株に挑戦
ユーザー 0w10w1
提出日時 2017-04-10 20:03:12
言語 PyPy3
(7.3.15)
結果
RE  
実行時間 -
コード長 613 bytes
コンパイル時間 328 ms
コンパイル使用メモリ 87,140 KB
実行使用メモリ 83,148 KB
最終ジャッジ日時 2023-09-25 06:52:55
合計ジャッジ時間 6,883 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 160 ms
80,960 KB
testcase_01 AC 146 ms
80,252 KB
testcase_02 AC 88 ms
71,800 KB
testcase_03 AC 89 ms
71,540 KB
testcase_04 AC 89 ms
71,508 KB
testcase_05 AC 88 ms
71,768 KB
testcase_06 AC 89 ms
71,592 KB
testcase_07 AC 88 ms
71,512 KB
testcase_08 AC 88 ms
71,844 KB
testcase_09 AC 89 ms
71,776 KB
testcase_10 AC 89 ms
71,540 KB
testcase_11 AC 89 ms
71,768 KB
testcase_12 AC 91 ms
71,568 KB
testcase_13 AC 90 ms
71,808 KB
testcase_14 AC 90 ms
71,696 KB
testcase_15 AC 122 ms
77,960 KB
testcase_16 AC 155 ms
81,092 KB
testcase_17 AC 141 ms
78,380 KB
testcase_18 AC 145 ms
80,488 KB
testcase_19 AC 135 ms
79,644 KB
testcase_20 AC 159 ms
80,796 KB
testcase_21 AC 137 ms
78,992 KB
testcase_22 AC 125 ms
78,624 KB
testcase_23 AC 151 ms
80,696 KB
testcase_24 AC 165 ms
81,668 KB
testcase_25 AC 90 ms
71,624 KB
testcase_26 AC 157 ms
81,548 KB
testcase_27 RE -
testcase_28 AC 90 ms
71,468 KB
testcase_29 AC 87 ms
71,744 KB
testcase_30 AC 169 ms
81,812 KB
testcase_31 AC 163 ms
82,732 KB
testcase_32 AC 146 ms
80,764 KB
testcase_33 AC 168 ms
81,488 KB
testcase_34 AC 167 ms
81,228 KB
testcase_35 AC 133 ms
79,248 KB
testcase_36 AC 126 ms
77,888 KB
testcase_37 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import deque

N, D, K = map( int, input().split() )
X = list( int( input() ) for i in range( N ) )

window = [ -1 for i in range( N ) ]
dq = deque()
for i in range( N ):
  while len( dq ) and i - dq[ 0 ] > D:
    dq.popleft()
  if len( dq ):
    window[ i ] = dq[ 0 ]
  while len( dq ) and X[ i ] <= X[ dq[ len( dq ) - 1 ] ]:
    dq.pop()
  dq.append( i )

best = 0
bl, br = -1, -1
for i in range( N ):
  if window[ i ] == -1: continue
  if best >= X[ i ] - X[ window[ i ] ]: continue
  best = X[ i ] - X[ window[ i ] ]
  bl, br = window[ i ], i

print( best * K )
if best > 0:
  print( bl, br )
0