結果

問題 No.1749 ラムドスウイルスの感染拡大
ユーザー O2MTO2MT
提出日時 2021-11-21 18:12:09
言語 C#
(.NET 8.0.203)
結果
AC  
実行時間 108 ms / 2,000 ms
コード長 1,432 bytes
コンパイル時間 15,598 ms
コンパイル使用メモリ 145,564 KB
実行使用メモリ 164,596 KB
最終ジャッジ日時 2023-09-05 03:44:02
合計ジャッジ時間 19,580 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 53 ms
30,592 KB
testcase_01 AC 53 ms
28,616 KB
testcase_02 AC 52 ms
28,724 KB
testcase_03 AC 53 ms
28,708 KB
testcase_04 AC 85 ms
29,748 KB
testcase_05 AC 53 ms
28,564 KB
testcase_06 AC 52 ms
29,144 KB
testcase_07 AC 51 ms
28,852 KB
testcase_08 AC 52 ms
30,740 KB
testcase_09 AC 53 ms
28,852 KB
testcase_10 AC 73 ms
44,788 KB
testcase_11 AC 73 ms
44,376 KB
testcase_12 AC 108 ms
46,432 KB
testcase_13 AC 52 ms
28,972 KB
testcase_14 AC 54 ms
29,176 KB
testcase_15 AC 61 ms
29,380 KB
testcase_16 AC 67 ms
29,436 KB
testcase_17 AC 89 ms
33,716 KB
testcase_18 AC 106 ms
42,508 KB
testcase_19 AC 100 ms
39,916 KB
testcase_20 AC 54 ms
29,116 KB
testcase_21 AC 54 ms
29,064 KB
testcase_22 AC 52 ms
28,492 KB
testcase_23 AC 53 ms
30,764 KB
testcase_24 AC 53 ms
28,584 KB
testcase_25 AC 69 ms
41,432 KB
testcase_26 AC 59 ms
32,292 KB
testcase_27 AC 56 ms
30,888 KB
testcase_28 AC 86 ms
29,476 KB
testcase_29 AC 83 ms
164,596 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
  Determining projects to restore...
  Restored /home/judge/data/code/main.csproj (in 129 ms).
.NET 向け Microsoft (R) Build Engine バージョン 17.0.0-preview-21470-01+cb055d28f
Copyright (C) Microsoft Corporation.All rights reserved.

  プレビュー版の .NET を使用しています。https://aka.ms/dotnet-core-preview をご覧ください
  main -> /home/judge/data/code/bin/Release/net6.0/main.dll
  main -> /home/judge/data/code/bin/Release/net6.0/publish/

ソースコード

diff #

using System;
using System.Collections.Generic;
using System.Linq;

namespace Sample
{
    class Program
    {
        static void Main(string[] args)
        {
            var arr = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
            var (N, M, T) = (arr[0], arr[1], arr[2]);
            long MOD = 998244353;
            var list = new List<List<int>>();
            var counts = new long[N];
            
            for (int i = 0; i < N; i++)
            {
                list.Add(new List<int>());
                counts[i] = 0;
            }
            counts[0] = 1;

            for (int i = 0; i < M; i++)
            {
                arr = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
                var (s, t) = (arr[0], arr[1]);
                list[s].Add(t);
                list[t].Add(s);
            }

            for (int i = 1; i <= T; i++)
            {
                var countsSub = new long[N];
                Array.Copy(counts, countsSub, N);
                counts = new long[N];

                for (int j = 0; j < N; j++)
                {
                    counts[j] = 0;
                }

                for (int j = 0; j < N; j++)
                {
                    list[j].ForEach(x => counts[j] = (counts[j] + countsSub[x]) % MOD);
                }
            }
            var ans = counts[0];
            Console.WriteLine(ans);
        }
    } 
}
0