贴一个鄙人用的cpp算法比赛模版

#include<bits/stdc++.h>

using namespace std;

#define fastIO() ios::sync_with_stdio(false),cin.tie(nullptr),cout.tie(nullptr)
#define YES() cout << "YES\n"
#define Yes() cout << "Yes\n"
#define NO() cout << "NO\n"
#define No() cout << "No\n"
#define _ 0
#define endl '\n'
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define pb push_back
#define pf push_front
#define lb lower_bound
#define ub upper_bound
#define range(it) begin(it), end(it)
#define sz(it) it.size()
#define PI acos(-1.0)

typedef long long ll;
typedef pair<ll,ll> PII;
const ll N=2e5+7;
const ll mod = 1e9+7;
const ll inf = 0x3f3f3f3f;


ll gcd(ll a ,ll b){ return b == 0 ? a : gcd(b ,a % b); }
ll lcm(ll a ,ll b){ return a * b / gcd(a ,b); }

inline ll read(){
    char ch;ll x=0;bool f=true;
    for(ch=getchar();!isdigit(ch);ch=getchar())if(ch=='-')f^=f;
    for(;isdigit(ch);ch=getchar())x=(x<<3)+(x<<1)+ch-48;
    return f?x:-x;
}

template<typename T>
T chmax(T &a, T b) { return a > b ? a : (a = b); }

template<typename T>
T chmin(T &a, T b) { return a < b ? a : (a = b); }

template <int T>
struct ModInt {
    const static int MD = T;
    int x;
    ModInt(ll x = 0)
        : x(x % MD) {}
    int get() { return x; }
    ModInt operator+(const ModInt& that) const {
        int x0 = x + that.x;
        return ModInt(x0 < MD ? x0 : x0 - MD);
    }
    ModInt operator-(const ModInt& that) const {
        int x0 = x - that.x;
        return ModInt(x0 < MD ? x0 + MD : x0);
    }
    ModInt operator*(const ModInt& that) const {
        return ModInt((long long)x * that.x % MD);
    }
    ModInt operator/(const ModInt& that) const {
        return *this * that.inverse();
    }
    void operator+=(const ModInt& that) {
        x += that.x;
        if (x >= MD)
            x -= MD;
    }
    void operator-=(const ModInt& that) {
        x -= that.x;
        if (x < 0)
            x += MD;
    }
    void operator*=(const ModInt& that) { x = (long long)x * that.x % MD; }
    void operator/=(const ModInt& that) { *this = *this / that; }
    ModInt inverse() const {
        int a = x, b = MD, u = 1, v = 0;
        while (b) {
            int t = a / b;
            a -= t * b;
            std::swap(a, b);
            u -= t * v;
            std::swap(u, v);
        }
        if (u < 0)
            u += MD;
        return u;
    }
    friend ostream& operator<<(ostream& os, ModInt x) {
        os << x.get();
        return os;
    }
};
typedef ModInt<mod> Mint;


vector<ll> tmp;
void mergesort(vector<ll>& nums,ll l,ll r){
    if(l>=r) return;
    ll mid = (l + r) >> 1;
    mergesort(nums,l,mid);
    mergesort(nums,mid+1,r);

    ll i = l , j = mid + 1 , cnt = 0;
    while(i<=mid && j<=r){
        if(nums[i]<=nums[j]) tmp[cnt++] = nums[i++];
        else tmp[cnt++] = nums[j++];
    }
    while(i<=mid) tmp[cnt++] = nums[i++];
    while(j<=r) tmp[cnt++] = nums[j++];

    for(ll k = 0 ; k < r - l + 1 ; k++) nums[k + l] = tmp[k];
}

ostream_iterator<int> out_iter(cout, " ");

void solve(int case_num){

}


int main() {
    fastIO();
    int T = 1;
    cin >> T;
    for(int i = 1 ; i <= T ; i++) solve(i);

    return ~~(0 ^ _ ^ 0);
}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值