【莫比乌斯反演】牛客练习赛40E-小D的lemon

本题细节极多。WA题自闭两开花

传送门

解题方法打字太难了。手写算了。

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn = 250025;
ll p = 1e9 + 7;
ll primes[maxn], mu[maxn], g[maxn], f[maxn], invg[maxn], inv[maxn], s[maxn], cnt;
bool st[maxn];
ll ksm(ll n, ll m)
{
    ll res = 1;
    while(m)
    {
        if(m & 1LL) res = (res * n) % p;
        n = (n * n) % p;
        m >>= 1LL;
    }
    return res;
}
void get_primes(int n)
{
    mu[1] = 1; f[1] = 1; invg[1] 
Read the rest