自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(25)
  • 资源 (9)
  • 收藏
  • 关注

原创 HDU-3038-How Many Answers Are Wrong【 带权并查集 】题解

目录1.题目2.代码1.题目TT and FF are … friends. Uh… very very good friends -________-bFF is a bad boy, he is always wooing TT to play the following game with him. This is a very humdrum game. To begin with, TT should write down a sequence of integers-_-!!(bored)

2020-05-30 18:30:22 229

原创 POJ - 2082 - Terrible Sets【 单调队列 】题解

目录1.题目2.代码1.题目Let N be the set of all natural numbers {0 , 1 , 2 , . . . }, and R be the set of all real numbers. wi, hi for i = 1 . . . n are some elements in N, and w0 = 0.Define set B = {< x, y > | x, y ∈ R and there exists an index i > 0 su

2020-05-28 19:04:34 143

原创 POJ - 2823 Sliding Window 【 单调队列 】详细题解

目录1.题目2.代码1.题目An array of size n ≤ 106 is given to you. There is a sliding window of size k which is moving from the very left of the array to the very right. You can only see the k numbers in the window. Each time the sliding window moves rightwards by

2020-05-28 19:02:00 456

原创 POJ - 3250 - Bad Hair Day【 单调栈 】题解

目录1.题目2.代码1.题目Some of Farmer John’s N cows (1 ≤ N ≤ 80,000) are having a bad hair day! Since each cow is self-conscious about her messy hairstyle, FJ wants to count the number of other cows that can see the top of other cows’ heads.Each cow i has a spec

2020-05-28 18:59:15 244

原创 POJ - 2796 - Feel Good POJ 【单调栈】 题解

目录1.题目2.代码1.题目Bill is developing a new mathematical theory for human emotions. His recent investigations are dedicated to studying how good or bad days influent people’s memories about some period of life.A new idea Bill has recently developed assigns a

2020-05-28 18:55:56 338

原创 HDU -1506 Largest Rectangle in a Histogram【单调栈单调队列】题解

目录1.题目2.代码1.题目A histogram is a polygon composed of a sequence of rectangles aligned at a common base line. The rectangles have equal widths but may have different heights. For example, the figure on the left shows the histogram that consists of rectangle

2020-05-28 18:52:26 232

原创 LightOJ 1258 Making Huge Palindromes 【 马拉车 】题解

目录1.题目2.代码1.题目A string is said to be a palindrome if it remains same when read backwards. So, ‘abba’, ‘madam’ both are palindromes, but ‘adam’ is not.Now you are given a non-empty string S, containing only lowercase English letters. The given string may

2020-05-27 21:12:50 244

原创 UVA 644 Immediate Decodability【字典树】 题解

目录1.题目2.代码1.题目An encoding of a set of symbols is said to be immediately decodable if no code for one symbol is the prefix of a code for another symbol. We will assume for this problem that all codes are in binary, that no two codes within a set of codes

2020-05-27 21:08:36 234

原创 POJ 2001 Shortest Prefixes【字典树】题解

目录1.题目2.代码1.题目A prefix of a string is a substring starting at the beginning of the given string. The prefixes of “carbon” are: “c”, “ca”, “car”, “carb”, “carbo”, and “carbon”. Note that the empty string is not considered a prefix in this problem, but eve

2020-05-27 21:03:11 505

原创 HDU -1251 统计难题 【字典树】 题解

目录1.题目2.代码1.题目Ignatius最近遇到一个难题,老师交给他很多单词(只有小写字母组成,不会有重复的单词出现),现在老师要他统计出以某个字符串为前缀的单词数量(单词本身也是自己的前缀).Input输入数据的第一部分是一张单词表,每行一个单词,单词的长度不超过10,它们代表的是老师交给Ignatius统计的单词,一个空行代表单词表的结束.第二部分是一连串的提问,每行一个提问,每个提问都是一个字符串.注意:本题只有一组测试数据,处理到文件结束.Output对于每个提问,给出以该字符串为

2020-05-27 20:59:24 133

原创 HDU-3294 Girls research【马拉车】 题解

目录1.题目2.代码1.题目One day, sailormoon girls are so delighted that they intend to research about palindromic strings. Operation contains two steps:First step: girls will write a long string (only contains lower case) on the paper. For example, “abcde”, but ‘

2020-05-27 20:55:07 350

原创 HDU - 3068 最长回文 【马拉车】题解

目录1.题目2.代码1.题目给出一个只由小写英文字符a,b,c…y,z组成的字符串S,求S中最长回文串的长度.回文就是正反读都是一样的字符串,如aba, abba等Input输入有多组case,不超过120组,每组输入为一行小写英文字符a,b,c…y,z组成的字符串S两组case之间由空行隔开(该空行不用处理)字符串长度len <= 110000Output每一行一个整数x,对应一组case,表示该组case的字符串中所包含的最长回文长度.Sample Inputaaaaaba

2020-05-27 20:49:25 208

原创 POJ 2828 排队插队【线段树】题解

目录1.题目2.代码1.题目Railway tickets were difficult to buy around the Lunar New Year in China, so we must get up early and join a long queue…The Lunar New Year was approaching, but unluckily the Little Cat still had schedules going here and there. Now, he had

2020-05-26 18:39:43 277

原创 Light oj 1112 - Curious Robin Hood【 线段树-单点更新】题解

目录1.题目2.代码1.题目Robin Hood likes to loot rich people since he helps the poor people with this money. Instead of keeping all the money together he does another trick. He keeps n sacks where he keeps this money. The sacks are numbered from 0 to n-1.Now each

2020-05-26 18:34:33 142

原创 HDU 1698 Just a Hook【线段树】 题解

目录1.题目2.代码1.题目In the game of DotA, Pudge’s meat hook is actually the most horrible thing for most of the heroes. The hook is made up of several consecutive metallic sticks which are of the same length.Now Pudge wants to do some operations on the hook.

2020-05-26 18:29:45 218

转载 HDU-1754-I Hate It【线段树】题解

目录1.题目2.代码1.题目很多学校流行一种比较的习惯。老师们很喜欢询问,从某某到某某当中,分数最高的是多少。这让很多学生很反感。不管你喜不喜欢,现在需要你做的是,就是按照老师的要求,写一个程序,模拟老师的询问。当然,老师有时候需要更新某位同学的成绩。Input本题目包含多组测试,请处理到文件结束。在每个测试的第一行,有两个正整数 N 和 M ( 0<N<=200000,0<M<5000 ),分别代表学生的数目和操作的数目。学生ID编号分别从1编到N。第二行包含N个

2020-05-26 18:26:21 190

原创 HDU1166 敌兵布阵【线段树】题解

目录1.题目2.代码1.题目C国的死对头A国这段时间正在进行军事演习,所以C国间谍头子Derek和他手下Tidy又开始忙乎了。A国在海岸线沿直线布置了N个工兵营地,Derek和Tidy的任务就是要监视这些工兵营地的活动情况。由于采取了某种先进的监测手段,所以每个工兵营地的人数C国都掌握的一清二楚,每个工兵营地的人数都有可能发生变动,可能增加或减少若干人手,但这些都逃不过C国的监视。中央情报局要研究敌人究竟演习什么战术,所以Tidy要随时向Derek汇报某一段连续的工兵营地一共有多少人,例如Derek问

2020-05-26 18:22:23 1063

原创 Two Buttons 【 模拟 】 题解

目录1.题目2.题意3.思路4.代码1.题目题面描述薇尔莉特在一个机器前,有一个红色按钮、一个蓝色按钮和一个只能显示正整数的屏幕。按下红色按钮后,机器的数字会乘 2。按下蓝色按钮后,机器的数字会减 1。如果在某时刻,数字不再是正整数,机器会当场宕机,因此不能让数字小于或等于零。屏幕可以显示任意大的正整数。初始状态下,机器的数字为 n。薇尔莉特想要在显示屏幕上得到数字为 m。为了获得这个结果,她最少需要按多少次按钮?输入格式输入一行,两个空格分隔的不同的正整数 n 和 m (1 ≤ n, m ≤ 

2020-05-21 10:00:32 410

原创 Codeforces Round #643 (Div. 2) Sequence with Digits【思维】 题解

目录1.题目2.题意3.思路4.代码1.题目Let’s define the following recurrence:an+1=an+minDigit(an)⋅maxDigit(an).Here minDigit(x) and maxDigit(x) are the minimal and maximal digits in the decimal representation of x without leading zeroes. For examples refer to notes.Yo

2020-05-20 19:28:48 241

原创 CodeForces 1213A 【思维】 题解

目录1.0题目2.代码1.0题目zls有n个薯条,第i个薯条的位置在xi,一些薯条可能放在相同的位置上。你可以进行任意次(包括0次)如下操作:1.不花费任何钱,把薯条i的位置左移2或右移2,即xi加2或减2;2.花费一元,把薯条i的位置左移1或右移1,把xi加1或减1;请找出让所有薯条移动到同一位置花费的最少价格(即所有的xi最后都要相同)。Input第一行输入一个n(1<=n<=100),代表薯条的数量。第二行输入n个整数x1,x2,…,xn(1<=xi<10^9

2020-05-20 18:02:12 391

原创 HDU-1213 Ignatius birthday 【并查集】 题解

目录1.题目2.题意3.思路4.代码1.题目Today is Ignatius’ birthday. He invites a lot of friends. Now it’s dinner time. Ignatius wants to know how many tables he needs at least. You have to notice that not all the friends know each other, and all the friends do not want t

2020-05-16 22:23:27 1235

原创 POJ - 2524 Ubiquitous Religions 【并查集】 题解

目录1.题目2.思路3.代码1.题目北理CS学院2015级的学长学姐们终于搬到村里了,他们住进了新的宿舍,你想知道学校给CS学院一共安排了多少宿舍,但矜持的学长学姐们是不会直接告诉你他们宿舍号的,你唯一机会是当看到两位学姐相伴而行或者两位学长相依为Gay的时候,就可以断定他们住在同一间宿舍。已知CS学院2015级共有n(n <= 50000)名同学,你看到了m(m<=n(n-1)/2)组学长学姐对,现在请问他们至多住进了多少间宿舍。Input有多组数据。对于每组数据:第一行:两个整数n

2020-05-15 18:10:35 213

原创 The Suspects 【 并查集 】超详细题解

严重急性呼吸系统综合症( SARS), 一种原因不明的非典型性肺炎,从2003年3月中旬开始被认为是全球威胁。为了减少传播给别人的机会, 最好的策略是隔离可能的患者。在Not-Spreading-Your-Sickness大学( NSYSU), 有许多学生团体。同一组的学生经常彼此相通,一个学生可以同时加入几个小组。为了防止非典的传播,NSYSU收集了所有学生团体的成员名单。他们的标准操作程序(SOP)如下:一旦一组中有一个可能的患者, 组内的所有成员就都是可能的患者。然而,他们发现当一个学生被确认为

2020-05-13 22:27:13 521

原创 并查集模板超详细整理

并查集被很多OIer认为是最简洁而优雅的数据结构之一,主要用于解决一些元素分组的问题。它管理一系列不相交的集合,并支持两种操作:·合并(Union):把两个不相交的集合合并为一个集合。·查询(Find):查询两个元素是否在同一个集合中。假如有编号为1, 2, 3, …, n的n个元素,我们用一个数组fa[]来存储每个元素的父节点(因为每个元素有且只有一个父节点,所以这是可行的)。一开始,我们先将它们的父节点设为自己。查询int find(int x){ if(fa[x] == x)

2020-05-13 19:06:24 4558

原创 hdu1232 畅通工程 【并查集】超详细题解

目录1.题目2.题意3.思路4.代码1.题目某省调查城镇交通状况,得到现有城镇道路统计表,表中列出了每条道路直接连通的城镇。省政府“畅通工程”的目标是使全省任何两个城镇间都可以实现交通(但不一定有直接的道路相连,只要互相间接通过道路可达即可)。问最少还需要建设多少条道路?Input测试输入包含若干测试用例。每个测试用例的第1行给出两个正整数,分别是城镇数目N ( < 1000 )和道路数目M;随后的M行对应M条道路,每行给出一对正整数,分别是该条道路直接连通的两个城镇的编号。为简单起见,城镇从

2020-05-13 18:44:15 471

redis数据库指令合集.rar

内含redis入门指南,redis-指令

2021-08-03

Shiro入门.rar

笔记(pdf + md格式) + 源码

2021-06-12

MySQL55题及答案.rar

精选MySQL55道面试题

2021-05-06

狂神说JavaWeb笔记.rar

狂神说JavaWeb笔记,内含JavaWeb的md格式笔记

2021-05-06

狂神说员工管理系统.rar

狂神Spring Boot 员工管理系统 【源码 + 笔记 + web素材】 超详细整理

2021-05-06

Doubbo面试及答案.rar

精选Doubbo面试题(含答案)

2021-05-06

350道Java面试题手册+Java基础面试题.rar

350道Java面试题手册和Java基础面试题整理,内含性能优化面试专栏和微服务架构面试专栏,并发编程高级面试专栏,,开源框架面试题专栏以及分布式面试专栏。

2021-05-06

狂神说多线程详解.rar

狂神说多线程详解笔记

2021-05-06

狂神说JVM探究.rar

B站【狂神说Java】JVM快速入门篇笔记,内有md格式,pdf格式, docx格式笔记,和视频内笔记基本无误。

2021-05-06

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除