摘要: 区间修改,单点查询的问题(非线段树) + 因为线段树忘了具体的操作方式,所以不知道这个题线段树为啥不行,该补补线段树了 + 因为区间太大了,所以不能暴力直接对数组进行标记。 解决方案 采用设置两个容器(分别记为head,tail)的方法,分别存储一段区间的开头、结尾 + 假设head中有一个数i,则 阅读全文
posted @ 2020-04-26 22:33 Daybreaking 阅读(124) 评论(0) 推荐(0) 编辑
摘要: 2019 08 20 08:50:53 上午 + dfn[] 数组代表的是时间戳,即结点访问的时间次序。不是结点所在的深度。 + 以其他的点作跳板,达到所能达到的时间戳最小的结点。这是没有意义的,因为只要把中间的任意一个结点删去,这条“桥”就相当于断了。 应当看该结点只走一步所能达到的时间戳最小的结 阅读全文
posted @ 2020-04-26 22:28 Daybreaking 阅读(154) 评论(0) 推荐(0) 编辑
摘要: 用到的算法 割边 + 缩点(得到边连通分量) + 朴素LCA 算法解析 + 无向图区分重边与同一条边的反方向: 对每一条边都用一个变量id来标识,一条无向边的两个方向用同一个id表示。 + 割边: ,即以点v为根的子树不能到达点u及以上,所以边uv为一条割边。 + 缩点(得到边双连通分量): 去掉桥 阅读全文
posted @ 2020-04-26 13:15 Daybreaking 阅读(197) 评论(0) 推荐(0) 编辑
摘要: 1. 给定四个点,判断能否组成正方形 求出任意两点之间的六条边后,从小到大排序。 如果前四条边相等,后两条边相等,且后两条边的长度大于前四条边边,则可以组成正方形。 2. 连通图: 设一个二维几何图形的顶点数为V,划分区域数为Ar,一笔画笔数为B,则有: V+Ar-B=1 (如:矩形加上两条对角线所 阅读全文
posted @ 2020-04-26 13:12 Daybreaking 阅读(537) 评论(0) 推荐(0) 编辑
摘要: 1 //poj1195 二维线段树之树套树 2 // 先确定横坐标所在的区间并记录该结点的编号p,然后再确定纵坐标所在的区间并记录该结点的编号cur,则tree[cur][p]为目标区间。 3 #include <cstdio> 4 #include <cstdlib> 5 #include <cs 阅读全文
posted @ 2020-04-26 13:08 Daybreaking 阅读(298) 评论(0) 推荐(0) 编辑
摘要: 1 //zoj 2859 2 // 二维线段树之矩形树 求解矩阵和问题 3 #include <cstdio> 4 #include <cstdlib> 5 #include <cstring> 6 #include <cmath> 7 #include <algorithm> 8 #include 阅读全文
posted @ 2020-04-26 13:06 Daybreaking 阅读(252) 评论(0) 推荐(0) 编辑
摘要: 1 #include <cstdio> 2 #include <cstdlib> 3 #include <cstring> 4 #include <iostream> 5 //#define INPUT 6 /** 7 Problem:1182 - 食物链,NOI2001 8 Begin Time: 阅读全文
posted @ 2020-04-26 13:05 Daybreaking 阅读(356) 评论(0) 推荐(0) 编辑
摘要: 1 // D题 判平行四边形的个数 忘记了数学方法 2 #include<cstdio> 3 #include<cstdlib> 4 #include<cstring> 5 #include<cmath> 6 #include<algorithm> 7 #include<queue> 8 #incl 阅读全文
posted @ 2020-04-26 13:03 Daybreaking 阅读(248) 评论(0) 推荐(0) 编辑
摘要: 1 //A vector不T 2 // 最短路 SPFA 3 // in数组 4 5 #include<cstdio> 6 #include<cstdlib> 7 #include<cstring> 8 #include<cmath> 9 #include<algorithm> 10 #includ 阅读全文
posted @ 2020-04-26 13:00 Daybreaking 阅读(209) 评论(0) 推荐(0) 编辑
摘要: Description Given a positive integer N, you should output the leftmost digit of N^N. Input The input contains several test cases. The first line of th 阅读全文
posted @ 2020-04-26 12:44 Daybreaking 阅读(103) 评论(0) 推荐(0) 编辑
摘要: 问题:求(a+b)^n中各项的系数。 方法一:利用杨辉三角 11 11 2 11 3 3 11 4 6 4 11 5 10 10 5 11 6 15 20 15 6 1 (a+b)^1=a+b (a+b)^2=a^2+2ab+b^2 (a+b)^3=a^3+3b*a^2+3a*b^2+b^3 ... 阅读全文
posted @ 2020-04-26 12:41 Daybreaking 阅读(548) 评论(0) 推荐(0) 编辑