結果

問題 No.2564 衝突予測
ユーザー 👑 kakel-sankakel-san
提出日時 2023-12-02 15:10:56
言語 C#
(.NET 8.0.203)
結果
WA  
実行時間 -
コード長 2,934 bytes
コンパイル時間 9,076 ms
コンパイル使用メモリ 158,456 KB
実行使用メモリ 207,228 KB
最終ジャッジ日時 2023-12-02 15:11:09
合計ジャッジ時間 12,629 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
32,548 KB
testcase_01 AC 71 ms
32,548 KB
testcase_02 AC 71 ms
32,548 KB
testcase_03 AC 198 ms
59,684 KB
testcase_04 AC 181 ms
59,684 KB
testcase_05 AC 178 ms
59,684 KB
testcase_06 AC 185 ms
59,684 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
  復元対象のプロジェクトを決定しています...
  /home/judge/data/code/main.csproj を復元しました (96 ms)。
MSBuild のバージョン 17.7.3+8ec440e68 (.NET)
  main -> /home/judge/data/code/bin/Release/net7.0/main.dll
  main -> /home/judge/data/code/bin/Release/net7.0/publish/

ソースコード

diff #

using System;
using static System.Console;
using System.Linq;
using System.Collections.Generic;

class Program
{
    static int NN => int.Parse(ReadLine());
    static int[] NList => ReadLine().Split().Select(int.Parse).ToArray();
    static int[][] NArr(long n) => Enumerable.Repeat(0, (int)n).Select(_ => NList).ToArray();
    static int[] NMi => ReadLine().Split().Select(c => int.Parse(c) - 1).ToArray();
    static int[][] NMap(int n) => Enumerable.Repeat(0, n).Select(_ => NMi).ToArray();
    public static void Main()
    {
        Solve();
    }
    static void Solve()
    {
        var t = NN;
        var ans = new bool[t];
        for (var u = 0; u < t; ++u)
        {
            var c1 = ReadLine().Split();
            var c2 = ReadLine().Split();
            var x1 = int.Parse(c1[0]);
            var y1 = int.Parse(c1[1]);
            var x2 = int.Parse(c2[0]);
            var y2 = int.Parse(c2[1]);
            ans[u] =
                (c1[2] == "U" && c2[2] == "D" && x1 == x2 && y1 < y2) ||
                (c1[2] == "D" && c2[2] == "U" && x1 == x2 && y1 > y2) ||
                (c1[2] == "L" && c2[2] == "R" && x1 > x2 && y1 == y2) ||
                (c1[2] == "R" && c2[2] == "L" && x1 < x2 && y1 == y2) ||
                (c1[2] == "U" && c2[2] == "L" && x1 < x2 && x2 - x1 == y2 - y1) ||
                (c1[2] == "U" && c2[2] == "R" && x1 > x2 && x1 - x2 == y2 - y1) ||
                (c1[2] == "D" && c2[2] == "L" && x1 < x2 && x2 - x1 == y1 - y2) ||
                (c1[2] == "D" && c2[2] == "R" && x1 > x2 && x1 - x2 == y1 - y2) ||
                (c1[2] == "L" && c2[2] == "U" && x1 > x2 && x1 - x2 == y1 - y2) ||
                (c1[2] == "L" && c2[2] == "D" && x1 > x2 && x1 - x2 == y2 - y1) ||
                (c1[2] == "R" && c2[2] == "U" && x1 < x2 && x2 - x1 == y1 - y2) ||
                (c1[2] == "R" && c2[2] == "D" && x1 > x2 && x1 - x2 == y2 - y1);
        }
        WriteLine(string.Join("\n", ans.Select(f => f ? "Yes" : "No")));
    }
    class UnionFindTree
    {
        int[] roots;
        public UnionFindTree(int size)
        {
            roots = new int[size];
            for (var i = 0; i < size; ++i) roots[i] = -1;
        }
        public int GetRoot(int a)
        {
            if (roots[a] < 0) return a;
            return roots[a] = GetRoot(roots[a]);
        }
        public bool IsSameTree(int a, int b)
        {
            return GetRoot(a) == GetRoot(b);
        }
        public bool Unite(int a, int b)
        {
            var x = GetRoot(a);
            var y = GetRoot(b);
            if (x == y) return false;
            if (-roots[x] < -roots[y]) { var tmp = x; x = y; y = tmp; }
            roots[x] += roots[y];
            roots[y] = x;
            return true;
        }
        public int GetSize(int a)
        {
            return -roots[GetRoot(a)];
        }
    }
}
0