Live2d Test Env

随笔分类 -  排序

1
摘要:链接:https://ac.nowcoder.com/acm/contest/926/D来源:牛客网 在一维坐标系中,给定 n条有颜色的线段,第 i条线段的左右端点分别为 li​和 ri​,此外它的颜色为 ci​。 给定m个查询,每个查询给定一个区间 [a,b],需要求出这个区间完全包含的线段中有多 阅读全文
posted @ 2019-08-20 21:51 nimphy 阅读(208) 评论(0) 推荐(0) 编辑
摘要:pro:给定平面上N条直线,保证没有直线和Y轴平行。 求有多少交点的X坐标落在(L,R)开区间之间,注意在x=L或者R处的不算。 sol:求出每条直线与L和R的交点,如果A直线和B直线在(L,R)相交,一定有Xa<Xb而且Ya>Yb(或相反);那么即是求逆序对。 阅读全文
posted @ 2019-06-08 10:11 nimphy 阅读(168) 评论(0) 推荐(1) 编辑
摘要:4033: [HAOI2015]树上染色 Description 有一棵点数为N的树,树边有边权。给你一个在0~N之内的正整数K,你要在这棵树中选择K个点,将其染成黑色,并 将其他的N-K个点染成白色。将所有点染色后,你会获得黑点两两之间的距离加上白点两两之间距离的和的收益。 问收益最大值是多少。 阅读全文
posted @ 2018-11-19 11:05 nimphy 阅读(281) 评论(0) 推荐(0) 编辑
摘要:4978: [Lydsy1708月赛]泛化物品 Description 泛化物品是背包问题里的一个概念,泛化物品并没有固定的体积和费用,而是它的费用随着分配给它的体积而变化 。在背包容量为V-1的背包问题中,泛化物品是一个定义域为[0,V)中的整数的函数h,当分配给它的体积为v时,花 费的费用就是h 阅读全文
posted @ 2018-11-18 09:43 nimphy 阅读(298) 评论(0) 推荐(0) 编辑
摘要:4977: [[Lydsy1708月赛]跳伞求生 Description 小Q最近沉迷于《跳伞求生》游戏。他组建了一支由n名玩家(包括他自己)组成的战队,编号依次为1到n。这个游 戏中,每局游戏开始时,所有玩家都会从飞机上跳伞,选择一个目的地降落,跳伞和降落的时间有早有晚。在某局 游戏降落前,他们在 阅读全文
posted @ 2018-11-17 09:55 nimphy 阅读(225) 评论(0) 推荐(0) 编辑
摘要:5142: [Usaco2017 Dec]Haybale Feast Description Farmer John is preparing a delicious meal for his cows! In his barn, he has NN haybales (1≤N≤100,0 00). 阅读全文
posted @ 2018-11-14 16:03 nimphy 阅读(242) 评论(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 阅读(450) 评论(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 阅读(342) 评论(0) 推荐(0) 编辑
摘要:题意:给定N的棒棒,K种颜色,每个棒棒的两端可以涂色。现在已知所有的线段要么有一端涂色,要么两端都没有涂色,现在要求把所有的没涂色的部分涂色,使得我们可以把涂色后的棒棒分为N/K组,每组的涂色情况相同。 思路:把没有颜色的棒子,看成一端涂色为0,那么现在每个线段都有一端涂色。我们按照数量来排序,然后 阅读全文
posted @ 2018-08-20 10:28 nimphy 阅读(369) 评论(0) 推荐(0) 编辑
摘要:题意:给定一个N点M边的有向图,叫你加最多K条边,使得最小拓扑序最大. 思路:不是那么简单的题. 参照了别人的代码, 最后想通了. 贪心原则: 用两个单调队列维护, 第一个序列S1单增, 表示当前入度为0的点 ; 第二个序列S2单减,表示需要加边的点. 如果S1的最大值大于S2的最大值,则对其加边. 阅读全文
posted @ 2018-08-12 11:38 nimphy 阅读(309) 评论(0) 推荐(0) 编辑
摘要:In the lattice points of the coordinate line there are n radio stations, the i-th of which is described by three integers: xi — the coordinate of the  阅读全文
posted @ 2018-05-31 16:54 nimphy 阅读(291) 评论(0) 推荐(0) 编辑
摘要:Given a sequence of N pairs of integers, find the length of the longest increasing subsequence of it. An increasing sequence A1..An is a sequence such 阅读全文
posted @ 2018-05-28 22:16 nimphy 阅读(269) 评论(0) 推荐(0) 编辑
摘要:Taplu and Abhishar loved playing scrabble. One day they thought of inventing a new game using alphabet tiles. Abhishar wrote a string using tiles and 阅读全文
posted @ 2018-05-25 17:08 nimphy 阅读(439) 评论(0) 推荐(0) 编辑
摘要:描述 小Hi和小Ho正在进行一项基因工程实验。他们要修改一段长度为N的DNA序列,使得这段DNA上最前面的K个碱基组成的序列与最后面的K个碱基组成的序列完全一致。 例如对于序列"ATCGATAC"和K=2,可以通过将第二个碱基修改为"C"使得最前面2个碱基与最后面两个碱基都为"AC"。当然还存在其他 阅读全文
posted @ 2017-12-05 10:07 nimphy 阅读(297) 评论(0) 推荐(0) 编辑
摘要:第1行为1个整数N,表示需要处理的事件数目。 接下来的M行,每行描述一个事件,且事件类型由该行的第一个字符表示,如果为'A',表示小Ho将一粒糖果放进了盒子,且接下来为一个整数W,表示这颗糖果的重量;如果为'T',表示小Ho需要知道当前盒子中最重的糖果的重量是多少,在知道这个值之后,小Ho会将这颗糖 阅读全文
posted @ 2017-11-28 23:56 nimphy 阅读(181) 评论(0) 推荐(0) 编辑
摘要:传送门:ZOJ1181 思路:自身排序来判断两个字符串拥有相同的字符。 #include#include#include#include#include#include#include#includeusi... 阅读全文
posted @ 2017-09-27 21:06 nimphy 阅读(127) 评论(0) 推荐(0) 编辑
摘要:FatMouse's SpeedTime Limit: 2 Seconds Memory Limit:65536 KB Special Judge FatMouse believes that the fatter a mouse is, the faster it runs. To disprov 阅读全文
posted @ 2017-09-27 21:06 nimphy 阅读(246) 评论(0) 推荐(0) 编辑
摘要:JAVAMAN is visiting Dream City and he sees a yard of gold coin trees. There aren trees in the yard. Let's call them tree 1, tree 2 ...and treen. At th 阅读全文
posted @ 2017-09-27 21:06 nimphy 阅读(125) 评论(0) 推荐(0) 编辑
摘要:Connect themTime Limit: 1 Second Memory Limit:32768 KBYou have n computers numbered from 1 ton and you want to connect them to make a small local... 阅读全文
posted @ 2017-09-27 21:06 nimphy 阅读(138) 评论(0) 推荐(0) 编辑
摘要:Seven-Segment DisplayTime Limit: 1 Second Memory Limit:65536 KBA seven segment display, or seven segment indicator, is a form of electronic displ... 阅读全文
posted @ 2017-09-27 21:06 nimphy 阅读(135) 评论(0) 推荐(0) 编辑

1
点击右上角即可分享
微信分享提示