結果

問題 No.678 2Dシューティングゲームの必殺ビーム
ユーザー letrangerjpletrangerjp
提出日時 2018-04-27 22:49:06
言語 Ruby
(3.3.0)
結果
AC  
実行時間 84 ms / 2,000 ms
コード長 399 bytes
コンパイル時間 329 ms
コンパイル使用メモリ 11,244 KB
実行使用メモリ 15,360 KB
最終ジャッジ日時 2023-09-10 06:37:36
合計ジャッジ時間 3,287 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 81 ms
15,280 KB
testcase_01 AC 82 ms
15,088 KB
testcase_02 AC 83 ms
15,156 KB
testcase_03 AC 81 ms
15,356 KB
testcase_04 AC 80 ms
15,312 KB
testcase_05 AC 82 ms
15,088 KB
testcase_06 AC 84 ms
15,156 KB
testcase_07 AC 81 ms
15,160 KB
testcase_08 AC 81 ms
15,124 KB
testcase_09 AC 81 ms
15,052 KB
testcase_10 AC 83 ms
15,196 KB
testcase_11 AC 82 ms
15,320 KB
testcase_12 AC 81 ms
15,304 KB
testcase_13 AC 81 ms
15,292 KB
testcase_14 AC 80 ms
15,180 KB
testcase_15 AC 84 ms
15,164 KB
testcase_16 AC 81 ms
15,172 KB
testcase_17 AC 81 ms
15,360 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

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
0