
数据结构
十一号路口。
博客仅用于本人记录学习笔记!
展开
-
POJ 1442 Black Box ----- 优先队列
题目链接https://codeforces.com/problemset/problem/1328/E题意:给定一颗树和一系列点的编号,要求找一条从根到叶节点的路径,使得给定的那些节点要么在路径上,要么距离路径1.题解:https://www.cnblogs.com/suxxsfe/p/12585217.html树中每个节点,与它相邻节点只能是父亲或者儿子节点,路径为1 的话,...原创 2020-05-07 18:01:50 · 166 阅读 · 0 评论 -
一篇文章搞懂扫描线算法(线段树) HDU1542
怨念这个专题其实不难,但是翻了一圈网上的博客,写得是云里雾里,我打算用一篇博客把它讲明白前序知识能看懂这篇文章需要:线段树基础知识。线段树染色问题基本概念。离散化操作目标首先这个扫描线算法解决的是什么问题?主要解决的是ACM中的矩形面积问题矩形周长问题多边形面积问题这篇博客主讲的问题是:求矩形面积并 HDU 1542题目分析这道题最主要就是让我们求解矩形面积并...转载 2020-02-25 16:20:14 · 256 阅读 · 0 评论 -
(转)POJ 3468 A Simple Problem with Integers --- 树状数组延迟标记
题意:有一个数组,有两种操作。1: Q a b 求[a,b]的和 2:C a b c 给[a,b] 的所有元素都加上c。题目:You haveNintegers,A1,A2, ... ,AN. You need to deal with two kinds of operations. One type of operation is to add some given numb...转载 2020-02-20 11:34:06 · 209 阅读 · 0 评论 -
(转)UVALive 4726 Average --- 单调队列+数形结合
思路参考浅谈数形结合在信息学竞赛中的应用题意:有个n长度的01序列,要求选出长度最短为l的子序列使这个子序列的平均值最大,输出开始位置和结束位置。题解:平均值是1的个数除长度,那么可以看做平面上已知个n点,求横向距离大于等于l的任意两点连线的最大斜率,所以用单调队列来解决,让队列中所含值保持单调,否则出队,并保证队首最优。#include <stdio.h>con...原创 2019-08-13 17:18:49 · 131 阅读 · 0 评论 -
计蒜客-重获自由 树状数组+离散化
原题链接https://www.jisuanke.com/course/1797/165800题解:这是一道比较经典的树状数组的题。有道题是求区间均值大于k的区间数,和这道题思路差不多,我也是看来这道题的题解才搞懂这题怎么做的,具体参考https://blog.youkuaiyun.com/scutzyz126/article/details/78040539这道题就是求区间[...原创 2019-03-01 23:03:21 · 199 阅读 · 0 评论 -
HDOJ4252A Famous City --- 单调栈
题目链接 http://acm.hdu.edu.cn/showproblem.php?pid=4252Problem DescriptionAfter Mr. B arrived in Warsaw, he was shocked by the skyscrapers and took several photos. But now when he looks at these photo...原创 2018-11-14 13:40:58 · 512 阅读 · 1 评论 -
HDOJ3047 Zjnu Stadium --- 带权并查集
题目链接 http://acm.hdu.edu.cn/showproblem.php?pid=3047Problem DescriptionIn 12th Zhejiang College Students Games 2007, there was a new stadium built in Zhejiang Normal University. It was a modern sta...原创 2018-10-26 21:01:52 · 283 阅读 · 0 评论 -
HDOJ2665 Kth number --- 划分树求区间第k小数
题目链接 http://acm.hdu.edu.cn/showproblem.php?pid=2665Problem DescriptionGive you a sequence and ask you the kth big number of a inteval.InputThe first line is the number of the test cases. For ...原创 2018-10-23 18:40:55 · 221 阅读 · 0 评论 -
HDOJ3333 Turing Tree ---- 树状数组离线查询
题目链接 http://acm.hdu.edu.cn/showproblem.php?pid=3333Problem DescriptionAfter inventing Turing Tree, 3xian always felt boring when solving problems about intervals, because Turing Tree could easily ...原创 2018-10-28 19:56:40 · 185 阅读 · 0 评论 -
POJ2236 Wireless Network-并查集
题目链接 http://poj.org/problem?id=2236#include<cstdio>using namespace std;int n,m;int pre[50005];void Init(){ for(int i = 0;i < n;i++) pre[i] = i;}int Find(int x){ //找到祖先 int t ...原创 2018-06-03 11:34:16 · 114 阅读 · 0 评论