#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);
}
贴一个鄙人用的cpp算法比赛模版
最新推荐文章于 2024-06-17 21:54:57 发布