摘要: By ProtectEMmm;2024-10-15。 编译相关 不要包含头文件 <Windows.h>。 struct 最后没加分号。 set,map,priority_queue 套结构体但是没有重载小于号。 int mian()。 使用了一个没声明的变量。 括号没匹配。 结构体不要用默认初始化, 阅读全文
posted @ 2025-07-17 12:55 ProtectEMmm 阅读(61) 评论(0) 推荐(1)
摘要: 二分杂谈 注:本文内容需要读者已经掌握二分和三分的原理。 整数二分绪论 整数二分,本质上是在一个 00...0011...11 序列中寻找最右的 0 或者最左的 1 的下标。根据不同题目我们有不同的目标。 值得注意的是,我们并不能保证序列中一定存在 0 或者是 1。所以往往需要判无解的情况。 我们固 阅读全文
posted @ 2025-04-24 16:57 ProtectEMmm 阅读(584) 评论(0) 推荐(2)
摘要: 字符串 Trie 01Trie template<int BIT = 31> class C_Trie { private: int root, cnt; vector<int>siz; vector<vector<int>>trie; public: void Init(int sigma_n) 阅读全文
posted @ 2025-02-19 22:32 ProtectEMmm 阅读(81) 评论(0) 推荐(0)
摘要: 图论 存储 class C_Graph { public: struct Edge { int u, v, w; Edge(int _u = 0, int _v = 0, int _w = 0) { u = _u, v = _v, w = _w; } friend bool operator<(co 阅读全文
posted @ 2025-02-19 22:32 ProtectEMmm 阅读(94) 评论(0) 推荐(1)
摘要: 数学 逆元 离线法 class C_INV { private: int Pow(int a, lnt b, int P) { int res = 1; while (b) { if (b & 1) { res = (1ll * res * a) % P; } b >>= 1, a = (1ll * 阅读全文
posted @ 2025-02-19 22:32 ProtectEMmm 阅读(93) 评论(0) 推荐(0)
摘要: 数据类型 大数类 struct Bigint { int sign; string digits; /* */ Bigint(void) {} Bigint(string b) { (*this) = b; } Bigint(int b) { (*this) = to_string(b); } /* 阅读全文
posted @ 2025-02-19 22:32 ProtectEMmm 阅读(60) 评论(0) 推荐(0)
摘要: 树论 LCT class C_LinkCutTree { public: int rev[N], fa[N], ch[N][2]; /* */ bool Which(int x) { return ch[fa[x]][1] == x; } bool IsRoot(int x) { return ch 阅读全文
posted @ 2025-02-19 22:32 ProtectEMmm 阅读(44) 评论(0) 推荐(0)
摘要: 读写 __int128 ostream& operator<<(ostream& output, __int128 integer) { if (integer < 0) { output << '-'; integer *= -1; } string str; do { str.push_back 阅读全文
posted @ 2025-02-19 22:32 ProtectEMmm 阅读(30) 评论(0) 推荐(0)
摘要: 数据结构 莫队 int n, m; /* */ int S; struct Query { int l, r, idx; Query(int _l = 0, int _r = 0, int _idx = 0) { l = _l, r = _r, idx = _idx; } friend bool o 阅读全文
posted @ 2025-02-19 22:32 ProtectEMmm 阅读(65) 评论(0) 推荐(0)
摘要: 编译 #include<bits/stdc++.h> using namespace std; /* */ #define endl '\n' /* */ using lnt = long long; /* */ void Solve(void) { } /* */ int main() { #if 阅读全文
posted @ 2025-02-19 22:32 ProtectEMmm 阅读(45) 评论(0) 推荐(0)