結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 76 ms
15,088 KB
testcase_01 AC 146 ms
17,208 KB
testcase_02 WA -
testcase_03 AC 76 ms
15,080 KB
testcase_04 AC 164 ms
17,732 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 130 ms
16,708 KB
testcase_08 WA -
testcase_09 AC 77 ms
15,240 KB
testcase_10 AC 124 ms
16,604 KB
testcase_11 WA -
testcase_12 AC 79 ms
15,076 KB
testcase_13 AC 167 ms
17,540 KB
testcase_14 WA -
testcase_15 AC 78 ms
15,176 KB
testcase_16 AC 79 ms
15,088 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

N, M, K = gets.split.map(&:to_i)
tail = [*0..N - 2]
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