結果

問題 No.678 2Dシューティングゲームの必殺ビーム
ユーザー mai
提出日時 2018-04-27 22:50:05
言語 Ruby
(3.4.1)
結果
WA  
実行時間 -
コード長 515 bytes
コンパイル時間 195 ms
コンパイル使用メモリ 7,552 KB
実行使用メモリ 12,288 KB
最終ジャッジ日時 2024-06-27 22:06:27
合計ジャッジ時間 2,382 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 16 WA * 2
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.rb:21: warning: assigned but unused variable - pr
Main.rb:21: warning: assigned but unused variable - top
Main.rb:21: warning: assigned but unused variable - bottom
Syntax OK

ソースコード

diff #

def ascan; gets.split.map(&:to_i);end

N, beam_left, beam_right = ascan


beam = [false]*1281
beam_left.upto(beam_right){|x| beam[x] = true}


enemies = (0...N).map do |i|
    left, top, right, bottom = ascan
    [-top, i, left, top, right, bottom]
end

enemies.sort!


ans = [0]*N

enemies.each do |enemy|
    pr, index, left, top, right, bottom = enemy
    
    hit = false
    left.upto(right) do |x|
        hit ||= beam[x]
        beam[x] = false
    end
    
    ans[index] = hit ? 1 : 0
end


puts ans*"\n"

0