摘要: using namespace std; #define int long long using ll = long long; template<typename T = long long> struct RectUnion { struct Event { T x, y1, y2; int m 阅读全文
posted @ 2026-04-10 16:45 majikko 阅读(6) 评论(0) 推荐(0)
摘要: 学习于https://atcoder.jp/contests/abc449/tasks/abc449_e 用于优化最后的查询 using namespace std; // 主席树模板(可持久化权值线段树) // 功能:区间第k小 / 第k大 / 区间小于x的数的个数 / // 时间:建树 O(n 阅读全文
posted @ 2026-04-09 20:43 majikko 阅读(14) 评论(0) 推荐(0)
摘要: #include <bits/stdc++.h> using namespace std; typedef long long ll; const int MOD = 998244353; struct Node { int l, r; // 区间左右端点 ll sum; // 区间和 ll laz 阅读全文
posted @ 2026-04-07 17:20 majikko 阅读(11) 评论(0) 推荐(0)
摘要: #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<ll, int> pli; // {距离, 节点} const ll INF = 1e18; // 邻接表: graph[u] = {{v 阅读全文
posted @ 2026-03-04 15:04 majikko 阅读(24) 评论(0) 推荐(0)
摘要: #include<bits/stdc++.h> using namespace std; typedef long long ll; const int MOD=1e9+7; struct mat{ll a[2][2];}; ll n; mat mat_mul(mat x,mat y)//矩阵乘法 阅读全文
posted @ 2025-08-14 11:28 majikko 阅读(15) 评论(0) 推荐(0)
摘要: #include <iostream> #include <vector> using namespace std; const int N = 1e5 + 10; int n, q; vector<int> tree[N]; vector<pair<int, int>> queries[N]; / 阅读全文
posted @ 2025-08-13 15:42 majikko 阅读(17) 评论(0) 推荐(0)
摘要: #include<bits/stdc++.h> using namespace std; const int N = 10005; int n,m; vector e (N,vector<int>()); vector ne (N,vector<int>()); vector<int>dfn(N) 阅读全文
posted @ 2025-08-10 09:02 majikko 阅读(23) 评论(0) 推荐(0)
摘要: 模板来自https://www.cnblogs.com/pangyou3s/p/18148655#04a 懒标记线段树lazysegmenttree-基础区间修改 注释来自KIMI2 #include <bits/stdc++.h> using namespace std; using i64 = 阅读全文
posted @ 2025-08-09 13:31 majikko 阅读(27) 评论(0) 推荐(0)
摘要: 题面来自牛客:https://ac.nowcoder.com/acm/problem/23482” #include<bits/stdc++.h> using namespace std; const int N = 5e5+10; int n,m,s,a,b; vector<int> e[N]; 阅读全文
posted @ 2025-07-26 18:15 majikko 阅读(10) 评论(0) 推荐(0)
摘要: 题面:https://codeforces.com/problemset/problem/2072/F 求某个数的组合数次幂的异或 由于异或性质,只跟组合数的奇偶有关。 前置知识 杨辉三角形的第i行第j个元素为\(C_i^j\) 卢卡斯定理 (Lucas' Theorem) 对于素数 \(p\) 和 阅读全文
posted @ 2025-07-19 14:48 majikko 阅读(63) 评论(0) 推荐(0)