結果
| 問題 | No.678 2Dシューティングゲームの必殺ビーム | 
| コンテスト | |
| ユーザー |  threecourse | 
| 提出日時 | 2018-05-05 10:42:47 | 
| 言語 | C#(csc) (csc 3.9.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 33 ms / 2,000 ms | 
| コード長 | 3,119 bytes | 
| コンパイル時間 | 939 ms | 
| コンパイル使用メモリ | 109,568 KB | 
| 実行使用メモリ | 19,072 KB | 
| 最終ジャッジ日時 | 2024-06-28 01:32:23 | 
| 合計ジャッジ時間 | 2,169 ms | 
| ジャッジサーバーID (参考情報) | judge1 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 18 | 
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace Competitive
{
    internal class Solution
    {
        public int N, XLB, XRB;
        public bool[] USED;
        public Data[] D;
        public void Run()
        {
            int W = 1280;
            USED = new bool[W + 1];
            {
                var line = Input.ReadIntArray();
                N = line[0];
                XLB = line[1];
                XRB = line[2];
            }
            D = new Data[N];
            for (int i = 0; i < N; i++)
            {
                var line = Input.ReadIntArray();
                int XL = line[0];
                int YU = line[1];
                int XR= line[2];
                int YD = line[3];
                D[i] = new Data { NO = i, XL = XL, YU = YU, XR = XR, YD = YD, HIT=false };
            }
            // 下から順に並べ替える
            Array.Sort(D);
            // 下から順に判定
            for (int ii = 0; ii < N; ii++)
            {
                var d = D[ii];
                var hit = false;
                int cs = Math.Max(d.XL, XLB);
                int cl = Math.Min(d.XR, XRB);
                for (int c = cs; c <= cl; c++)
                {
                    if (!USED[c])
                    {
                        hit = true;
                        USED[c] = true;
                    }
                }
                if (hit) d.HIT = true;
            }
            // 元の順序に戻す
            Array.Sort(D, (d1, d2) => d1.NO.CompareTo(d2.NO));
            for (int i = 0; i < N; i++)
            {
                Console.WriteLine(D[i].HIT ? 1 : 0);
            }
        }
    }
    // libs ----------
    class Data : IComparable<Data>, IComparable
    {
        public int NO, XL, YU, XR, YD;
        public bool HIT;
        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();
        }
    }
}
            
            
            
        