結果

問題 No.678 2Dシューティングゲームの必殺ビーム
ユーザー GrenacheGrenache
提出日時 2018-04-27 22:48:12
言語 Java21
(openjdk 21)
結果
RE  
実行時間 -
コード長 1,771 bytes
コンパイル時間 3,907 ms
コンパイル使用メモリ 78,976 KB
実行使用メモリ 57,956 KB
最終ジャッジ日時 2023-09-10 06:37:14
合計ジャッジ時間 7,613 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 132 ms
55,788 KB
testcase_01 AC 130 ms
55,784 KB
testcase_02 AC 129 ms
55,928 KB
testcase_03 AC 129 ms
55,828 KB
testcase_04 RE -
testcase_05 RE -
testcase_06 RE -
testcase_07 RE -
testcase_08 AC 141 ms
55,928 KB
testcase_09 RE -
testcase_10 RE -
testcase_11 AC 145 ms
56,072 KB
testcase_12 AC 147 ms
57,904 KB
testcase_13 AC 158 ms
56,060 KB
testcase_14 AC 160 ms
56,792 KB
testcase_15 AC 192 ms
56,488 KB
testcase_16 AC 138 ms
56,216 KB
testcase_17 RE -
権限があれば一括ダウンロードができます

ソースコード

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), xr, 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