結果

問題 No.678 2Dシューティングゲームの必殺ビーム
ユーザー Daigo HIROOKADaigo HIROOKA
提出日時 2018-06-10 02:41:07
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 1,112 bytes
コンパイル時間 3,617 ms
コンパイル使用メモリ 74,836 KB
実行使用メモリ 56,756 KB
最終ジャッジ日時 2023-09-13 02:31:22
合計ジャッジ時間 8,128 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 125 ms
55,496 KB
testcase_01 AC 124 ms
55,520 KB
testcase_02 AC 127 ms
55,952 KB
testcase_03 AC 125 ms
56,036 KB
testcase_04 WA -
testcase_05 AC 136 ms
55,980 KB
testcase_06 AC 137 ms
55,848 KB
testcase_07 AC 142 ms
55,880 KB
testcase_08 AC 145 ms
55,856 KB
testcase_09 WA -
testcase_10 AC 177 ms
56,268 KB
testcase_11 AC 151 ms
55,756 KB
testcase_12 AC 152 ms
56,192 KB
testcase_13 WA -
testcase_14 AC 190 ms
56,424 KB
testcase_15 WA -
testcase_16 AC 143 ms
53,724 KB
testcase_17 AC 181 ms
56,468 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class No678{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);

		int N = sc.nextInt();
		int xLB = sc.nextInt();
		int xRB = sc.nextInt();
		int[] beam = new int[1281];
		Arrays.fill(beam, xLB, xRB+1, 1);
		
		int[][] positions = new int[N][4];
		for(int n = 0; n < N; n++){
			for(int i = 0; i < 4; i++){
				positions[n][i] = sc.nextInt();
			}
		}
		int[] is_hit = new int[N];
		Arrays.fill(is_hit, 0);
		
		for(int h = 1680; h > 0; h--){
			for(int n = 0; n < N; n++){
				if(is_hit[n] == 1) continue;
				if(h < positions[n][3] && is_beam(beam, positions[n][0], positions[n][2])){
					is_hit[n] = 1;
					Arrays.fill(beam,
								Math.max(positions[n][0], 0),
								Math.min(positions[n][2]+1, 1281),
								0);
					// System.out.println("enemy " + n + " hit");
				}
			}
		}
		for(int n = 0; n < N; n++){
			System.out.println(is_hit[n]);
		}
	}
	private static boolean is_beam(int[] beam, int l, int r){
		l = Math.max(0, l);
		r = Math.min(r, 1281);
		for(int x = l; x < r; x++){
			if(beam[x] == 1) return true;
		}
		return false;
	}
}
0