結果

問題 No.678 2Dシューティングゲームの必殺ビーム
ユーザー maimai
提出日時 2018-04-27 22:50:05
言語 Ruby
(3.3.0)
結果
WA  
実行時間 -
コード長 515 bytes
コンパイル時間 238 ms
コンパイル使用メモリ 11,504 KB
実行使用メモリ 15,380 KB
最終ジャッジ日時 2023-09-10 06:38:15
合計ジャッジ時間 2,523 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 82 ms
15,156 KB
testcase_01 AC 83 ms
15,132 KB
testcase_02 AC 82 ms
15,064 KB
testcase_03 AC 80 ms
15,184 KB
testcase_04 AC 82 ms
15,368 KB
testcase_05 AC 81 ms
15,048 KB
testcase_06 AC 82 ms
15,208 KB
testcase_07 AC 83 ms
15,320 KB
testcase_08 WA -
testcase_09 AC 82 ms
15,104 KB
testcase_10 AC 83 ms
15,192 KB
testcase_11 AC 83 ms
15,164 KB
testcase_12 AC 83 ms
15,380 KB
testcase_13 AC 83 ms
15,096 KB
testcase_14 AC 81 ms
15,056 KB
testcase_15 WA -
testcase_16 AC 81 ms
15,164 KB
testcase_17 AC 81 ms
15,192 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
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