結果

問題 No.1619 Coccinellidae
ユーザー yuruhiyayuruhiya
提出日時 2021-07-22 22:45:43
言語 Ruby
(3.3.0)
結果
AC  
実行時間 136 ms / 2,000 ms
コード長 269 bytes
コンパイル時間 341 ms
コンパイル使用メモリ 11,196 KB
実行使用メモリ 16,636 KB
最終ジャッジ日時 2023-09-24 18:20:36
合計ジャッジ時間 3,639 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 83 ms
15,244 KB
testcase_01 AC 124 ms
16,132 KB
testcase_02 AC 131 ms
16,588 KB
testcase_03 AC 82 ms
15,296 KB
testcase_04 AC 136 ms
16,636 KB
testcase_05 AC 108 ms
15,924 KB
testcase_06 AC 76 ms
15,292 KB
testcase_07 AC 114 ms
16,148 KB
testcase_08 AC 106 ms
16,120 KB
testcase_09 AC 76 ms
15,216 KB
testcase_10 AC 108 ms
15,892 KB
testcase_11 AC 118 ms
16,248 KB
testcase_12 AC 80 ms
15,340 KB
testcase_13 AC 135 ms
16,592 KB
testcase_14 AC 131 ms
16,612 KB
testcase_15 AC 78 ms
15,208 KB
testcase_16 AC 79 ms
15,032 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

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