跳到正文

Nygglatho

322620

AFOed

这是 2026年11月4日 存档的第 2 版,不是当前版本。查看当前版本

资料、奖项与版本

资料

编号
322620
抓取

版本

  1. v3当前
  2. v2
  3. v1

3762347022

s 220pts

AFOed.


BEST 定理:

一张有向图欧拉回路数=内向树个数⋅(∏i=1n(di−1)!)\mathsf{一张有向图欧拉回路数}=\mathsf{内向树个数}\cdot(\prod\limits_{i=1}^n (d_i-1)!)

did_i 表示度数。


https://www.luogu.com.cn/paste/3sgvdsg6

IO(mmap):https://www.luogu.com.cn/discuss/970656

  • floof:cleshm, lACiBHSTdirghBDx
  • github:SunkBoat
  • hornex: Slugcat
  • loj:Cleshm
  • uoj:Shiroko_
  • vj:Nygglatho

无论任何代价也在所不惜。No cost too great.\color{#DDDDDD}\mathsf{无论任何代价也在所不惜。}\\\scriptsize\mathrm{No\ cost\ too\ great.} 没有可以思考的心智。No mind to think.\color{#CCCCCC}\mathsf{没有可以思考的心智。}\\\scriptsize\mathrm{No\ mind\ to\ think.} 没有可以屈服的意志。No will to break.\color{#BBBBBB}\mathsf{没有可以屈服的意志。}\\\scriptsize\mathrm{No\ will\ to\ break.} 没有为苦难哭泣的声音。No voice to cry suffering.\color{#AAAAAA}\mathsf{没有为苦难哭泣的声音。}\\\scriptsize\mathrm{No\ voice\ to\ cry\ suffering.} 生于神与虚空之手。Born of God and Void.\color{#999999}\mathsf{生于神与虚空之手。}\\\scriptsize\mathrm{Born\ of\ God\ and\ Void.} 你必封印在他们梦中散布瘟疫的障目之光。You shall seal the blinding light that plagues their dreams.\color{#555555}\mathsf{你必封印在他们梦中散布瘟疫的障目之光。}\\\scriptsize\mathrm{You\ shall\ seal\ the\ blinding\ light\ that\ plagues\ their\ dreams.} 你是容器。You are the Vessel.\color{#444444}\mathsf{你是容器。}\\\scriptsize\mathrm{You\ are\ the\ Vessel.} 你是空洞骑士。You are the Hollow Knight.\color{#222222}\mathsf{你是空洞骑士。}\\\scriptsize\mathrm{You\ are\ the\ Hollow\ Knight.}

缺省:

C++
#include "bits/stdc++.h"
#define IOS ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define ll long long
#define ull unsigned long long

#define OPEN freopen (".in", "r", stdin); freopen (".out", "w", stdout);
#define DATA freopen (".in", "w", stdout);

#define pc __builtin_popcount
#define db double
#define pii pair<int, int>
#define fi first
#define se second

#define F(i,x,y) for (int i = (x); i <= (y); ++i)
#define D(i,x,y) for (int i = (x); i >= (y); --i)

using namespace std;

constexpr ll inf = 1ll * 1e18;
// constexpr ll mod = 998244353ll;
constexpr ll mod = 1ll * 1e9 + 7ll;

namespace FastIO {
    inline void Rd(int& x) {
        int f = 1; x = 0; char c = getchar();
        while (c < '0' || c > '9') {if (c == '-') f = -1; c = getchar();}
        while (c >= '0' && c <= '9') x = (x << 3) + (x << 1) + (c - 48), c = getchar();
        x *= f;
    }
    inline void Wt(int x) {
        if (x < 0) {Wt (-x); return ;}
        if (x < 10) {putchar(x + 48); return;}
        Wt(x / 10);
        putchar((x % 10) + 48);
    }
}
constexpr int N = 2.5e5 + 5;
namespace Maths {
    ll fac[N], ifac[N];
    ll qpow(ll x, ll y) {
        if (y == 0ll) return 1ll;
        ll w = qpow(x, y / 2ll);
        if (y % 2ll) return (w * w % mod) * x % mod;
        else return w * w % mod;
    }
    inline ll div(ll x) {return qpow(x, mod - 2ll);}
    void init() {
        fac[0] = 1ll; F(i, 1, N - 1) fac[i] = fac[i - 1] * i % mod;
        ifac[N - 1] = div (fac[N - 1]);
        
        D (i, N - 2, 0) ifac[i] = ifac[i + 1] * (i + 1) % mod;
    }
    inline ll C(ll x, ll y) {
        if (x < 0 || y < 0 || y > x) return 0LL;
        return (fac[x] * ifac[y] % mod) * ifac[x - y] % mod;
    }
}