Live2d Test Env

随笔分类 -  CodeForces

摘要:Recently, Pari and Arya did some research about NP-Hard problems and they found the minimum vertex cover problem very interesting. Suppose the graph G 阅读全文
posted @ 2018-08-30 16:45 nimphy 阅读(308) 评论(0) 推荐(0)
摘要:Long time ago, there was a great kingdom and it was being ruled by The Great Arya and Pari The Great. These two had some problems about the numbers th 阅读全文
posted @ 2018-08-30 13:18 nimphy 阅读(260) 评论(0) 推荐(0)
摘要:Oleg the client and Igor the analyst are good friends. However, sometimes they argue over little things. Recently, they started a new company, but the 阅读全文
posted @ 2018-08-28 19:05 nimphy 阅读(290) 评论(0) 推荐(0)
摘要:For a connected undirected weighted graph G, MST (minimum spanning tree) is a subgraph of G that contains all of G's vertices, is a tree, and sum of i 阅读全文
posted @ 2018-08-27 22:21 nimphy 阅读(545) 评论(0) 推荐(0)
摘要:A point belongs to a triangle if it lies inside the triangle or on one of its sides. Two triangles are disjoint if there is no point on the plane that 阅读全文
posted @ 2018-08-26 21:53 nimphy 阅读(406) 评论(0) 推荐(0)
摘要:Dima the hamster enjoys nibbling different things: cages, sticks, bad problemsetters and even trees! Recently he found a binary search tree and instin 阅读全文
posted @ 2018-08-26 21:45 nimphy 阅读(548) 评论(0) 推荐(0)
摘要:One day Natalia was walking in the woods when she met a little mushroom gnome. The gnome told her the following story: Everybody knows that the mushro 阅读全文
posted @ 2018-08-22 22:50 nimphy 阅读(456) 评论(0) 推荐(0)
摘要:I guess there's not much point in reminding you that Nvodsk winters aren't exactly hot. That increased the popularity of the public transport dramatic 阅读全文
posted @ 2018-08-22 15:45 nimphy 阅读(388) 评论(0) 推荐(0)
摘要:Sherlock Holmes found a mysterious correspondence of two VIPs and made up his mind to read it. But there is a problem! The correspondence turned out t 阅读全文
posted @ 2018-08-22 10:58 nimphy 阅读(281) 评论(0) 推荐(0)
摘要:You have been offered a job in a company developing a large social network. Your first task is connected with searching profiles that most probably be 阅读全文
posted @ 2018-08-21 22:10 nimphy 阅读(348) 评论(0) 推荐(0)
摘要:题意:给定N点,M边,求添加最少的边使之变为连通图的方案数。 思路:注意题目给出的M边可能带环,即最后生成的不一定是一棵树。但是影响不大。根据矩阵树定理,我们知道生成树的数量=N^(N-2),即点数^(连通数-2)。 此题把已经连通的看成一个整体,就可以得到数量为N^(cnt-2),然后考虑连通块内 阅读全文
posted @ 2018-08-21 17:07 nimphy 阅读(547) 评论(0) 推荐(0)
摘要:Nowadays all circuses in Berland have a round arena with diameter 13 meters, but in the past things were different. In Ancient Berland arenas in circu 阅读全文
posted @ 2018-08-21 15:20 nimphy 阅读(475) 评论(0) 推荐(1)
摘要:De Prezer loves rectangles.He has a n × m rectangle which there is a number in each of its cells. We show the number in the j - th column of the i - t 阅读全文
posted @ 2018-08-21 10:08 nimphy 阅读(513) 评论(0) 推荐(0)
摘要:题意:给定字符串char[],以及Q个操作,操作有三种: 1:pos,chr:把pos位置的字符改为chr 2:pos:问以pos为中心的回文串长度为多长。 3:pos:问以pos,pos+1为中心的回文串长度为多长。 思路:用hash表示一段字符串或者连续子串。我们用BIT记录hash前缀和,那么 阅读全文
posted @ 2018-08-20 21:20 nimphy 阅读(211) 评论(0) 推荐(0)
摘要:题意:给定N点M边的有向图,每条边有距离和颜色,一条有效路径上不能有相邻的边颜色相同。现在给定起点S,多次讯问S到点X的最短有效距离。 TLE思路:用二维状态dis(u,c)表示起点到u,最后一条边的颜色是c的最短距离,用map解决了二维空间不足的问题。但是T第151个点。所以需要优化,标解的优化是 阅读全文
posted @ 2018-08-20 18:25 nimphy 阅读(231) 评论(0) 推荐(0)
摘要:题意:给定N的棒棒,K种颜色,每个棒棒的两端可以涂色。现在已知所有的线段要么有一端涂色,要么两端都没有涂色,现在要求把所有的没涂色的部分涂色,使得我们可以把涂色后的棒棒分为N/K组,每组的涂色情况相同。 思路:把没有颜色的棒子,看成一端涂色为0,那么现在每个线段都有一端涂色。我们按照数量来排序,然后 阅读全文
posted @ 2018-08-20 10:28 nimphy 阅读(378) 评论(0) 推荐(0)
摘要:题意:一个顶点数为N的生成树,对于每个点i,我们按照与i的距离给出顺序,即dis i 1<=dis i 2<=dis i 3<=...,现在让你输出N-1条边,即还原这棵树。 思路:首先应该得到距离为1的点对,那些肯定是树边,然后这样得到的树边可能<N-1,后面不容易判定哪些是树边。搜索什么的都不好 阅读全文
posted @ 2018-08-20 09:26 nimphy 阅读(254) 评论(0) 推荐(0)
摘要:Nikita likes tasks on order statistics, for example, he can easily find the kk-th number in increasing order on a segment of an array. But now Nikita 阅读全文
posted @ 2018-08-16 19:02 nimphy 阅读(376) 评论(0) 推荐(0)
摘要:After the war, the supersonic rocket became the most common public transportation. Each supersonic rocket consists of two "engines". Each engine is a 阅读全文
posted @ 2018-08-16 14:55 nimphy 阅读(274) 评论(0) 推荐(0)
摘要:题意:给定平面上N个点,问是否存在三角形,其面积为S。 思路:选择Y轴,枚举这个Y轴,面积大小只与|y-Y|有关,然后二分,具体的可以先去做BZOJ3707。 具体的: 1,先对点排序,X坐标为第一关键字,Y坐标为第二关键字,从小到大排序。 2,得到C(N,2)条直线,按照它们的斜率为关键字(叉积排 阅读全文
posted @ 2018-08-15 22:50 nimphy 阅读(532) 评论(0) 推荐(0)