Welcome
这里是 Linmobi 的博客,qwq。
这是我代码的缺省源捏:
#include<bits/stdc++.h>
// #define int long long
typedef long long ll;
typedef unsigned long long ull;
typedef std::pair<int, int> pii;
#define rep(i, a, b) for(int i = (a);i <= (b);i++)
#define pre(i, a, b) for(int i = (a);i >= (b);i--)
#define rp(i, a) for(int i = 1; i <= (a); i++)
#define pr(i, a) for(int i = (a); i >= 1; i--)
#define go(i, x) for(auto i : x)
#define lowbit(x) (x & (-x))
#define mp make_pair
#define pb push_back
#define gc getchar
#define fir first
#define sec second
using namespace std;
const int P = 1e9 + 7, L = 2e5 + 5, inf = 2e9 + 5;
inline ll qpow(ll a, ll b) { ll ans = 1, q = a; while(b) { if(b & 1) { ans *= q; ans %= P; } q *= q; q %= P; b >>= 1; } return ans; }
inline ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }
inline ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }
namespace fast_IO {
template<typename T> inline void rd(T &x) {
x = 0; bool f = 0; char ch = getchar();
while (! isdigit(ch)) f |= (ch == '-'), ch = getchar();
while (isdigit(ch)) x = (x << 3) + (x << 1) + ch - '0', ch = getchar();
x = (f ? - x : x);
}
template<typename T, typename... Args> inline void rd(T &first, Args& ... args) {
rd(first);
rd(args...);
}
template<typename T> inline void write(T x, bool f) {
if (x < 0) x = -x, putchar('-'); static short Stack[50], top(0);
do Stack[++ top] = x % 10, x /= 10; while (x);
while (top) putchar(Stack[top --] | 48);
(f ? putchar('\n') : putchar(' '));
}
} using namespace fast_IO;
namespace fenwick {
int t[L];
void add(int w, int num) {
while(w < L) t[w] += num, w += lowbit(w);
}
int query(int w) {
int sum = 0;
while(w) sum += t[w], w -= lowbit(w);
return sum;
}
}
namespace segment_tree {
#define mid (l + r >> 1)
#define lson l, mid, L, R, w << 1
#define rson mid + 1, r, L, R, w << 1 | 1
struct node {
int num, w, lz;
} tr[L << 2];
void pushup(int w) {
tr[w].num = max(tr[w << 1 | 1].num, tr[w << 1].num);
tr[w].num += tr[w].lz;
}
void pushdown(int w) {
tr[w << 1].num += tr[w].lz;
tr[w << 1 | 1].num += tr[w].lz;
tr[w << 1].lz += tr[w].lz;
tr[w << 1 | 1].lz += tr[w].lz;
tr[w].lz = 0;
}
int query(int l, int r, int L, int R, int w) {
if(L <= l && r <= R) return tr[w].num;
pushdown(w);
if(R <= mid) return query(lson);
if(L > mid) return query(rson);
return max(query(lson), query(rson));
}
void modify(int l, int r, int L, int R, int w, int num) {
if(L <= l && r <= R) return void(tr[w].lz += num), void(tr[w].num += num); pushdown(w);
if(R <= mid) return void(), modify(lson, num), pushup(w);
if(L > mid) return void(), modify(rson, num), pushup(w);
modify(lson, num), modify(rson, num), pushup(w);
}
void build(int l, int r, int w) {
if(l != r) {
build(l, mid, w << 1);
build(mid + 1, r, w << 1 | 1); pushup(w);
} else {
tr[w].num = -inf;
tr[w].lz = 0;
tr[w].w = 1;
}
}
}
/***************************************************************************************************************************/
/* */
/***************************************************************************************************************************/
signed main() {
return 0;
}
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 分享4款.NET开源、免费、实用的商城系统
· 全程不用写代码,我用AI程序员写了一个飞机大战
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了
· 记一次.NET内存居高不下排查解决与启示