結果

問題 No.1619 Coccinellidae
ユーザー yuruhiyayuruhiya
提出日時 2021-07-22 22:34:12
言語 Ruby
(3.3.0)
結果
RE  
実行時間 -
コード長 246 bytes
コンパイル時間 269 ms
コンパイル使用メモリ 11,460 KB
実行使用メモリ 16,728 KB
最終ジャッジ日時 2023-09-24 17:53:05
合計ジャッジ時間 3,523 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 82 ms
15,256 KB
testcase_01 RE -
testcase_02 AC 140 ms
16,616 KB
testcase_03 AC 83 ms
15,156 KB
testcase_04 RE -
testcase_05 AC 114 ms
16,164 KB
testcase_06 AC 82 ms
15,320 KB
testcase_07 RE -
testcase_08 AC 117 ms
16,028 KB
testcase_09 AC 83 ms
15,020 KB
testcase_10 RE -
testcase_11 AC 124 ms
16,180 KB
testcase_12 RE -
testcase_13 RE -
testcase_14 AC 137 ms
16,728 KB
testcase_15 RE -
testcase_16 AC 86 ms
15,056 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

n, m, k = gets.split.map &:to_i
ans = [p] * n
x = 0
loop do
	p = n - 1 - x
	if k >= p
		ans[~x] = x
		k -= p
	else
		ans[k] = x
		break
	end
	x += 1
end
(0...n).each { |i| ans[i] ||= x += 1 }
ans[ans.index ans.max] += m - ans.sum
puts ans * "\n"
0