結果

問題 No.2910 単体ホモロジー入門
ユーザー kakel-sankakel-san
提出日時 2024-10-04 21:47:22
言語 C#
(.NET 8.0.203)
結果
AC  
実行時間 58 ms / 2,000 ms
コード長 2,041 bytes
コンパイル時間 9,357 ms
コンパイル使用メモリ 169,568 KB
実行使用メモリ 187,516 KB
最終ジャッジ日時 2024-10-04 21:47:36
合計ジャッジ時間 10,286 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 52 ms
30,692 KB
testcase_01 AC 51 ms
30,720 KB
testcase_02 AC 54 ms
30,464 KB
testcase_03 AC 56 ms
30,592 KB
testcase_04 AC 54 ms
30,592 KB
testcase_05 AC 55 ms
30,592 KB
testcase_06 AC 56 ms
30,592 KB
testcase_07 AC 55 ms
30,464 KB
testcase_08 AC 56 ms
30,720 KB
testcase_09 AC 54 ms
30,720 KB
testcase_10 AC 56 ms
30,592 KB
testcase_11 AC 51 ms
30,464 KB
testcase_12 AC 58 ms
30,720 KB
testcase_13 AC 51 ms
30,592 KB
testcase_14 AC 53 ms
30,592 KB
testcase_15 AC 52 ms
30,592 KB
testcase_16 AC 51 ms
30,592 KB
testcase_17 AC 49 ms
30,592 KB
testcase_18 AC 50 ms
30,592 KB
testcase_19 AC 51 ms
30,568 KB
testcase_20 AC 50 ms
30,848 KB
testcase_21 AC 52 ms
30,592 KB
testcase_22 AC 51 ms
30,464 KB
testcase_23 AC 51 ms
30,592 KB
testcase_24 AC 52 ms
30,592 KB
testcase_25 AC 52 ms
30,720 KB
testcase_26 AC 52 ms
30,592 KB
testcase_27 AC 52 ms
30,592 KB
testcase_28 AC 51 ms
30,848 KB
testcase_29 AC 52 ms
30,720 KB
testcase_30 AC 52 ms
30,592 KB
testcase_31 AC 53 ms
30,720 KB
testcase_32 AC 55 ms
30,464 KB
testcase_33 AC 55 ms
30,848 KB
testcase_34 AC 57 ms
30,720 KB
testcase_35 AC 54 ms
30,592 KB
testcase_36 AC 54 ms
30,592 KB
testcase_37 AC 56 ms
30,720 KB
testcase_38 AC 55 ms
30,720 KB
testcase_39 AC 56 ms
30,592 KB
testcase_40 AC 52 ms
30,592 KB
testcase_41 AC 51 ms
30,720 KB
testcase_42 AC 50 ms
30,700 KB
testcase_43 AC 50 ms
30,592 KB
testcase_44 AC 51 ms
30,720 KB
testcase_45 AC 51 ms
30,592 KB
testcase_46 AC 53 ms
187,516 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
  復元対象のプロジェクトを決定しています...
  /home/judge/data/code/main.csproj を復元しました (85 ms)。
MSBuild のバージョン 17.9.6+a4ecab324 (.NET)
  main -> /home/judge/data/code/bin/Release/net8.0/main.dll
  main -> /home/judge/data/code/bin/Release/net8.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();
    public static void Main()
    {
        Solve();
    }
    static void Solve()
    {
        var c = NList;
        var (n, m) = (c[0], c[1]);
        var map = NArr(m);
        var v = NList.Distinct().ToList();
        v.Sort();
        var tree = new HashSet<int>[n];
        for (var i = 0; i < n; ++i) tree[i] = new HashSet<int>();
        foreach (var edge in map)
        {
            tree[edge[0]].Add(edge[1]);
            tree[edge[1]].Add(edge[0]);
        }
        for (var i = 0; i < n; ++i) for (var j = 0; j < n; ++j)
        {
            if (i == j) continue;
            for (var k = 0; k < n; ++k)
            {
                if (k == i || k == j) continue;
                if (tree[i].Contains(j) && tree[j].Contains(k) && tree[k].Contains(i))
                {
                    var list = new List<int>{ i, j, k };
                    list.Sort();
                    if (!Equals(v, list))
                    {
                        WriteLine("Yes");
                        return;
                    }
                }
                if (n == 4)
                {
                    var l = i ^ j ^ k;
                    if (tree[i].Contains(j) && tree[j].Contains(k) && tree[k].Contains(l) && tree[l].Contains(i))
                    {
                        WriteLine("Yes");
                        return;
                    }
                }
            }
        }
        WriteLine("No");
    }
    static bool Equals(List<int> a, List<int> b)
    {
        if (a.Count != b.Count) return false;
        for (var i = 0; i < a.Count; ++i) if (a[i] != b[i]) return false;
        return true;
    }
}
0