結果
問題 |
No.332 数列をプレゼントに
|
ユーザー |
|
提出日時 | 2016-02-15 20:59:31 |
言語 | Ruby (3.4.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 310 bytes |
コンパイル時間 | 364 ms |
コンパイル使用メモリ | 7,424 KB |
実行使用メモリ | 12,416 KB |
最終ジャッジ日時 | 2024-09-22 07:10:01 |
合計ジャッジ時間 | 6,440 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 5 |
other | AC * 35 WA * 7 |
コンパイルメッセージ
Syntax OK
ソースコード
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