实际上大多都是从别人代码里偷来的
#include <bits/stdc++.h>
using namespace std;
typedef double lf;
typedef long long ll;
typedef long double llf;
typedef vector<int> vint;
typedef unsigned int uint;
typedef pair<int, int> pii;
typedef unsigned long long ull;
#define xx first
#define yy second
#define pb push_back
#define mp make_pair
#define mid ((l+r)>>1)
#define all(x) x.begin(), x.end()
#if __cplusplus <= 201103L
#define lop0(i,b) for (register int i = 0, i##end = (b); i < i##end; ++i)
#define lop1(i,b) for (register int i = 1, i##end = (b); i <= i##end; ++i)
#define dlop(i,a,b) for (register int i = (a), i##end = (b); i >= i##end; --i)
#define lop(i,a,b) for (register int i = (a), i##end = (b); i <= i##end; ++i)
#define dlop0(i,b) for (register int i = (b)-1; i >= 0; --i)
#define dlop1(i,b) for (register int i = (b); i >= 1; --i)
#else
#define lop0(i,b) for (int i = 0, i##end = (b); i < i##end; ++i)
#define lop1(i,b) for (int i = 1, i##end = (b); i <= i##end; ++i)
#define dlop(i,a,b) for (int i = (a), i##end = (b); i >= i##end; --i)
#define lop(i,a,b) for (int i = (a), i##end = (b); i <= i##end; ++i)
#define dlop0(i,b) for (int i = (b)-1; i >= 0; --i)
#define dlop1(i,b) for (int i = (b); i >= 1; --i)
#endif
#if __cplusplus >= 201103L
mt19937 Rand(19260817);
#define mt make_tuple
#else
uint Rand() {
static int s = 0;
if (!s) srand(19260817), s = 1;
return rand();
}
#endif
#define trav(it, a) for (__typeof((a).end())it = (a).begin(); it != (a).end(); ++it)
#define dtrav(it, a) for (__typeof((a).rend())it = (a).rbegin(); it != (a).rend(); ++it)
#define trav1(it, a) for (__typeof((a).end())it = (a).begin(), it##1; it != (a).end(); it = it1)
#define dtrav1(it, a) for (__typeof((a).rend())it = (a).rbegin(), it##1; it != (a).rend(); it = it1)
const int mod = 998244353, MAXN = 1e5 + 7, inft = 1e9 + 7;
const ll infl = llf(1e18) + 1;
const lf eps = 1e-7;
template<typename T> inline T sqr(T x) {
return x * x;
}
template<typename A, typename B> inline A _gcd(A a, B b) {
A t;
if (a < b) swap(a, b);
if (!b) return a;
while (t = a % b) a = b, b = t;
return b;
}
template<typename A, typename B> inline ll _lcm(A a, B b) {
return a / gcd(a, b) * 1ll * b;
}
template<typename T> inline T abs(T x) {
return x >= 0 ? x : -x;
}
template<typename A, typename B> inline ll mul(A a, B b, ll mod) {
if (b < 0) b = -b, a = -a;
ll ret;
for (ret = 0; b; b >>= 1) {
if (b & 1) ret = (ret + a) % mod;
a = (a + a) % mod;
}
return ret % mod;
}
template<typename A, typename B> inline A Pow1(A a, B b, int mod) {
A ret;
for (ret = 1; b; b >>= 1) {
if (b & 1) ret = ret * 1ll * a % mod;
a = a * 1ll * a % mod;
}
return ret % mod;
}
template<typename A, typename B> inline ll Pow(A a, B b, ll mod) {
assert(b >= 0);
a %= mod;
if (mod <= 2e9) return Pow1(a, b, mod);
ll ret;
for (ret = 1; b; b >>= 1) {
if (b & 1) ret = mul(ret, a, mod);
a = mul(a, a, mod);
}
return ret % mod;
}
template<typename A, typename B> inline A max(A a, B b) {
return a > b ? a : b;
}
template<typename A, typename B> inline A min(A a, B b) {
return a < b ? a : b;
}
template<typename A, typename B> inline void chmax(A &x, B y) {
if (x < y) x = y;
}
template<typename A, typename B> inline void chmin(A &x, B y) {
if (x > y) x = y;
}
template<typename A, typename B> inline void amod(A &x, B y, int mod) {
x += y;
while (x < 0) x += mod;
while (x > mod) x -= mod;
}
template<typename A> inline void Mod(A &x, int mod) {
while (x < 0) x += mod;
while (x > mod) x -= mod;
}
int main() {
#ifdef QvvQ
fprintf(stderr, "\ntime:%.5fms", clock() * 1.0 / CLOCKS_PER_SEC * 1000);
#endif
return 0;
}
原文地址:https://www.cnblogs.com/storz/p/10198970.html
时间: 2024-10-22 12:32:39