結果
| 問題 | No.678 2Dシューティングゲームの必殺ビーム | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2018-04-27 22:49:06 | 
| 言語 | Ruby (3.4.1) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 92 ms / 2,000 ms | 
| コード長 | 399 bytes | 
| コンパイル時間 | 38 ms | 
| コンパイル使用メモリ | 7,552 KB | 
| 実行使用メモリ | 12,288 KB | 
| 最終ジャッジ日時 | 2024-06-27 22:05:55 | 
| 合計ジャッジ時間 | 2,344 ms | 
| ジャッジサーバーID (参考情報) | judge2 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 18 | 
コンパイルメッセージ
Syntax OK
ソースコード
N, xLB, xRB = gets.split.map &:to_i
enemies = $<.map.with_index{|s, i|
  [i] + s.split.map(&:to_i)
}.sort_by{|i, xl, yu, xr, yd|
  -yd
}
beam = [false] * 1281
(xLB..xRB).each{|x|
  beam[x] = true
}
ans = [0] * N
enemies.each{|i, xl, yu, xr, yd|
  hit = false
  ([0, xl].max..[1280, xr].min).each{|x|
    if beam[x]
      hit = true
      beam[x] = false
    end
  }
  ans[i] = 1 if hit
}
puts ans
            
            
            
        