結果

問題 No.678 2Dシューティングゲームの必殺ビーム
ユーザー GrenacheGrenache
提出日時 2018-04-27 22:49:51
言語 Java21
(openjdk 21)
結果
AC  
実行時間 187 ms / 2,000 ms
コード長 1,803 bytes
コンパイル時間 3,903 ms
コンパイル使用メモリ 76,888 KB
実行使用メモリ 56,484 KB
最終ジャッジ日時 2023-09-10 06:38:11
合計ジャッジ時間 7,525 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 128 ms
55,796 KB
testcase_01 AC 130 ms
55,804 KB
testcase_02 AC 129 ms
55,804 KB
testcase_03 AC 127 ms
55,748 KB
testcase_04 AC 127 ms
55,496 KB
testcase_05 AC 129 ms
55,516 KB
testcase_06 AC 134 ms
55,460 KB
testcase_07 AC 135 ms
56,000 KB
testcase_08 AC 137 ms
56,436 KB
testcase_09 AC 137 ms
55,784 KB
testcase_10 AC 143 ms
55,628 KB
testcase_11 AC 143 ms
55,892 KB
testcase_12 AC 146 ms
55,940 KB
testcase_13 AC 181 ms
56,184 KB
testcase_14 AC 158 ms
56,220 KB
testcase_15 AC 187 ms
56,484 KB
testcase_16 AC 139 ms
56,300 KB
testcase_17 AC 157 ms
55,964 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.*;
import java.util.*;


public class Main_yukicoder678 {

	private static Scanner sc;
	private static Printer pr;

	private static void solve() {
		int n = sc.nextInt();
		int xlb = sc.nextInt();
		int xrb = sc.nextInt();

		List<Pair> list = new ArrayList<>(n);
		for (int i = 0; i < n; i++) {
			int xl = sc.nextInt();
			int yu = sc.nextInt();
			int xr = sc.nextInt();
			int yd = sc.nextInt();

			list.add(new Pair(Math.max(0, xl), Math.max(0, yu), Math.min(1280, xr), Math.min(1680, yd), i));
		}
		Collections.sort(list);

		int[] ans = new int[n];
		boolean[] w = new boolean[1280 + 1];
		Arrays.fill(w, true);
		for (int i = xlb; i <= xrb; i++) {
			w[i] = false;
		}
		for (int i = list.size() - 1; i >= 0; i--) {
			Pair e = list.get(i);

			boolean flag = false;
			for (int x = e.a; x <= e.c; x++) {
				if (!w[x]) {
					flag = true;
				}
				w[x] = true;
			}

			if (flag) {
				ans[e.n] = 1;
			} else {
				ans[e.n] = 0;
			}
		}

		for (int e : ans) {
			pr.println(e);
		}
	}

	static class Pair implements Comparable<Pair> {
		int a;
		int b;
		int c;
		int d;
		int n;

		Pair(int a, int b, int c, int d, int n) {
			this.a = a;
			this.b = b;
			this.c = c;
			this.d = d;
			this.n = n;
		}

		@Override
		public int compareTo(Pair o) {
			if (d == o.d) {
				return Integer.compare(c, o.c);
			}

			return Integer.compare(d, o.d);
		}
	}
	// ---------------------------------------------------
	public static void main(String[] args) {
		sc = new Scanner(INPUT == null ? System.in : new ByteArrayInputStream(INPUT.getBytes()));
		pr = new Printer(System.out);

		solve();

//		pr.close();
		pr.flush();
//		sc.close();
	}

	static String INPUT = null;

	private static class Printer extends PrintWriter {
		Printer(OutputStream out) {
			super(out);
		}
	}
}
0