自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(925)
  • 资源 (1)
  • 收藏
  • 关注

转载 点分治学习

点分治学习笔记转自Menci的博客:点分治学习笔记点分治是用来解决树上路径问题的一种方法。在解决树上路径问题时,我们可以选取一点为根,将树转化为有根树,然后考虑经过根的所有路径(有时将两条从根出发的路径连接为一条)。统计完这些路径的答案后,将根节点标记为删除,对剩下的若干棵树进行同样的操作。如图,我们可以先考虑经过节点 111 的路径,之后将节点 111 标记为删除,此时可以认为考虑过的...

2018-10-12 18:40:46 247

原创 Codeforces Round #513 by Barcelona Bootcamp (rated, Div. 1 + Div. 2) C. Maximum Subrectangle(思路)

描述You are given two arrays aa and bb of positive integers, with length nn and mm respectively.Let cc be an n×mn×m matrix, where ci,j=ai⋅bjci,j=ai⋅bj.You need to find a subrectangle of the matrix c...

2018-10-10 20:09:49 243

原创 HihoCoder - 1055 刷油漆(树形dp,背包)

描述上回说到,小Ho有着一棵灰常好玩的树玩具!这棵树玩具是由N个小球和N-1根木棍拼凑而成,这N个小球都被小Ho标上了不同的数字,并且这些数字都是处于1…N的范围之内,每根木棍都连接着两个不同的小球,并且保证任意两个小球间都不存在两条不同的路径可以互相到达。没错,这次说的还是这棵树玩具的故事!小Ho的树玩具的质量似乎不是很好,短短玩了几个星期,便掉漆了!“简直是一场噩梦!”小Ho拿着树玩具...

2018-10-10 09:49:17 244

原创 HDU5534 Partial Tree(完全背包,思路)

Problem DescriptionIn mathematics, and more specifically in graph theory, a tree is an undirected graph in which any two nodes are connected by exactly one path. In other words, any connected graph ...

2018-10-09 20:48:58 211

原创 HDU5533 Dancing Stars on Me(几何,思路)

Problem DescriptionThe sky was brushed clean by the wind and the stars were cold in a black sky. What a wonderful night. You observed that, sometimes the stars can form a regular polygon in the sky ...

2018-10-09 20:24:11 283

原创 HDU5532 Almost Sorted Array(LIS)

Problem DescriptionWe are all familiar with sorting algorithms: quick sort, merge sort, heap sort, insertion sort, selection sort, bubble sort, etc. But sometimes it is an overkill to use these algo...

2018-10-09 20:17:38 185

原创 Codeforces Round #514 (Div. 2) C. Sequence Transformation(思路,数论)

题目链接:C. Sequence Transformation思路:给你一个序列,从1到n。然后有一个操作,求出这个序列的数的所有的gcd,然后把这个数添加到原序列中,然后你可以任意选择删除一个数,直到这个序列为空,序列结束。题目让你输出,每一次求出的gcd的值所组成的序列,并且让这序列字典序最大。(保证元素唯一性,比如求出来的gcd的值为1,如果1已经存在那么不用添加)样例已经给出解释3...

2018-10-08 21:37:06 249

原创 HUSTOJ运维常见的一些问题解决

前言最近在维护NYOJ2.0的一些BUG,由于判题机采用的是HUSTOJ的判题机,所以就必须了解一下HUSTOJ的源码。HUSTOJ的源码开源GitHub,我们可以clone下来自己部署一个。地址是:hustoj首先是几个个重要的配置文件的位置:/home/judge/etc/judge.conf #判题端配置文件/home/judge/src/web/include/db_info....

2018-10-02 15:03:25 3927

原创 Codeforces Round #511 (Div. 2) C. Enlarge GCD(思路,数论)

描述Mr. F has nn positive integers, a1,a2,…,ana1,a2,…,an.He thinks the greatest common divisor of these integers is too small. So he wants to enlarge it by removing some of the integers.But this prob...

2018-09-22 21:03:50 773

原创 HihoCoder - 1445 后缀自动机二·重复旋律5(后缀自动机,不同子串个数)

描述小Hi平时的一大兴趣爱好就是演奏钢琴。我们知道一个音乐旋律被表示为一段数构成的数列。现在小Hi想知道一部作品中出现了多少不同的旋律?解题方法提示输入共一行,包含一个由小写字母构成的字符串。字符串长度不超过 1000000。输出一行一个整数,表示答案。样例输入aab样例输出5思路官方讲解:小Hi:本周的题目其实就是给定一个字符串S,要求出S的所有不同子...

2018-09-22 16:03:47 403

原创 HihoCoder - 1441 后缀自动机一·基本概念(模拟)

描述小Hi:今天我们来学习一个强大的字符串处理工具:后缀自动机(Suffix Automaton,简称SAM)。对于一个字符串S,它对应的后缀自动机是一个最小的确定有限状态自动机(DFA),接受且只接受S的后缀。小Hi:比如对于字符串S=“aabbabd”,它的后缀自动机是:其中红色状态是终结状态。你可以发现对于S的后缀,我们都可以从S出发沿着字符标示的路径(蓝色实线)转移,最终到达终结状...

2018-09-22 15:37:05 367

原创 Educational Codeforces Round 51 (Rated for Div. 2) C. Vasya and Multisets(思路)

描述Vasya has a multiset ss consisting of nn integer numbers. Vasya calls some number xx nice if it appears in the multiset exactly once. For example, multiset {1,1,2,3,3,3,4}{1,1,2,3,3,3,4} contains ...

2018-09-21 20:32:30 417

原创 CodeForces - 1036C Classy Numbers(数位dp)

描述Let’s call some positive integer classy if its decimal representation contains no more than 33 non-zero digits. For example, numbers 44, 200000200000, 1020310203 are classy and numbers 42314231, 1...

2018-09-21 19:15:08 386

原创 E.Jiu Yuan Wants to Eat(ACM-ICPC 2018 焦作赛区网络预赛,树链剖分)

描述You ye Jiu yuan is the daughter of the Great GOD Emancipator. And when she becomes an adult, she will be queen of Tusikur, so she wanted to travel the world while she was still young. In a country...

2018-09-19 21:04:33 378

原创 B. Mathematical Curse(ACM-ICPC 2018 焦作赛区网络预赛,dp)

描述A prince of the Science Continent was imprisoned in a castle because of his contempt for mathematics when he was young, and was entangled in some mathematical curses. He studied hard until he reac...

2018-09-19 16:34:32 250

原创 L. Poor God Water(ACM-ICPC 2018 焦作赛区网络预赛,ac自动机+矩阵快速幂 或 BM线性递推)

描述God Water likes to eat meat, fish and chocolate very much, but unfortunately, the doctor tells him that some sequence of eating will make them poisonous.Every hour, God Water will eat one kind of...

2018-09-18 21:47:24 406

原创 ZOJ4048 Red Black Tree(The 2018 ACM-ICPC Asia Qingdao Regional Contest, Online,二分+LCA)

题目链接: Red Black Tree描述BaoBao has just found a rooted tree with vertices and weighted edges in his backyard. Among the vertices, of them are red, while the others are black. The root of the tree ...

2018-09-17 21:24:37 655

原创 HDU6172 Array Challenge(BM线性递推)

Problem Description There’s an array that is generated by following rule. h0=2,h1=3,h2=6,hn=4hn−1+17hn−2−12hn−3−16h0=2,h1=3,h2=6,hn=4hn−1+17hn−2−12hn−3−16h_0=2,h_1=3,h_2=6,h_n=4h_{n-1}+17h_{n-2...

2018-09-16 23:12:40 587

原创 CodeForces 570D Tree Requests(dfs序,二分)

描述 Roman planted a tree consisting of n vertices. Each vertex contains a lowercase English letter. Vertex 1 is the root of the tree, each of the n - 1 remaining vertices has a parent in the tree. ...

2018-09-14 11:31:22 249

原创 B. BE, GE or NE(ACM-ICPC 2018 徐州赛区网络预赛,博弈,记忆化搜索)

描述 In a world where ordinary people cannot reach, a boy named “Koutarou” and a girl named “Sena” are playing a video game. The game system of this video game is quite unique: in the process of pla...

2018-09-12 23:21:33 319

原创 J. Maze Designer(ACM-ICPC 2018 徐州赛区网络预赛,最大生成树,LCA)

描述 After the long vacation, the maze designer master has to do his job. A tour company gives him a map which is a rectangle. The map consists of N \times MN×M little squares. That is to say, the h...

2018-09-11 23:33:19 322

原创 H. Ryuji doesn't want to study(ACM-ICPC 2018 徐州赛区网络预赛,树状数组)

描述 Ryuji is not a good student, and he doesn’t want to study. But there are n books he should learn, each book has its knowledge a[i]. Unfortunately, the longer he learns, the fewer he gets....

2018-09-10 23:42:55 283

原创 G. Trace(ACM-ICPC 2018 徐州赛区网络预赛,思路,set)

描述 There’s a beach in the first quadrant. And from time to time, there are sea waves. A wave ( xx , yy ) means the wave is a rectangle whose vertexes are ( 00 , 00 ), ( xx , 00 ), ( 00 , yy ), ( x...

2018-09-10 09:32:06 401

原创 F. Features Track(ACM-ICPC 2018 徐州赛区网络预赛,dp,滚动数组优化)

描述 Morgana is learning computer vision, and he likes cats, too. One day he wants to find the cat movement from a cat video. To do this, he extracts cat features in each frame. A cat feature is a t...

2018-09-10 08:51:22 302

原创 HDU6447 YJJ's Salesman(2018CCPC网络赛,线段树,思路)

Problem Description YJJ is a salesman who has traveled through western country. YJJ is always on journey. Either is he at the destination, or on the way to destination. One day, he is going to ...

2018-09-07 20:12:56 331

原创 HDU6446 Tree and Permutation(2018CCPC网络赛,树形dp)

Problem Description There are N vertices connected by N−1 edges, each edge has its own length. The set { 1,2,3,…,N } contains a total of N! unique permutations, let’s say the i-th permutation i...

2018-09-06 20:43:35 248

原创 HDU6444 Neko's loop(2018CCPC网络赛,线段树,思路)

Problem Description Neko has a loop of size n. The loop has a happy value ai on the i−th(0≤i≤n−1) grid. Neko likes to jump on the loop.She can start at anywhere. If she stands at i−th grid,...

2018-09-06 11:30:00 424

原创 HDU6441 Find Integer(2018CCPC网络赛,费马大定理)

Problem Description people in USSS love math very much, and there is a famous math problem . give you two integers n,a,you are required to find 2 integers b,c such that an+bn=cnan+bn=cna^n+b^...

2018-09-05 18:01:54 287

原创 L. Magical Girl Haze(ACM-ICPC 2018 南京赛区网络预赛,分层最短路,堆优化的dijkstra)

描述 There are NN cities in the country, and MM directional roads from uu to v(1\le u, v\le n)v(1≤u,v≤n). Every road has a distance c_ici. Haze is a Magical Girl that lives in City 11, she can choos...

2018-09-03 20:13:55 332

原创 BZOJ2763 [JLOI2011]飞行路线(分层最短路,dijkstra的堆优化)

Description Alice和Bob现在要乘飞机旅行,他们选择了一家相对便宜的航空公司。该航空公司一共在n个城市设有业务,设这些城市分别标记为0到n-1,一共有m种航线,每种航线连接两个城市,并且航线有一定的价格。Alice和Bob现在要从一个城市沿着航线到达另一个城市,途中可以进行转机。航空公司对他们这次旅行也推出优惠,他们可以免费在最多k种航线上搭乘飞机。那么Alice和Bob这...

2018-09-03 19:51:15 307

原创 E. AC Challenge(ACM-ICPC 2018 南京赛区网络预赛,状态压缩dp)

描述 Dlsj is competing in a contest with n (0 < n \le 20)n(0Input The first line of input contains an integer, nn, which is the number of problems. Then follows nn lines, the ii-th lin...

2018-09-02 17:27:23 323

原创 HDU6348 Buy and Resell(2018CCPC网络赛,优先队列,贪心)

Problem Description The Power Cube is used as a stash of Exotic Power. There are n cities numbered 1,2,…,n where allowed to trade it. The trading price of the Power Cube in the i-th city is ai dol...

2018-08-31 22:19:06 263

原创 CodeForces 867E Buy Low Sell High(优先队列,贪心)

描述 You can perfectly predict the price of a certain stock for the next N days. You would like to profit on this knowledge, but only want to transact one share of stock per day. That is, each day y...

2018-08-31 21:57:31 276

原创 SPOJ Distinct Substrings (后缀数组,不相同的子串个数)

描述 Given a string, we need to find the total number of its distinct substrings.Input T- number of test cases. T<=20; Each test case consists of one string, whose length is <= 100...

2018-08-24 16:48:50 334

原创 HihoCoder - 1407 后缀数组二·重复旋律2(不可重叠最长重复子串,二分)

描述小Hi平时的一大兴趣爱好就是演奏钢琴。我们知道一个音乐旋律被表示为长度为 N 的数构成的数列。小Hi在练习过很多曲子以后发现很多作品自身包含一样的旋律。旋律可以表示为一段连续的数列,相似的旋律在原数列不可重叠,比如在1 2 3 2 3 2 1 中 2 3 2 出现了一次,2 3 出现了两次,小Hi想知道一段旋律中出现次数至少为两次的旋律最长是多少?解题方法提示输入第一行...

2018-08-24 15:41:31 310

原创 HihoCoder - 1403 后缀数组一·重复旋律(可重叠k次最长重复子串,二分)

描述 小Hi平时的一大兴趣爱好就是演奏钢琴。我们知道一个音乐旋律被表示为长度为 N 的数构成的数列。 小Hi在练习过很多曲子以后发现很多作品自身包含一样的旋律。旋律是一段连续的数列,相似的旋律在原数列可重叠。比如在1 2 3 2 3 2 1 中 2 3 2 出现了两次。 小Hi想知道一段旋律中出现次数至少为K次的旋律最长是多少? 解题方法提示输入...

2018-08-24 15:26:21 278

原创 POJ3261 Milk Patterns(后缀数组,可重叠k次最长重复子串,二分)

Description Farmer John has noticed that the quality of milk given by his cows varies from day to day. On further investigation, he discovered that although he can’t predict the quality of milk fr...

2018-08-24 15:12:39 244

原创 POJ1743 Musical Theme(后缀数组,不可重叠最长重复子串,二分)

Description A musical melody is represented as a sequence of N (1<=N<=20000)notes that are integers in the range 1..88, each representing a key on the piano. It is unfortunate but true that ...

2018-08-24 11:19:22 232

原创 POJ3450 Corporate Identity(后缀数组,多个串的最长公共子串,二分)

Description Beside other services, ACM helps companies to clearly state their “corporate identity”, which includes company logo but also other signs, like trademarks. One of such companies is Inte...

2018-08-24 10:43:31 256

原创 HDU6434 Problem I. Count(2018HDU多校联赛第十场,欧拉函数)

Problem Description Multiple query, for each n, you need to get ∑ni=1∑i−1j=1[gcd(i+1,i−j)=1]∑i=1n∑j=1i−1[gcd(i+1,i−j)=1] \sum _{i=1}^n \sum _{j=1}^{i-1} [gcd(i+1,i-j)=1]Input On the fi...

2018-08-23 11:52:02 263

2018 ACM-ICPC 南京网络赛题目

2018 ACM-ICPC 南京网络赛题目

2018-09-01

空空如也

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

TA关注的人

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