跳到正文

个人记录

头文件

Subway_hub约 12 分钟
原文
文章信息与版本

文章信息

收录
2025年12月12日
更新
2025年12月28日
篇幅
约 12 分钟
获赞
1

版本

  1. v1当前
C++
#include <bits/extc++.h>
#include <bits/stdc++.h>
using namespace std;
using namespace __gnu_cxx;
using namespace __gnu_pbds;
#define IOS ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
using ll = long long;
using db = double;
using ull = unsigned long long;
#define endl "\n"
#define vec vector
#define int128 __int128
#define gcd __gcd
#define str string
#define unmap unordered_map
#define db double
#define unset unordered_set

struct chash {
    static uint64_t splitmix64(uint64_t x) {
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};

ostream &operator<<(ostream &os, int128 num) {
    if (num == 0) return os << "0";
    str s;
    while (num > 0) {
        s.push_back('0' + num % 10);
        num /= 10;
    }
    reverse(s.begin(), s.end());
    return os << s;
}

#define il inline
#define getchar() (p1==p2&&(p2=(p1=buf)+fread(buf,1,1<<20,stdin),p1==p2)?0:*p1++)
char buf[1 << 20], *p1, *p2;

template<typename T>
il void read(T &x) {
    x = 0;
    int f = 1;
    char ch = getchar();
    while (ch < '0' || ch > '9') {
        if (ch == '-')f = -1;
        ch = getchar();
    }
    while (ch >= '0' && ch <= '9') {
        x = (x << 3) + (x << 1) + (ch ^ 48);
        ch = getchar();
    }
    x *= f;
}

template<typename T>
il void write(T x) {
    if (x < 0) putchar('-'), x = ~x + 1;
    if (x > 9) write(x / 10);
    putchar(x % 10 ^ 48);
}

il char getc() {
    char ch = getchar();
    while (ch == '\n' || ch == '\r' || ch == ' ') ch = getchar();
    return ch;
}

namespace Math {
    template<typename T>
    inline T min(T a, T b) { return a < b ? a : b; }

    template<typename T>
    inline T max(T a, T b) { return a > b ? a : b; }

    template<typename T>
    inline void swap(T a, T b) {
        T x = a;
        a = b, b = x;
    }

    template<typename T>
    inline void GetMin(T &a, T b) { a = b < a ? b : a; }

    template<typename T>
    inline void GetMax(T &a, T b) { a = b > a ? b : a; }

    template<typename T>
    inline T gcd(T a, T b) { return b == 0 ? a : gcd(b, a % b); }

    template<typename T>
    inline T lcm(T a, T b) { return (a * b) / gcd(a, b); }

    template<typename T>
    inline T abs(T x) { return x < 0 ? -x : x; }

#define double long double
#define eps 1e-200
    inline double fabs(double x) { return x + eps <= 0 ? -x : x; }
#undef eps
#undef double
#define eps 1e-80
    inline double fabs(double x) { return x + eps <= 0 ? -x : x; }
#undef eps
    template<typename T>
    inline T pow(T x, T n) {
        T res = 1;
        while (n) {
            if (n & 1) res = res * x;
            n >>= 1;
            x = x * x;
        }
        return res;
    }

    template<typename T>
    inline T pow(T x, T n, const T Mode) {
        T res = 1;
        while (n) {
            if (n & 1) res = (res * x) % Mode;
            n >>= 1;
            x = (x * x) % Mode;
        }
        return res % Mode;
    }

#define double long double

    template<typename T>
    inline double pow(double x, T n) {
        double res = 1.0;
        while (n) {
            if (n & 1) res = res * x;
            n >>= 1;
            x = x * x;
        }
        return res;
    }
#undef double
    template<typename T>
    inline double pow(double x, T n) {
        double res = 1.0;
        while (n) {
            if (n & 1) res = res * x;
            n >>= 1;
            x = x * x;
        }
        return res;
    }

#define int __int128
    inline int min(int a,int b) { return a < b ? a : b; }
    inline int max(int a,int b) { return a > b ? a : b; }

    inline void swap(int a,int b) {
        int x = a;
        a = b, b = x;
    }

    inline void GetMin(int &a,int b) { a = b < a ? b : a; }
    inline void GetMax(int &a,int b) { a = b > a ? b : a; }
    inline int gcd(int a,int b) { return b == 0 ? a : gcd(b, a % b); }
    inline int lcm(int a,int b) { return (a * b) / gcd(a, b); }
    inline int abs(int x) { return x < 0 ? -x : x; }

    inline int pow(int x,int n) {
        int res = 1;
        while (n) {
            if (n & 1) res = res * x;
            n >>= 1;
            x = x * x;
        }
        return res;
    }

    inline int pow(int x,int n, const int Mode) {
        int res = 1;
        while (n) {
            if (n & 1) res = (res * x) % Mode;
            n >>= 1;
            x = (x * x) % Mode;
        }
        return res % Mode;
    }

#define double long double
#define eps 1e-200

    inline double pow(double x,int n) {
        double res = 1.0;
        while (n) {
            if (n & 1) res = res * x;
            n >>= 1;
            x = x * x;
        }
        return res;
    }

    inline double fmin(double a,double b) {
        return a + eps <= b ? a : b;
    }

    inline double fmax(double a,double b) {
        return a - eps >= b ? a : b;
    }
#undef double
#undef eps
#define eps 1e-80

    inline double ceil(double x) {
        int X = x;
        if (fabs((double) X - x) <= eps) return x;
        else return (double) X + 1;
    }

    inline double floor(double x) {
        int X = x;
        return (double) X;
    }

    inline double fmin(double a, double b) {
        return a + eps <= b ? a : b;
    }

    inline double fmax(double a, double b) {
        return a - eps >= b ? a : b;
    }
#undef eps
    inline double pow(double x,int n) {
        double res = 1.0;
        while (n) {
            if (n & 1) res = res * x;
            n >>= 1;
            x = x * x;
        }
        return res;
    }

#define double long double
#define eps 1e-200

    inline double ceil(double x) {
        int X = x;
        if (fabs((double) X - x) <= eps) return x;
        else return (double) X + 1;
    }

    inline double floor(double x) {
        return (ll) x;
    }
#undef double
#undef eps
#undef int
}
#define int ll
signed main(){
    IOS

    return 0;
}
原文