結果
| 問題 |
No.678 2Dシューティングゲームの必殺ビーム
|
| コンテスト | |
| ユーザー |
threecourse
|
| 提出日時 | 2018-05-05 10:27:23 |
| 言語 | C#(csc) (csc 3.9.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 3,157 bytes |
| コンパイル時間 | 1,074 ms |
| コンパイル使用メモリ | 108,672 KB |
| 実行使用メモリ | 19,328 KB |
| 最終ジャッジ日時 | 2024-06-28 01:32:12 |
| 合計ジャッジ時間 | 2,301 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 5 WA * 13 |
コンパイルメッセージ
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 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<Data>, 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();
}
}
}
threecourse