using System; using System.Collections.Generic; using System.Linq; using System.Web; namespace Competitive { internal class Solution { public int N, XLB, XRB; public int[] XL, YU, XR, YD; public bool[] H; public bool[] USED; public Data[] D; public void Run() { { var line = Input.ReadIntArray(); N = line[0]; XLB = line[1]; XRB = line[2]; } XL = new int[N]; YU = new int[N]; XR = new int[N]; YD = new int[N]; H = new bool[N]; for (int i = 0; i < N; i++) { var line = Input.ReadIntArray(); XL[i] = line[0]; YU[i] = line[1]; XR[i] = line[2]; YD[i] = line[3]; } D = new Data[N]; for (int i = 0; i < N; i++) { D[i] = new Data {XL = XL[i], YU = YU[i], XR = XR[i], YD = YD[i]}; } Array.Sort(D); int W = 1280; USED = new bool[W + 1]; for (int i = 0; i < N; i++) { var d = D[i]; var hit = false; int cs = Math.Max(d.XL, 0); int cl = Math.Min(d.XR, W); for (int c = cs; c <= cl; c++) { if (!USED[c]) { hit = true; USED[c] = true; } } if (hit) H[i] = true; } for (int i = 0; i < N; i++) { Console.WriteLine(H[i] ? 1 : 0); } } } // libs ---------- class Data : IComparable, IComparable { public int XL, YU, XR, YD; public int CompareTo(Data other) { // 下が最初、左が最初 int result = (-YD).CompareTo(-other.YD); if (result == 0) result = XL.CompareTo(other.XL); return result; } public int CompareTo(object obj) { if (obj == null) return 1; if (GetType() != obj.GetType()) throw new ArgumentException(); return CompareTo((Data)obj); } } // common ---------- internal static class Input { public static int ReadInt() { string line = Console.ReadLine(); return int.Parse(line); } public static int[] ReadIntArray() { string line = Console.ReadLine(); return line.Split(' ').Select(int.Parse).ToArray(); } public static double[] ReadDoubleArray() { string line = Console.ReadLine(); return line.Split(' ').Select(double.Parse).ToArray(); } } internal class Program { public static void Main(string[] args) { var s = new Solution(); s.Run(); } } }