神奇的 CE
查看原帖
神奇的 CE
182533
Akwamaryna楼主2022/6/25 12:53

R77870130

神 tm 编译错误,半句提示都没有

// Per aspera ad astra.
// 1004535809
#include <cctype>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#define re register
#define br break
#define co continue
#define ll long long
#define DEBUG if (dbg)
/*#ifndef ABC
#define getchar() (_S == _T && (_T = (_S = _B) + fread(_B, 1, 1 << 15, stdin), _S == _T) ? EOF : *_S++)
#endif*/
//char _B[1 << 15], *_S = _B, *_T = _B;
ll fr() {
    re ll s = 0, f = 1;
    re char ch;
    for (; (ch = getchar()) < '0' || ch > '9'; ch == '-' ? f = -f : 0);
    for (; ch >= '0' && ch <= '9'; s = s * 10 + ch - '0', ch = getchar());
    return s * f;
}
int dbg = 0;
#include <map>
#include <cmath>
#include <vector>
#include <queue>
#define double long double
//#define int long long
#define ull unsigned long long
using namespace std;
const int P = 167772161, N = 2.4e6, G = 3, iG = 55924054;
template <class T> T cmin(re T a, re T b) {return a < b ? a : b;}
template <class T> T cmax(re T a, re T b) {return a > b ? a : b;}
template <class T> void cswp(re T &a, re T &b) {T t = a;a = b, b = t;}
template <class T> T cabs(re T a) {return a > 0 ? a : -a;}
struct OI {
    int rp, score;
} NOIWC2022, FJOI2022;
int Fac[N + 5] = {1}, iFac[N + 5] = {1}, Inv[N + 5] = {0, 1}, x[N + 5], A[N + 5], B[N + 5];
inline int Add(re int x, re int y) {return x + y < P ? x + y : x + y - P;}
inline int Sub(re int x, re int y) {return x - y < 0 ? x - y + P : x - y;}
inline int Mul(re int x, re int y) {re ull c = 1llu * x * y; return c < P ? c : c % P;}
inline int Qpow(re int x, re int k, re int res = 1) {
    while (k) {
        if (k & 1) res = Mul(res, x);
        x = Mul(x, x); k >>= 1;
    }
    return res;
}
inline void NTT(re int *A, re int lim, re int typ) {
    for (re int i = 0; i < lim; ++i) if (i < x[i]) cswp(A[i], A[x[i]]);
    for (re int md = 1; md < lim; md <<= 1) {
        re ll wn = Qpow(typ == 1 ? G : iG, (P - 1) / (md << 1));
        for (re int j = 0; j < lim; j += (md << 1)) {
            re ll ret = 1;
            for (re int k = 0; k < md; ++k) {
                re ll p = A[j + k], q = A[j + k + md] * ret % P;
                A[j + k] = Add(p, q);
                A[j + k + md] = Sub(p, q);
                ret = ret * wn % P;
            }
        }
    }
}
signed main() {
#ifndef ONLINE_JUDGE
    dbg = 1;
#endif
    //++NOIWC2022.rp, ++NOIWC2022.score, ++FJOI2022.rp, ++FJOI2022.score, 1004535809;
    //freopen(".in", "r", stdin);
    //freopen(".out", "w", stdout);
    re int n = fr();
    for (re int i = 1; i <= n; ++i) Fac[i] = Mul(Fac[i - 1], i);
    for (re int i = 2; i <= n; ++i) Inv[i] = Mul(P - P / i, Inv[P % i]);
    for (re int i = 1; i <= n; ++i) iFac[i] = Mul(iFac[i - 1], Inv[i]);
    for (re int i = 0; i <= n; ++i) {
        A[i] = (i & 1) ? P - iFac[i] : iFac[i];
        B[i] = Mul(Qpow(i, n), iFac[i]);
    }
    re int Lim = 1, cnt = 0;
    while (Lim <= (n << 1)) Lim <<= 1, ++cnt;
    for (re int i = 0; i < Lim; ++i) x[i] = (x[i >> 1] >> 1) | ((i & 1) << (cnt - 1));
    NTT(A, Lim, 1); NTT(B, Lim, 1);
    for (re int i = 0; i < Lim; ++i) A[i] = Mul(A[i], B[i]);
    NTT(A, Lim, -1);
    re int _inv = Qpow(Lim, P - 2);
    for (re int i = 0; i <= n; ++i) printf("%d%c", Mul(A[i], _inv), " \n"[i == n]);
    //system("pause");
    return 392699 ^ 392699;
}
2022/6/25 12:53
加载中...