結果

問題 No.489 株に挑戦
ユーザー 0w10w1
提出日時 2017-04-10 20:03:54
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 614 bytes
コンパイル時間 404 ms
コンパイル使用メモリ 87,212 KB
実行使用メモリ 83,080 KB
最終ジャッジ日時 2023-09-25 06:53:06
合計ジャッジ時間 7,437 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 166 ms
80,888 KB
testcase_01 AC 148 ms
80,396 KB
testcase_02 WA -
testcase_03 AC 92 ms
71,864 KB
testcase_04 AC 92 ms
71,868 KB
testcase_05 AC 92 ms
71,412 KB
testcase_06 AC 92 ms
71,912 KB
testcase_07 AC 90 ms
71,788 KB
testcase_08 WA -
testcase_09 AC 92 ms
71,608 KB
testcase_10 AC 95 ms
71,868 KB
testcase_11 AC 93 ms
71,788 KB
testcase_12 AC 93 ms
71,756 KB
testcase_13 AC 95 ms
71,632 KB
testcase_14 AC 99 ms
71,868 KB
testcase_15 AC 129 ms
78,100 KB
testcase_16 AC 163 ms
80,892 KB
testcase_17 WA -
testcase_18 AC 149 ms
80,508 KB
testcase_19 AC 141 ms
79,456 KB
testcase_20 AC 165 ms
80,912 KB
testcase_21 AC 142 ms
78,672 KB
testcase_22 AC 134 ms
78,696 KB
testcase_23 AC 155 ms
80,924 KB
testcase_24 AC 170 ms
81,604 KB
testcase_25 AC 93 ms
71,516 KB
testcase_26 AC 161 ms
81,960 KB
testcase_27 RE -
testcase_28 WA -
testcase_29 AC 92 ms
71,848 KB
testcase_30 AC 178 ms
81,772 KB
testcase_31 WA -
testcase_32 AC 152 ms
80,876 KB
testcase_33 AC 169 ms
81,624 KB
testcase_34 AC 172 ms
81,260 KB
testcase_35 AC 139 ms
79,228 KB
testcase_36 AC 128 ms
78,240 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