結果
問題 |
No.1817 Reversed Edges
|
ユーザー |
|
提出日時 | 2022-01-24 16:25:27 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 383 bytes |
コンパイル時間 | 627 ms |
コンパイル使用メモリ | 12,544 KB |
実行使用メモリ | 27,904 KB |
最終ジャッジ日時 | 2024-12-14 13:34:41 |
合計ジャッジ時間 | 11,304 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 3 WA * 19 RE * 1 |
ソースコード
from sys import setrecursionlimit setrecursionlimit(10**4) n=int(input()) g=[[] for _ in range(n+1)] ans=[0]*(n+1) for _ in range(n-1): a,b=map(int,input().split()) if a>b: a,b=b,a g[a].append(b) ans[b]+=1 def dfs(now,pre): for to in g[now]: if to!=pre: ans[to]+=ans[now] dfs(to,now) dfs(1,0) for i in ans[1:]: print(i)