摘要:
题目描述 思路 1. 0 和 1 开方之后不会改变,对 0, 1 节点打上标记 2. 如果孩子节点都打上标记了,说明这些孩子节点的和不会改变,那么父节点也打上标记 3. 对于打上标记的点,change 的时候直接 return 代码 c++ include include int n, m; lon 阅读全文
摘要:
"题目描述" 思路 代码 c++ include include long long n, m; struct { long long at[1000005], arr[1000005 1; this build(k build(k add(k, l, r, v); return; } int mi 阅读全文
摘要:
"题目描述" 思路 代码 c++ include include int n, m; struct { int at[1000005]; long long int arr[1000005 1; this build(k build(k r || y 1; this change(k change( 阅读全文
摘要:
"题目描述" 思路 1. 询问的是区间[L, R],完美序列的开始下标 = L 2. 二分查找序列中满足开始下标大于L的第一个位置x 3. ST算法求解[x, R]的最大长度 y 4. x L 和 y 的最大值为结果 代码 c++ include define max(a,b) ((a) (b) ? 阅读全文
摘要:
"题目描述" 思路 代码 c++ include include // include //using namespace std; define max(a, b) ((a) (b) ? (a) : (b)) define min(a, b) ((a) (b) ? (b) : (a)) int n 阅读全文
摘要:
"题目描述" 思路 RMQ 问题 ST算法 代码 c+++ include include define max(a, b) ((a) (b) ? (a) : (b)) int n, m; int arr[100005]; int f[100005][21], log[100005]; inline 阅读全文