QOJ.ac

QOJ

Limite de temps : 2.0 s Limite de mémoire : 512 MB Points totaux : 100 Hackable ✓

#14427. ضغط المجال

Statistiques

لدى Gojo شجرة تحتوي على $n$ من الرؤوس. لقد تعلّم تقنية ضغط المجال، والتي تعمل على النحو التالي:

  • أولاً، يختار رأساً ما $v$ لم يُحذف سابقاً من البيان. بعد ذلك، لكل زوج من الرؤوس $u < w$ المتصلة بـ $v$، يضيف ضلعاً غير موجّه $(u, w)$ إذا لم يكن موجوداً مسبقاً في البيان. وبعد ذلك، يمسح الرأس $v$ من البيان مع جميع الأضلاع المتصلة به.

لكل $k$ ($1 \le k \le n$)، يهتم بمعرفة العدد الإجمالي للأضلاع في البيانات المتبقية عبر جميع الطرق البالغ عددها $\frac{n!}{(n-k)!}$ لتنفيذ العمليات. وبما أن الإجابات قد تكون كبيرة جداً، اطبعها بباقي القسمة على $998\,244\,353$.

الإدخال

يحتوي السطر الأول على عدد صحيح $n$ ($2 \le n \le 10^5$) — عدد الرؤوس في الشجرة.

تحتوي الأسطر الـ $n - 1$ التالية على أزواج من الأعداد الصحيحة $u_i, v_i$ ($1 \le u_i, v_i \le n$) — وصف أضلاع الشجرة.

الإخراج

اطبع $n$ من الأعداد الصحيحة — العدد الإجمالي للأضلاع لكل $k$ بباقي القسمة على $998\,244\,353$.

أمثلة

الإدخال 1

5
1 2
2 3
3 5
3 4

الإخراج 1

16 44 60 0 0

الإدخال 2

8
1 2
2 3
2 4
4 5
4 7
7 8
6 7

الإخراج 2

51 316 1596 6120 15720 20160 0 0

Editorials

IDTypeStatusTitlePosted ByLast UpdatedActions
#365EditorialOpen题解jianglyView

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.