結果

問題 No.678 2Dシューティングゲームの必殺ビーム
ユーザー Daigo HIROOKADaigo HIROOKA
提出日時 2018-06-10 02:46:23
言語 Java21
(openjdk 21)
結果
AC  
実行時間 213 ms / 2,000 ms
コード長 1,114 bytes
コンパイル時間 4,537 ms
コンパイル使用メモリ 74,688 KB
実行使用メモリ 57,012 KB
最終ジャッジ日時 2023-09-13 02:31:12
合計ジャッジ時間 7,603 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 125 ms
56,060 KB
testcase_01 AC 125 ms
55,532 KB
testcase_02 AC 125 ms
55,816 KB
testcase_03 AC 124 ms
55,740 KB
testcase_04 AC 125 ms
56,164 KB
testcase_05 AC 135 ms
55,864 KB
testcase_06 AC 134 ms
56,388 KB
testcase_07 AC 141 ms
56,428 KB
testcase_08 AC 145 ms
56,112 KB
testcase_09 AC 141 ms
56,404 KB
testcase_10 AC 153 ms
53,724 KB
testcase_11 AC 153 ms
55,900 KB
testcase_12 AC 150 ms
56,388 KB
testcase_13 AC 187 ms
56,868 KB
testcase_14 AC 198 ms
56,736 KB
testcase_15 AC 213 ms
57,012 KB
testcase_16 AC 141 ms
56,184 KB
testcase_17 AC 200 ms
56,208 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+1, 1281);
		for(int x = l; x < r; x++){
			if(beam[x] == 1) return true;
		}
		return false;
	}
}
0