結果

問題 No.678 2Dシューティングゲームの必殺ビーム
ユーザー face4face4
提出日時 2018-04-28 14:59:24
言語 Java21
(openjdk 21)
結果
AC  
実行時間 59 ms / 2,000 ms
コード長 1,872 bytes
コンパイル時間 2,285 ms
コンパイル使用メモリ 75,108 KB
実行使用メモリ 49,924 KB
最終ジャッジ日時 2023-09-10 07:48:30
合計ジャッジ時間 4,040 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 44 ms
49,472 KB
testcase_01 AC 45 ms
49,568 KB
testcase_02 AC 44 ms
49,396 KB
testcase_03 AC 44 ms
49,564 KB
testcase_04 AC 44 ms
49,348 KB
testcase_05 AC 45 ms
49,412 KB
testcase_06 AC 46 ms
49,392 KB
testcase_07 AC 45 ms
49,332 KB
testcase_08 AC 46 ms
49,276 KB
testcase_09 AC 46 ms
49,388 KB
testcase_10 AC 48 ms
49,480 KB
testcase_11 AC 48 ms
49,344 KB
testcase_12 AC 49 ms
49,428 KB
testcase_13 AC 51 ms
49,660 KB
testcase_14 AC 50 ms
49,876 KB
testcase_15 AC 59 ms
49,924 KB
testcase_16 AC 46 ms
49,412 KB
testcase_17 AC 51 ms
49,352 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.Comparator;

class Enemy{
    int xl,yu,xr,yd;
    int number;
    Enemy(int xl , int yu , int xr , int yd, int number){
        this.xl = xl;
        this.yu = yu;
        this.xr = xr;
        this.yd = yd;
        this.number = number;
    }
}

class Main{
    public static void main(String[] args) throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String[] input = br.readLine().split(" ");
        
        int n = Integer.parseInt(input[0]);
        int laserL = Integer.parseInt(input[1]);
        int laserR = Integer.parseInt(input[2]);
        
        int[] beam = new int[1281];
        Arrays.fill(beam, 0);

        Enemy[] enemies = new Enemy[n];
        for(int i = 0; i < n; i++){
            input = br.readLine().split(" ");
            enemies[i] = new Enemy(Integer.parseInt(input[0]),Integer.parseInt(input[1]),
                                    Integer.parseInt(input[2]), Integer.parseInt(input[3]), i+1);
        }

        Arrays.sort(enemies, new Comparator<Enemy>(){
            @Override
            public int compare(Enemy e1, Enemy e2){
                return e1.yd - e2.yd;
            }
        });

        for(int i = 0; i < n; i++){
            for(int j = Math.max(1,enemies[i].xl); j <= Math.min(1280,enemies[i].xr); j++){
                beam[j] = enemies[i].number;
            }
        }

        boolean[] hit = new boolean[n];
        for(int i = laserL; i <= laserR; i++){
            if(beam[i] != 0){
                hit[beam[i]-1] = true;
            }
        }

        for(int i = 0; i < n; i++){
            if(hit[i])   System.out.println("1");
            else        System.out.println("0");
        }
        
    }
}
0