結果

問題 No.332 数列をプレゼントに
ユーザー cympfhcympfh
提出日時 2016-02-15 20:59:31
言語 Ruby
(3.3.0)
結果
WA  
実行時間 -
コード長 310 bytes
コンパイル時間 125 ms
コンパイル使用メモリ 11,868 KB
実行使用メモリ 16,068 KB
最終ジャッジ日時 2023-10-22 05:51:17
合計ジャッジ時間 7,768 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 84 ms
16,068 KB
testcase_01 AC 87 ms
16,068 KB
testcase_02 AC 86 ms
16,068 KB
testcase_03 AC 85 ms
16,068 KB
testcase_04 AC 85 ms
16,068 KB
testcase_05 AC 86 ms
16,068 KB
testcase_06 AC 84 ms
16,068 KB
testcase_07 AC 85 ms
16,068 KB
testcase_08 AC 85 ms
16,068 KB
testcase_09 AC 84 ms
16,068 KB
testcase_10 AC 84 ms
16,068 KB
testcase_11 AC 84 ms
16,068 KB
testcase_12 AC 85 ms
16,068 KB
testcase_13 AC 84 ms
16,068 KB
testcase_14 AC 84 ms
16,068 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 86 ms
16,068 KB
testcase_19 WA -
testcase_20 AC 85 ms
16,068 KB
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 84 ms
16,068 KB
testcase_24 AC 85 ms
16,068 KB
testcase_25 AC 86 ms
16,068 KB
testcase_26 AC 84 ms
16,068 KB
testcase_27 AC 84 ms
16,068 KB
testcase_28 AC 84 ms
16,068 KB
testcase_29 AC 85 ms
16,068 KB
testcase_30 AC 85 ms
16,068 KB
testcase_31 AC 85 ms
16,068 KB
testcase_32 AC 84 ms
16,068 KB
testcase_33 AC 86 ms
16,068 KB
testcase_34 AC 87 ms
16,068 KB
testcase_35 AC 85 ms
16,068 KB
testcase_36 AC 84 ms
16,068 KB
testcase_37 AC 85 ms
16,068 KB
testcase_38 AC 87 ms
16,068 KB
testcase_39 AC 87 ms
16,068 KB
testcase_40 AC 85 ms
16,068 KB
testcase_41 AC 84 ms
16,068 KB
testcase_42 AC 85 ms
16,064 KB
testcase_43 AC 84 ms
16,068 KB
testcase_44 WA -
testcase_45 AC 88 ms
16,068 KB
testcase_46 AC 88 ms
16,068 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

n,x=gets.split.map(&:to_i)
as=gets.split.map(&:to_i).map.with_index { |a,i| [a,i] }
as.sort!
as.reverse!

ans = []
for i in 0...n
  if 0 <= x-as[i][0]
    x -= as[i][0]
    ans[as[i][1]] = true
  else
    ans[as[i][1]] = false
  end
end

if x == 0
  puts ans.map{|b|b ? 'o' : 'x'}.join ''
else
  puts "No"
end
0