結果

問題 No.1248 Kth Sum
ユーザー soratasorata
提出日時 2020-10-24 12:26:14
言語 Ruby
(3.3.0)
結果
WA  
実行時間 -
コード長 148 bytes
コンパイル時間 299 ms
コンパイル使用メモリ 11,272 KB
実行使用メモリ 30,228 KB
最終ジャッジ日時 2023-09-28 20:22:23
合計ジャッジ時間 7,371 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 80 ms
15,304 KB
testcase_01 AC 81 ms
15,208 KB
testcase_02 AC 80 ms
15,116 KB
testcase_03 AC 79 ms
15,236 KB
testcase_04 AC 81 ms
15,244 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 80 ms
15,048 KB
testcase_08 AC 79 ms
15,308 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 158 ms
30,092 KB
testcase_14 WA -
testcase_15 AC 155 ms
30,180 KB
testcase_16 TLE -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.rb:3: warning: assigned but unused variable - i
Syntax OK

ソースコード

diff #

#!ruby
n,k,*a=gets(p).split.map(&:to_i)
i=0
d=n/k
m=a[k-1]
2.upto(d) do
  u = (1..d).map{|i|a[i*k-1,k].min}.inject{|x,y|x+y}
  m = [m,u].min
end
p m
0