結果
| 問題 |
No.1749 ラムドスウイルスの感染拡大
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-11-21 18:12:09 |
| 言語 | C# (.NET 8.0.404) |
| 結果 |
AC
|
| 実行時間 | 115 ms / 2,000 ms |
| コード長 | 1,432 bytes |
| コンパイル時間 | 18,651 ms |
| コンパイル使用メモリ | 170,544 KB |
| 実行使用メモリ | 188,324 KB |
| 最終ジャッジ日時 | 2024-06-23 00:26:52 |
| 合計ジャッジ時間 | 20,038 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 26 |
コンパイルメッセージ
復元対象のプロジェクトを決定しています... /home/judge/data/code/main.csproj を復元しました (100 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/
ソースコード
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);
}
}
}