結果

問題 No.1619 Coccinellidae
ユーザー yuruhiyayuruhiya
提出日時 2021-07-22 22:43:08
言語 Ruby
(3.3.0)
結果
WA  
実行時間 -
コード長 274 bytes
コンパイル時間 368 ms
コンパイル使用メモリ 11,236 KB
実行使用メモリ 16,796 KB
最終ジャッジ日時 2023-09-24 18:14:57
合計ジャッジ時間 4,176 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 75 ms
15,232 KB
testcase_01 AC 128 ms
16,608 KB
testcase_02 AC 138 ms
16,536 KB
testcase_03 AC 81 ms
15,144 KB
testcase_04 AC 146 ms
16,796 KB
testcase_05 AC 112 ms
15,924 KB
testcase_06 WA -
testcase_07 AC 119 ms
16,148 KB
testcase_08 AC 117 ms
15,908 KB
testcase_09 AC 78 ms
15,068 KB
testcase_10 AC 110 ms
16,048 KB
testcase_11 AC 125 ms
16,292 KB
testcase_12 AC 76 ms
15,020 KB
testcase_13 AC 139 ms
16,784 KB
testcase_14 AC 135 ms
16,540 KB
testcase_15 AC 79 ms
15,132 KB
testcase_16 AC 78 ms
15,016 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

n, m, k = gets.split.map &:to_i
ans = [p] * 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.select { _1 }.max + 1
(0...n).each { |i| ans[i] ||= x += 1 }
ans[ans.index ans.max] += m - ans.sum
puts ans * "\n"
0