結果

問題 No.489 株に挑戦
ユーザー 0w10w1
提出日時 2017-04-10 20:01:05
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 618 bytes
コンパイル時間 270 ms
コンパイル使用メモリ 86,828 KB
実行使用メモリ 82,924 KB
最終ジャッジ日時 2023-09-25 06:52:44
合計ジャッジ時間 7,369 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 AC 88 ms
71,604 KB
testcase_03 AC 88 ms
71,332 KB
testcase_04 AC 88 ms
71,516 KB
testcase_05 AC 86 ms
71,404 KB
testcase_06 AC 88 ms
71,532 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 88 ms
71,684 KB
testcase_10 WA -
testcase_11 AC 88 ms
71,496 KB
testcase_12 AC 90 ms
71,364 KB
testcase_13 AC 89 ms
71,684 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 166 ms
80,916 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 172 ms
80,908 KB
testcase_21 AC 136 ms
78,528 KB
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 AC 88 ms
71,484 KB
testcase_26 AC 161 ms
81,584 KB
testcase_27 RE -
testcase_28 AC 90 ms
71,772 KB
testcase_29 AC 89 ms
71,772 KB
testcase_30 AC 177 ms
81,808 KB
testcase_31 AC 161 ms
82,924 KB
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
testcase_36 AC 127 ms
78,108 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 - X[ 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