結果

問題 No.678 2Dシューティングゲームの必殺ビーム
ユーザー k_6101k_6101
提出日時 2019-12-13 00:11:19
言語 Java21
(openjdk 21)
結果
AC  
実行時間 180 ms / 2,000 ms
コード長 2,495 bytes
コンパイル時間 2,529 ms
コンパイル使用メモリ 81,924 KB
実行使用メモリ 56,164 KB
最終ジャッジ日時 2023-09-08 07:03:37
合計ジャッジ時間 6,406 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 127 ms
55,900 KB
testcase_01 AC 124 ms
55,644 KB
testcase_02 AC 123 ms
55,644 KB
testcase_03 AC 125 ms
55,792 KB
testcase_04 AC 122 ms
55,876 KB
testcase_05 AC 129 ms
56,064 KB
testcase_06 AC 127 ms
55,588 KB
testcase_07 AC 128 ms
55,888 KB
testcase_08 AC 131 ms
55,992 KB
testcase_09 AC 132 ms
55,968 KB
testcase_10 AC 135 ms
55,548 KB
testcase_11 AC 132 ms
55,644 KB
testcase_12 AC 134 ms
55,964 KB
testcase_13 AC 145 ms
55,792 KB
testcase_14 AC 147 ms
56,132 KB
testcase_15 AC 180 ms
56,164 KB
testcase_16 AC 131 ms
55,916 KB
testcase_17 AC 149 ms
56,072 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.InputStream;
import java.io.PrintWriter;
import java.lang.reflect.Array;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.PriorityQueue;
import java.util.Scanner;
import java.util.Set;
import java.util.Stack;
import java.util.TreeMap;
import java.util.TreeSet;

import static java.util.Comparator.*;

public class Main {
    public static void main(String[] args) {
        PrintWriter out = new PrintWriter(System.out);
        Solver solver = new Solver(System.in, out);
        solver.solve();
        out.close();
    }
}
class Solver {
	Scanner sc;
	PrintWriter out;
    public Solver(InputStream in, PrintWriter out) {
    	sc = new Scanner(in);
    	this.out = out;
    }
    // ==================================================================
    Map<Integer, List<PP>> map = new TreeMap<>(Collections.reverseOrder());
    public void solve() {
    	int N = Integer.parseInt(sc.next());
    	int LB = Integer.parseInt(sc.next());
    	if(LB != 0)		LB -= 1;
    	int RB = Integer.parseInt(sc.next()) - 1;
    	int xl, yu, xr, yd;
    	List<PP> list;
    	for (int i = 0; i < N; i++) {
			xl = Integer.parseInt(sc.next()) - 1;
			yu = Integer.parseInt(sc.next()) - 1;
			xr = Integer.parseInt(sc.next()) - 1;
			yd = Integer.parseInt(sc.next()) - 1;
			list = map.get(yd);
			if(list == null) {
				list = new ArrayList<>();
				map.put(yd, list);
			}
			list.add(new PP(i, xl, xr));
		}
    	int[] BBB = new int[2000];
    	for (int i = LB; i <= RB; i++)	BBB[i] = 1;
    	boolean f;
    	int[] ans = new int[N];
    	for (int key : map.keySet()) {
    		list = map.get(key);
    		for(PP pp : list) {
	    		xl = pp.xl;
	    		xr = pp.xr;
	    		f = false;
//	    		out.println("チェック  yd = " + key + "  xl = " + xl + "  xr = " + xr);
				for (int i = xl; i <= xr; i++) {
					if(i < 0 || i >= 1280)	continue;
//					out.println("  BBB[" + i + "] = " + BBB[i]);
					if(BBB[i] == 1)	f = true;
					BBB[i] = 0;
				}
//				out.println("結果	no = " + pp.no + " f = " + f);
				if(f)	ans[pp.no] = 1;
    		}
		}
    	for (int i = 0; i < N; i++)	out.println(ans[i]);
    }
    // Set に入れるなら PPKEY を使う!
    class PP{
    	public int no, xl, xr;
    	public PP(int no, int xl, int xr) {
    		this.no = no;
    		this.xl = xl;
    		this.xr = xr;
    	}
    }
}

0