結果

問題 No.678 2Dシューティングゲームの必殺ビーム
ユーザー asahi32942398asahi32942398
提出日時 2018-04-28 00:07:18
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 1,375 bytes
コンパイル時間 3,996 ms
コンパイル使用メモリ 74,432 KB
実行使用メモリ 58,208 KB
最終ジャッジ日時 2023-09-10 07:09:41
合計ジャッジ時間 7,897 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
権限があれば一括ダウンロードができます

ソースコード

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());
  outer:  for(int i=xLB;i<=xRB;i++){
        for(Enemy e:enemyData){
            if(xLB<=i&&i<=xRB){
            hit[e.enemyID]=true;
            break outer;
            }
        }
    }
    for(int i=0;i<enemyNum;i++){
        if(hit[i])
        System.out.println(1);
        else
        System.out.println(0);
    }
}    
}
0