結果

問題 No.2567 A_1 > A_2 > ... > A_N
ユーザー ngng628ngng628
提出日時 2023-12-02 16:20:29
言語 Crystal
(1.11.2)
結果
RE  
実行時間 -
コード長 279 bytes
コンパイル時間 10,230 ms
コンパイル使用メモリ 293,880 KB
実行使用メモリ 6,676 KB
最終ジャッジ日時 2023-12-02 16:20:44
合計ジャッジ時間 12,134 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
6,548 KB
testcase_01 RE -
testcase_02 RE -
testcase_03 RE -
testcase_04 RE -
testcase_05 RE -
testcase_06 AC 119 ms
6,548 KB
testcase_07 AC 119 ms
6,548 KB
testcase_08 AC 123 ms
6,676 KB
testcase_09 AC 120 ms
6,676 KB
testcase_10 AC 139 ms
6,676 KB
testcase_11 AC 2 ms
6,676 KB
testcase_12 AC 3 ms
6,676 KB
testcase_13 AC 3 ms
6,676 KB
testcase_14 AC 3 ms
6,676 KB
testcase_15 AC 3 ms
6,676 KB
testcase_16 AC 3 ms
6,676 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

t = read_line.to_i64
t.times do
  n, x = read_line.split.map &.to_i64
  a = [*(1..n)].reverse
  if a.sum <= x
    t = x - a.sum
    k = t // n
    r = t - k * n
    n.times do |i|
      a[i] += k
      a[i] += 1 if i < r
    end
    puts a.join(' ')
  else
    puts -1
  end
end
0