結果

問題 No.489 株に挑戦
ユーザー 0w10w1
提出日時 2017-04-10 20:06:48
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 171 ms / 1,000 ms
コード長 643 bytes
コンパイル時間 277 ms
コンパイル使用メモリ 87,040 KB
実行使用メモリ 82,924 KB
最終ジャッジ日時 2023-09-27 05:46:20
合計ジャッジ時間 6,472 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 153 ms
81,040 KB
testcase_01 AC 138 ms
80,864 KB
testcase_02 AC 82 ms
71,600 KB
testcase_03 AC 83 ms
71,804 KB
testcase_04 AC 83 ms
71,460 KB
testcase_05 AC 83 ms
71,740 KB
testcase_06 AC 83 ms
71,752 KB
testcase_07 AC 83 ms
71,756 KB
testcase_08 AC 83 ms
71,612 KB
testcase_09 AC 83 ms
71,836 KB
testcase_10 AC 83 ms
71,620 KB
testcase_11 AC 84 ms
71,648 KB
testcase_12 AC 83 ms
71,932 KB
testcase_13 AC 85 ms
71,612 KB
testcase_14 AC 82 ms
71,464 KB
testcase_15 AC 118 ms
78,200 KB
testcase_16 AC 151 ms
80,980 KB
testcase_17 AC 134 ms
78,544 KB
testcase_18 AC 153 ms
80,576 KB
testcase_19 AC 131 ms
79,468 KB
testcase_20 AC 153 ms
81,140 KB
testcase_21 AC 127 ms
78,916 KB
testcase_22 AC 120 ms
78,488 KB
testcase_23 AC 148 ms
80,884 KB
testcase_24 AC 171 ms
81,512 KB
testcase_25 AC 85 ms
71,708 KB
testcase_26 AC 150 ms
81,588 KB
testcase_27 AC 159 ms
81,692 KB
testcase_28 AC 82 ms
71,572 KB
testcase_29 AC 83 ms
71,824 KB
testcase_30 AC 162 ms
81,812 KB
testcase_31 AC 157 ms
82,924 KB
testcase_32 AC 141 ms
80,604 KB
testcase_33 AC 159 ms
81,552 KB
testcase_34 AC 155 ms
81,104 KB
testcase_35 AC 127 ms
79,384 KB
testcase_36 AC 117 ms
78,028 KB
testcase_37 AC 145 ms
81,060 KB
権限があれば一括ダウンロードができます

ソースコード

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, bl ] >= [ X[ i ] - X[ window[ i ] ], - window[ i ] ]: continue
  best = X[ i ] - X[ window[ i ] ]
  bl, br = - window[ i ], i

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