随笔分类 - 数据结构——线段树
摘要:题目链接:https://www.luogu.org/problem/P1884 题目大意:给你n个矩阵,让你求矩阵面积的并 解题报告:线段树扫描线裸题,需要用到左闭右开的性质。 AC代码: 将多组输入改为单组 1 #include<bits/stdc++.h> 2 #define numm ch-
阅读全文
摘要:题目链接:https://ac.nowcoder.com/acm/contest/881/I 题目大意: 给出n个点,每个点有a,b两个属性,让你从左下角到右上角划一条线,线的左边每个点的贡献是$a_{i}$,线的右边每个点的贡献是$b_{i}$,使得两部分的总和最大。即$max(\sum_{i\e
阅读全文
摘要:题目链接:https://ac.nowcoder.com/acm/contest/884/B 题目大意: 有n个集合,每个集合有若干元素,一个集合i能表示x,当且仅当存在一个集合i的子集合,这里面的元素异或值为x。 有m个询问:每个为x,l,r,如果任意一个集合i (i在[l,r])都能表示x,输出
阅读全文
摘要:题目链接:https://ac.nowcoder.com/acm/contest/882/E 题目大意&解题报告: 参考这篇博客,讲的很详细。 AC代码: 1 #include<bits/stdc++.h> 2 #define numm ch-48 3 #define pd putchar(' ')
阅读全文
摘要:题目链接:https://ac.nowcoder.com/acm/contest/884/C 题解:枚举a序列中每个点,以当前的点作为最小值,用单调栈找出当前点到左边能达到的第一个比它小的点,找出当前点到右边能达到的第一个比它小的点,然后建立前缀和的线段树。最后,遍历a中n个点,当a[i]小于0时,
阅读全文
摘要:时间限制:C/C++ 2秒,其他语言4秒空间限制:C/C++ 524288K,其他语言1048576K64bit IO Format: %lld 链接:https://ac.nowcoder.com/acm/contest/881/A来源:牛客网 题目描述 Two arrays u and v ea
阅读全文
摘要:线段树模板 1 #include<cstdio> 2 #include<cstring> 3 #include<iostream> 4 #include<algorithm> 5 #include<cmath> 6 #include<queue> 7 #define pn putchar('\n')
阅读全文

浙公网安备 33010602011771号