惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Microsoft Azure Blog
Microsoft Azure Blog
Engineering at Meta
Engineering at Meta
A
About on SuperTechFans
T
The Blog of Author Tim Ferriss
I
InfoQ
博客园_首页
G
Google Developers Blog
爱范儿
爱范儿
Last Week in AI
Last Week in AI
量子位
阮一峰的网络日志
阮一峰的网络日志
雷峰网
雷峰网
酷 壳 – CoolShell
酷 壳 – CoolShell
Vercel News
Vercel News
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
GbyAI
GbyAI
月光博客
月光博客
The GitHub Blog
The GitHub Blog
V
Visual Studio Blog
N
Netflix TechBlog - Medium
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
博客园 - 司徒正美
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
博客园 - 聂微东

某岛

AtCoder Beginner Contest 409 Luogu P5325. 【模板】Min_25 筛 UOJ #188. 【UR #13】Sanrd AtCoder Beginner Contest 371 AtCoder Beginner Contest 369 RPGMaker 2k3 百科 OneShot 的考古 2024“开创拓芯”游戏创享节的相关记录 CJ 回来后的戒断反应 Luogu P10221. [省选联考 2024] 重塑时光 Luogu P5308 [COCI2018-2019#4] Akvizna wqs 二分 歌唱王国 Lean 相关 BZOJ 3153. Sone1 The 2023 ICPC World Finals Luxor 新巴别塔 Sora 的想象与思考 Facebook Hacker Cup 2023 Round 1 AtCoder Beginner Contest 322 LLaMA 2 相关 HuggingFace AI Game Jam ACL 2023 Trans 相关… Luogu P2053. [SCOI2007] 修车 Luogu P1973. [NOI2011] NOI 嘉年华 Luogu P1933. [NOI2010] 旅行路线 Luogu P1954. [NOI2010] 航空管制 Luogu P2048. [NOI2010] 超级钢琴 Luogu P2046. [NOI2010] 海拔
无标号连通图
2023-05-24 · via 某岛

May 24, 2023

无标号连通图

没找到相关的题目0.0.

#include <lastweapon/poly>
#include <lastweapon/number>

using namespace lastweapon;

const int N = int(1e2) + 9;
VVI Partition; VI cur;
int n, m;

void gen(int n, int s = 1){
    if (!n){
        Partition.PB(cur);
    }
    else if (n >= s){
        cur.PB(s); gen(n-s, s); cur.pop_back();
        gen(n, s+1);
    }
}

Mint c(const VI P, int n){
    Mint z = fac[n]; int c = 0, l = P.front();
    ECH(it, P){
        z /= *it; if (*it != l){
            z *= invFac[c]; l = *it;
            c = 1;
        }
        else{
            ++c;
        }
    }

    z *= invFac[c];
    return z;
}
int g(const VI P){
    int z = 0; REP(i, SZ(P)){
        z += P[i] / 2; REP(j, i) z += __gcd(P[i], P[j]);
    }
    return z;
}

const int PMAX = int(1e2) + 9;
VI P; bitset<PMAX> isP; int mu[PMAX];
void sieve(){
    mu[1] = 1; FOR(i, 2, PMAX){
        if (!isP[i]) P.PB(i), mu[i] = -1;
        for (int j=0;j<SZ(P)&&i*P[j]<PMAX;++j){
            isP[i*P[j]]=1; if (!(i%P[j])){
                mu[i*P[j]] = 0;
                break;
            } else{
                mu[i*P[j]] = -mu[i];
            }
        }
    }
}

int main(){

#ifndef ONLINE_JUDGE
    //freopen("in.txt", "r", stdin);
    //freopen("out.txt", "w", stdout);
#endif

    sieve();

    m = 2; n = 21;

    Poly a(n), b(21);

    FOR(i, 1, n) {
        Partition.clear(); gen(i);
        Mint z = 0; ECH(it, Partition) {
            z += c(*it, i) * pow(Mint(m), g(*it));
        }
        z *= invFac[i];
        b[i] = z;
    }

    Poly c(n);

    FOR(i, 1, n) {
        c[i] = i * b[i];
        REP_1(j, i-1) c[i] -= c[j] * b[i-j];
    }

    FOR(i, 1, n) {
        REP_1(d, i) if (i % d == 0) {
            a[i] += mu[i/d] * c[d];
        }
        a[i] /= i;
    }

    FOR(i, 1, n) {
        cout << a[i] << " ";
    }
    cout << endl;
}

Posted by xiaodao
Category: 日常