Codeforces 838E Convex Countour】的更多相关文章

题 OvO http://codeforces.com/contest/838/problem/E (IndiaHacks 2nd Elimination 2017 (unofficial, unrated mirror, ICPC rules) - E) 解 dp[i][j][k]表示左端点为i,右端点为j这个区间(如果i>j,就是(i~n),(1,j)),状态为k(k=0说明i这端可以接,k=1说明j这端可以接) 枚举长度, 那么对于dp[i][j][0],可以从dp[i-1][j][0]接…
题目链接 \(Description\) 给定一个n边凸多边形(保证没有三点共线),求一条经过每个点最多一次的不会相交的路径,使得其长度最大.输出这个长度. \(Solution\) 最长路径应该是尽可能多走点.因为路径不相交,如果当前在\(x\),下次应是向\(x+1\)或\(x-1\)连边,区间也是如此,即当前区间一定是连续的. 画画图可以发现,每个状态应该是左边可以再连出边或右边可以再连出边. 那么令\(f[i][j][0/1]\)表示在\([i,j]\)时左边/右边可以再连出边时的最长路…
[CF838E] Convex Countour 首先观察题目的性质 由于是凸包,因此不自交路径中的一条边\((x, y)\)的两端点只能向与\(x\)或\(y\)相邻的结点连边. 举个栗子,若选取了一条边\((x, y)\),且假设编号从\(x\)到\(y\)结点已经在一条不自交路径中(不考虑特殊情况),那么向外扩展路径只能连向相邻的点,即只能连边\((x+1, y)\)或\((x, x+1)\)或\((x, y-1)\)或\((y-1, y)\) 很容易用反证法证明.假设连边\((x-2,…
题目链接:http://codeforces.com/problemset/problem/275/B 题目内容:给出一个n * m 大小的grid,上面只有 black 和 white 两种颜色填充.问任意两个black  cell 的连通是否满足最多转一次弯而达到.当然,如果有好多堆black cell 也是不满足条件的,即只能有一堆!! 这是继color the fence 之后,又一条花了我很长时间才做出来的题目,因为搜索这些技巧学不好,于是只能结合观察能力做出来了.其实最直接的方法应该…
思路: 如果所有的图形都是三角形,那么答案是2*n+1 否则轮廓肯定触到了最上面,要使轮廓线最短,那么轮廓肯定是中间一段平的 我们考虑先将轮廓线赋为2*n+2,然后删去左右两边多余的部分 如果最左边或最由边是正方形,那么不需要删 如果最左边或最由边是圆形,那么删取2 - pi/2 如果如果最左边或最由边是三角形,那么我们需要找到一段连续的三角形,然后考虑怎么删去 #pragma GCC optimize(2) #pragma GCC optimize(3) #pragma GCC optimiz…
Codeforces Round #270 1003 C. Design Tutorial: Make It Nondeterministic time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output A way to make a new task is to make it nondeterministic or probabili…
题目链接:http://codeforces.com/contest/70/problem/D Once a walrus professor Plato asked his programming students to perform the following practical task. The students had to implement such a data structure that would support a convex hull on some set of…
B. The Monster and the Squirrel Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/592/problem/B Description Ari the monster always wakes up very early with the first ray of the sun and the first thing she does is feeding her…
Codeforces Round #270 A. Design Tutorial: Learn from Math time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output One way to create a task is to learn from math. You can generate some random math s…
A. Carrot Cakes 题面 In some game by Playrix it takes t minutes for an oven to bake k carrot cakes, all cakes are ready at the same moment t minutes after they started baking. Arkady needs at least n cakes to complete a task, but he currently don't hav…