結果
問題 | No.1749 ラムドスウイルスの感染拡大 |
ユーザー | Theta |
提出日時 | 2022-10-26 18:37:52 |
言語 | Python3 (3.12.2 + numpy 1.26.4 + scipy 1.12.0) |
結果 |
AC
|
実行時間 | 644 ms / 2,000 ms |
コード長 | 1,164 bytes |
コンパイル時間 | 1,102 ms |
コンパイル使用メモリ | 10,948 KB |
実行使用メモリ | 9,764 KB |
最終ジャッジ日時 | 2023-09-17 11:28:08 |
合計ジャッジ時間 | 6,152 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge12 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 16 ms
7,812 KB |
testcase_01 | AC | 17 ms
7,816 KB |
testcase_02 | AC | 16 ms
7,896 KB |
testcase_03 | AC | 16 ms
7,796 KB |
testcase_04 | AC | 295 ms
8,448 KB |
testcase_05 | AC | 16 ms
7,876 KB |
testcase_06 | AC | 17 ms
7,792 KB |
testcase_07 | AC | 18 ms
7,824 KB |
testcase_08 | AC | 17 ms
8,464 KB |
testcase_09 | AC | 17 ms
8,448 KB |
testcase_10 | AC | 445 ms
8,444 KB |
testcase_11 | AC | 445 ms
8,292 KB |
testcase_12 | AC | 644 ms
9,764 KB |
testcase_13 | AC | 19 ms
7,900 KB |
testcase_14 | AC | 26 ms
8,248 KB |
testcase_15 | AC | 57 ms
8,180 KB |
testcase_16 | AC | 96 ms
8,248 KB |
testcase_17 | AC | 317 ms
8,572 KB |
testcase_18 | AC | 583 ms
8,992 KB |
testcase_19 | AC | 393 ms
8,416 KB |
testcase_20 | AC | 33 ms
8,248 KB |
testcase_21 | AC | 33 ms
7,864 KB |
testcase_22 | AC | 16 ms
7,832 KB |
testcase_23 | AC | 19 ms
7,896 KB |
testcase_24 | AC | 17 ms
7,864 KB |
testcase_25 | AC | 315 ms
8,376 KB |
testcase_26 | AC | 120 ms
8,424 KB |
testcase_27 | AC | 70 ms
8,184 KB |
testcase_28 | AC | 294 ms
8,608 KB |
testcase_29 | AC | 267 ms
8,512 KB |
ソースコード
class Town: def __init__(self, init: int): self.current = 0 self.before = init self.neighbors = [] def connect(self, other): self.neighbors.append(other) def next_career(self): self.current = sum(neighbor.before for neighbor in self.neighbors) def daily(self): self.before = self.current self.current = 0 class Network: def __init__(self, num: int): self.towns = [Town(0) for _ in range(num)] self.towns[0].before = 1 self.day = 0 def update(self): for town in self.towns: town.next_career() for town in self.towns: town.daily() self.day += 1 def connect(self, num1: int, num2: int): self.towns[num1].connect(self.towns[num2]) self.towns[num2].connect(self.towns[num1]) def main(): N, M, T = map(int, input().split()) network = Network(N) for _ in range(M): s, t = map(int, input().split()) network.connect(s, t) while network.day < T: network.update() print(network.towns[0].before % 998244353) if __name__ == "__main__": main()