結果

問題 No.1619 Coccinellidae
ユーザー simansiman
提出日時 2022-05-04 15:01:30
言語 Ruby
(3.3.0)
結果
WA  
実行時間 -
コード長 277 bytes
コンパイル時間 222 ms
コンパイル使用メモリ 11,368 KB
実行使用メモリ 18,160 KB
最終ジャッジ日時 2023-09-16 18:01:31
合計ジャッジ時間 6,249 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 76 ms
15,136 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 AC 79 ms
15,292 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 77 ms
15,080 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 78 ms
15,288 KB
testcase_16 AC 81 ms
15,128 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

N, M, K = gets.split.map(&:to_i)
tail = [*1..N - 1]
S = M - tail.sum
tail.push(S)

top = []
k = K

while k > 0 && tail.size > 0
  l = tail.size
  v = tail.pop

  if k >= l - 1
    k -= (l - 1)
    top.push(v)
  else
    tail.insert(k, v)
    break
  end
end

puts (top + tail)
0