結果

問題 No.92 逃走経路
ユーザー 👑 kakel-sankakel-san
提出日時 2023-10-21 23:53:32
言語 C#
(.NET 8.0.203)
結果
AC  
実行時間 94 ms / 5,000 ms
コード長 1,151 bytes
コンパイル時間 8,334 ms
コンパイル使用メモリ 157,492 KB
実行使用メモリ 178,840 KB
最終ジャッジ日時 2023-10-21 23:53:46
合計ジャッジ時間 12,134 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 90 ms
33,844 KB
testcase_01 AC 83 ms
32,788 KB
testcase_02 AC 85 ms
32,788 KB
testcase_03 AC 84 ms
32,788 KB
testcase_04 AC 84 ms
32,788 KB
testcase_05 AC 91 ms
33,624 KB
testcase_06 AC 89 ms
33,660 KB
testcase_07 AC 88 ms
33,660 KB
testcase_08 AC 86 ms
33,120 KB
testcase_09 AC 88 ms
33,504 KB
testcase_10 AC 94 ms
33,688 KB
testcase_11 AC 91 ms
33,680 KB
testcase_12 AC 94 ms
33,752 KB
testcase_13 AC 88 ms
33,540 KB
testcase_14 AC 89 ms
33,568 KB
testcase_15 AC 88 ms
33,612 KB
testcase_16 AC 90 ms
33,684 KB
testcase_17 AC 92 ms
33,816 KB
testcase_18 AC 91 ms
33,760 KB
testcase_19 AC 90 ms
178,840 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
  復元対象のプロジェクトを決定しています...
  /home/judge/data/code/main.csproj を復元しました (105 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();
    public static void Main()
    {
        Solve();
    }
    static void Solve()
    {
        var c = NList;
        var (n, m, k) = (c[0], c[1], c[2]);
        var map = NArr(m);
        var d = NList;
        var ex = Enumerable.Repeat(true, n).ToArray();
        for (var i = 0; i < k; ++i)
        {
            var nex = new bool[n];
            foreach (var road in map)
            {
                if (road[2] != d[i]) continue;
                nex[road[1] - 1] |= ex[road[0] - 1];
                nex[road[0] - 1] |= ex[road[1] - 1];
            }
            ex = nex;
        }
        var ans = new List<int>();
        for (var i = 0; i < n; ++i) if (ex[i]) ans.Add(i + 1);
        WriteLine(ans.Count);
        if (ans.Count > 0) WriteLine(string.Join(" ", ans));
    }
}
0