結果

問題 No.678 2Dシューティングゲームの必殺ビーム
ユーザー asahi32942398asahi32942398
提出日時 2018-04-28 00:16:40
言語 Java19
(openjdk 21)
結果
AC  
実行時間 213 ms / 2,000 ms
コード長 1,364 bytes
コンパイル時間 4,751 ms
コンパイル使用メモリ 74,560 KB
実行使用メモリ 58,064 KB
最終ジャッジ日時 2023-09-10 07:31:28
合計ジャッジ時間 8,386 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 131 ms
55,784 KB
testcase_01 AC 127 ms
53,876 KB
testcase_02 AC 128 ms
55,788 KB
testcase_03 AC 132 ms
55,440 KB
testcase_04 AC 130 ms
55,972 KB
testcase_05 AC 132 ms
55,972 KB
testcase_06 AC 139 ms
55,384 KB
testcase_07 AC 139 ms
55,436 KB
testcase_08 AC 147 ms
56,048 KB
testcase_09 AC 138 ms
55,696 KB
testcase_10 AC 148 ms
55,684 KB
testcase_11 AC 159 ms
56,120 KB
testcase_12 AC 153 ms
56,192 KB
testcase_13 AC 182 ms
56,188 KB
testcase_14 AC 182 ms
56,292 KB
testcase_15 AC 213 ms
57,064 KB
testcase_16 AC 146 ms
55,548 KB
testcase_17 AC 167 ms
58,064 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;


public class Main{
public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    class Enemy{
         int xL;
        int xU;
        int xR;
        int xD;
        int enemyID; 
        public Enemy(int A,int B,int C,int D,int E){
        this.xL=A;
        this.xU=B;
        this.xR=C;
        this.xD=D;
        this.enemyID = E;    
        }
        
    }
     class enemyComparator implements Comparator<Enemy> {
	@Override
	public int compare(Enemy e1, Enemy e2) {
		return e1.xD > e2.xD ? -1 : 1;
	    }
    }
    
    int enemyNum = sc.nextInt();
    int xLB = sc.nextInt();
    int xRB = sc.nextInt();
    boolean[] hit = new boolean[enemyNum];
    List<Enemy> enemyData = new ArrayList<>();
    for(int i=0;i<enemyNum;i++){
    int    xL=sc.nextInt();
    int    xU=sc.nextInt();
    int    xR=sc.nextInt();
    int    xD=sc.nextInt();
    int enemyID = i;
    Enemy e = new Enemy(xL,xU,xR,xD,i);
        enemyData.add(e);
    }
    Collections.sort(enemyData, new enemyComparator());
  for(int i=xLB;i<=xRB;i++){
        for(Enemy e:enemyData){
            if(e.xL<=i&&i<=e.xR){
            hit[e.enemyID]=true;
            break ;
            }
        }
    }
    for(int i=0;i<enemyNum;i++){
        if(hit[i])
        System.out.println(1);
        else
        System.out.println(0);
    }
}    
}
0