某岛

… : "…アッカリ~ン . .. . " .. .
May 11, 2023

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

#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]);
}