Live2d Test Env

随笔分类 -  DP

摘要:现在给你一个长度为n的整数序列,其中有一些数已经模糊不清了,现在请你任意确定这些整数的值, 使得最长上升子序列最长。(为何最长呢?因为hxy向来对自己的rp很有信心) Input 第一行一个正整数n 接下来n行第i行格式如下 K x:表示第i个数可以辨认且这个数为x N:表示第i个数一个已经辨认不清 阅读全文
posted @ 2018-10-31 15:52 nimphy 阅读(390) 评论(0) 推荐(0)
摘要:Kelukin is a businessman. Every day, he travels around cities to do some business. On August 17th, in memory of a great man, citizens will read a book 阅读全文
posted @ 2018-10-19 11:20 nimphy 阅读(212) 评论(0) 推荐(0)
摘要:题意:T组样例,给次给出一个N节点的点权树,以及M,问连通块的点权和sum的情况,输出sum=1到M,用0或者1表示。 思路:背包,N^2,由于是无向的连通块,所以可以用分治优化到NlgN。 然后背包可以用bitset优化。注意不要想着背包合并背包,背包只能合并单点。 阅读全文
posted @ 2018-09-24 09:18 nimphy 阅读(802) 评论(0) 推荐(0)
摘要:有M个球,一开始每个球均有一个初始标号,标号范围为1~N且为整数,标号为i的球有ai个,并保证Σai = M。 每次操作等概率取出一个球(即取出每个球的概率均为1/M),若这个球标号为k(k < N),则将它重新标号为k + 1;若这个球标号为N,则将其重标号为1。(取出球后并不将其丢弃) 现在你需 阅读全文
posted @ 2018-09-18 19:47 nimphy 阅读(403) 评论(0) 推荐(0)
摘要:On Saint Valentine's Day, Alex imagined to present a special pendant to his girl friend made by K kind of pearls. The pendant is actually a string of 阅读全文
posted @ 2018-09-18 19:26 nimphy 阅读(260) 评论(0) 推荐(0)
摘要:Perhaps the sea‘s definition of a shell is the pearl. However, in my view, a shell necklace with n beautiful shells contains the most sincere feeling 阅读全文
posted @ 2018-09-17 15:58 nimphy 阅读(213) 评论(0) 推荐(0)
摘要:Vasya has decided to build a zip-line on trees of a nearby forest. He wants the line to be as long as possible but he doesn't remember exactly the hei 阅读全文
posted @ 2018-08-31 21:49 nimphy 阅读(360) 评论(0) 推荐(0)
摘要:Vasya's telephone contains n photos. Photo number 1 is currently opened on the phone. It is allowed to move left and right to the adjacent photo by sw 阅读全文
posted @ 2018-08-31 21:30 nimphy 阅读(242) 评论(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 阅读(539) 评论(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 阅读(274) 评论(0) 推荐(0)
摘要:题意: 现在有1,2,3...N这N个站, 给定限定时间Limt, N-1种票的价格, 分别对应一个最远距离, 叫你选择一种票, 满足可以在规定时间到达N站台,而且价格最低 思路: 如果买距离为L的票可以在规定时间到,那么距离>L的票也一定能到. 我们只需要二分出这个下界 L,然后在>=L里选择一个 阅读全文
posted @ 2018-08-11 19:18 nimphy 阅读(338) 评论(0) 推荐(0)
摘要:题意:一个环状数组,给定可以删去一个数,代价的相邻两个数的gcd,求最小代价。 思路:区间DP即可,dp[i][j]表示[i,j]区间只剩下i和j时的最小代价,那么dp[i][j]=min dp[i][k]+dp[k][j]+gcd(a[[i],a[j])。带上注意不能加倍做,以为常数会乘8,TLE 阅读全文
posted @ 2018-08-04 20:59 nimphy 阅读(512) 评论(0) 推荐(0)
摘要:注意初始化。。。等等补 阅读全文
posted @ 2018-07-18 12:48 nimphy 阅读(334) 评论(0) 推荐(0)
摘要:Description osu 是一款群众喜闻乐见的休闲软件。 我们可以把osu的规则简化与改编成以下的样子: 一共有n次操作,每次操作只有成功与失败之分,成功对应1,失败对应0,n次操作对应为1个长度为n的01串。在这个串中连续的 X个1可以贡献X^3 的分数,这x个1不能被其他连续的1所包含(也 阅读全文
posted @ 2018-07-18 09:22 nimphy 阅读(330) 评论(0) 推荐(0)
摘要:这里有三道长得像的题: 一: HDU6036: There is a tree with nn nodes, each of which has a type of color represented by an integer, where the color of node ii is cici 阅读全文
posted @ 2018-07-08 13:25 nimphy 阅读(679) 评论(0) 推荐(1)
摘要:Barney was hanging out with Nora for a while and now he thinks he may have feelings for her. Barney wants to send her a cheesy text message and wants 阅读全文
posted @ 2018-07-01 18:37 nimphy 阅读(344) 评论(0) 推荐(0)
摘要:Limak is an old brown bear. He often goes bowling with his friends. Today he feels really good and tries to beat his own record! For rolling a ball on 阅读全文
posted @ 2018-06-30 11:42 nimphy 阅读(496) 评论(0) 推荐(0)
摘要:Zxr960115 is owner of a large farm. He feeds m cute cats and employs p feeders. There's a straight road across the farm and n hills along the road, nu 阅读全文
posted @ 2018-06-30 09:58 nimphy 阅读(626) 评论(0) 推荐(0)
摘要:机器上有N个需要处理的任务,它们构成了一个序列。这些任务被标号为1到N,因此序列的排列为1,2,3...N。这N个任务被分成若干批,每批包含相邻的若干任务。从时刻0开始,这些任务被分批加工,第i个任务单独完成所需的时间是Ti。在每批任务开始前,机器需要启动时间S,而完成这批任务所需的时间是各个任务需 阅读全文
posted @ 2018-06-29 17:57 nimphy 阅读(520) 评论(0) 推荐(0)
摘要:The sequence of integers a1,a2,…,aka1,a2,…,ak is called a good array if a1=k−1a1=k−1 and a1>0a1>0. For example, the sequences [3,−1,44,0],[1,−99][3,−1 阅读全文
posted @ 2018-06-28 15:17 nimphy 阅读(827) 评论(0) 推荐(0)