BZOJ 3625. [Codeforces Round #250]小朋友和二叉树

https://darkbzoj.cc/problem/36…


·

#include <lastweapon/io>
#include <lastweapon/poly>
using namespace lastweapon;
const int N = int(5e3) + 9;

int main() {
#ifndef ONLINE_JUDGE
    freopen("in.txt", "r", stdin);
#endif

    int cn, n; RD(cn, n); ++n;
    Poly A(n); DO(cn) {
        int c; if (RD(c) < n) A[c] += 1;
    }

    Poly C = (Poly{1} + (Poly{1}-4*A).sqrt(n)).inv(n) * 2;
    FOR(i, 1, n) printf("%d\n", C[i]);
}

Discussion

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

这个站点使用 Akismet 来减少垃圾评论。了解你的评论数据如何被处理。