結果

問題 No.2560 A_1 < A_2 < ... < A_N
ユーザー VvyLwVvyLw
提出日時 2023-12-02 15:15:35
言語 Ruby
(3.3.0)
結果
AC  
実行時間 372 ms / 2,000 ms
コード長 201 bytes
コンパイル時間 334 ms
コンパイル使用メモリ 11,904 KB
実行使用メモリ 19,328 KB
最終ジャッジ日時 2023-12-02 15:15:40
合計ジャッジ時間 5,257 ms
ジャッジサーバーID
(参考情報)
judge11 / judge9
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 82 ms
16,256 KB
testcase_01 AC 156 ms
18,560 KB
testcase_02 AC 170 ms
18,816 KB
testcase_03 AC 164 ms
18,816 KB
testcase_04 AC 172 ms
18,944 KB
testcase_05 AC 175 ms
19,328 KB
testcase_06 AC 336 ms
16,384 KB
testcase_07 AC 372 ms
16,384 KB
testcase_08 AC 335 ms
16,384 KB
testcase_09 AC 337 ms
16,384 KB
testcase_10 AC 369 ms
16,384 KB
testcase_11 AC 84 ms
16,256 KB
testcase_12 AC 85 ms
16,256 KB
testcase_13 AC 83 ms
16,256 KB
testcase_14 AC 84 ms
16,256 KB
testcase_15 AC 89 ms
16,256 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.rb:4: warning: ambiguous first argument; put parentheses or a space even after `-' operator
Syntax OK

ソースコード

diff #

def solve
  n,x=gets.split.map &:to_i
  if n*(n+1)/2>x then
    p -1
    return
  end
  a=[]
  (1..n-1).each{|i|
    a.append(i)
  }
  a.append(x-a.sum)
  puts a.join ' '
end
gets.to_i.times{
  solve
}
0