結果
| 問題 | No.678 2Dシューティングゲームの必殺ビーム | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2018-04-27 22:42:05 | 
| 言語 | Ruby (3.4.1) | 
| 結果 | 
                                WA
                                 
                             | 
| 実行時間 | - | 
| コード長 | 515 bytes | 
| コンパイル時間 | 200 ms | 
| コンパイル使用メモリ | 7,424 KB | 
| 実行使用メモリ | 12,288 KB | 
| 最終ジャッジ日時 | 2024-06-27 22:01:04 | 
| 合計ジャッジ時間 | 2,755 ms | 
| ジャッジサーバーID (参考情報) | judge2 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 16 WA * 2 | 
コンパイルメッセージ
Main.rb:20: warning: assigned but unused variable - top Main.rb:20: warning: assigned but unused variable - bottom Syntax OK
ソースコード
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
    [-bottom, i, left, top, right, bottom]
end
enemies.sort!
ans = [0]*N
enemies.each do |enemy|
    _, 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"
            
            
            
        