結果
問題 | No.827 総神童数 |
ユーザー | sho_00 |
提出日時 | 2020-04-09 11:49:38 |
言語 | Python3 (3.12.2 + numpy 1.26.4 + scipy 1.12.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 468 bytes |
コンパイル時間 | 77 ms |
コンパイル使用メモリ | 10,940 KB |
実行使用メモリ | 8,788 KB |
最終ジャッジ日時 | 2023-09-30 05:09:22 |
合計ジャッジ時間 | 4,827 ms |
ジャッジサーバーID (参考情報) |
judge15 / judge13 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 21 ms
8,764 KB |
testcase_01 | AC | 19 ms
8,772 KB |
testcase_02 | AC | 19 ms
8,668 KB |
testcase_03 | AC | 19 ms
8,784 KB |
testcase_04 | AC | 19 ms
8,648 KB |
testcase_05 | AC | 19 ms
8,788 KB |
testcase_06 | AC | 19 ms
8,668 KB |
testcase_07 | AC | 19 ms
8,712 KB |
testcase_08 | AC | 19 ms
8,712 KB |
testcase_09 | TLE | - |
testcase_10 | -- | - |
testcase_11 | -- | - |
testcase_12 | -- | - |
testcase_13 | -- | - |
testcase_14 | -- | - |
testcase_15 | -- | - |
testcase_16 | -- | - |
testcase_17 | -- | - |
testcase_18 | -- | - |
testcase_19 | -- | - |
testcase_20 | -- | - |
testcase_21 | -- | - |
testcase_22 | -- | - |
testcase_23 | -- | - |
testcase_24 | -- | - |
testcase_25 | -- | - |
testcase_26 | -- | - |
testcase_27 | -- | - |
testcase_28 | -- | - |
testcase_29 | -- | - |
testcase_30 | -- | - |
testcase_31 | -- | - |
testcase_32 | -- | - |
testcase_33 | -- | - |
testcase_34 | -- | - |
testcase_35 | -- | - |
testcase_36 | -- | - |
testcase_37 | -- | - |
testcase_38 | -- | - |
ソースコード
from collections import deque import math n=int(input()) E=[[] for _ in range(n)] for i in range(n-1): a,b=map(int,input().split()) a-=1 b-=1 E[a].append(b) E[b].append(a) depth=[0]*n seen=[0]*n seen[0]=1 stack=deque([0]) while stack: u=stack.pop() for v in E[u]: if seen[v]!=1: seen[v]=1 depth[v]=depth[u]+1 stack.append(v) mod=10**9+7 v=math.factorial(n) ans=0 for i in range(n): ans+=(v//(depth[i]+1)%mod) ans%=mod print(ans)