結果

問題 No.489 株に挑戦
ユーザー smz_8110smz_8110
提出日時 2017-04-11 16:28:33
言語 Ruby
(3.3.0)
結果
WA  
実行時間 -
コード長 443 bytes
コンパイル時間 56 ms
コンパイル使用メモリ 11,468 KB
実行使用メモリ 16,648 KB
最終ジャッジ日時 2023-09-25 11:11:52
合計ジャッジ時間 6,346 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 AC 80 ms
15,144 KB
testcase_03 AC 80 ms
15,276 KB
testcase_04 AC 79 ms
15,100 KB
testcase_05 AC 80 ms
15,256 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 79 ms
15,040 KB
testcase_09 AC 80 ms
15,128 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 80 ms
15,056 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 134 ms
16,272 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 139 ms
16,320 KB
testcase_21 AC 94 ms
15,232 KB
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 AC 81 ms
15,008 KB
testcase_26 AC 142 ms
16,132 KB
testcase_27 WA -
testcase_28 AC 80 ms
15,240 KB
testcase_29 AC 79 ms
15,096 KB
testcase_30 AC 146 ms
16,116 KB
testcase_31 AC 146 ms
16,148 KB
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
testcase_36 AC 88 ms
15,328 KB
testcase_37 AC 115 ms
15,784 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

N,D,K=gets.split.map &:to_i
a=N.times.map{gets.to_i}
c=1
min=a[0]
v=0
b=[a[0]]
x=y=z=0
i,j=0,1
while j<a.size
  if j-i>D
    if a[i]==min
      c-=1
      if c==0
        b=a[i+1,D]
        min=b.min
        c=b.count(min)
        v=b.index(min)
      end
    end
    i+=1
  elsif a[j]<min
    min=a[j]
    c=1
    v=j
  elsif a[j]==min
    c+=1
  elsif a[j]-min>z
    z=a[j]-min
    x=v
    y=j
  end
  j+=1
end
p z*K
puts "#{x} #{y}" if z>0
0