转载请注明出处: http://www.cnblogs.com/fraud/          ——by fraud  Bubble Sort Graph Iahub recently has learned Bubble Sort, an algorithm that is used to sort a permutation with n elements a1, a2, ..., an in ascending order. He is bored of this so simple al…
D. Bubble Sort Graph time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Iahub recently has learned Bubble Sort, an algorithm that is used to sort a permutation with n elements a1, a2, ..., an …
Codeforces 题目传送门 & 洛谷题目传送门 这是一道 *2500 的 D1C,可个人认为难度堪比某些 *2700 *2800. 不过嘛,*2500 终究还是 *2500,还是被我自己想出来了 双倍经验 P4448 [AHOI2018初中组]球球的排列 哦 u1s1 其实一年以前做过 P4448,不过好像直到我 AC 这道题之后才发现这俩题一模一样,并且似乎这次用的方法和上次还不太一样 跑题了跑题了 首先有个性质:\(\forall a,b,c\in\mathbb{N}^+\) 若 \(…
最少拦截系统 Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 19172    Accepted Submission(s): 7600 Problem Description 某 国为了防御敌国的导弹袭击,发展出一种导弹拦截系统.但是这种导弹拦截系统有一个缺陷:虽然它的第一发炮弹能够到达任意的高度,但是以后每一发炮弹都不能 超过前一发的…
题意:给定一个长度为n的序列,让你求一个和最大递增序列. 析:一看,是不是很像LIS啊,这基本就是一样的,只不过改一下而已,d(i)表示前i个数中,最大的和并且是递增的, 如果 d(j) + a[i] > d(i)  d(i) = d(j) + a[i] (这是保证和最大),那么怎么是递增呢?很简单嘛,和LIS一样 再加上a[i] > a[j],这不就OK了. 代码如下: #include <cstdio> #include <iostream> #include &l…
E. Pencils and Boxes time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Mishka received a gift of multicolored pencils for his birthday! Unfortunately he lives in a monochrome world, where ev…
Problem Description In computer science, the longest increasing subsequence problem is to find a subsequence of a given sequence in which the subsequence's elements are in sorted order, lowest to highest, and in which the subsequence is as long as po…
Language: Default Longest Ordered Subsequence Time Limit: 2000MS   Memory Limit: 65536K Total Submissions: 33986   Accepted: 14892 Description A numeric sequence of ai is ordered if a1 < a2 < ... < aN. Let the subsequence of the given numeric seq…
Bubble Sort Graph CodeForces - 340D 题意: 给出一个n个数的数列,建一个只有n个结点没有边的无向图,对数列进行冒泡排序,每交换一对位置在(i,j)的数在点i和点j间连一条边.排序完后,求得到图的最大独立集. 解释: 最初想到的是图的最大独立集,认为不能解,于是就没辙了... 然而应当仔细分析题目(不容易想到):题意很容易知道是在每一对逆序对间连一条边.也就是说,对于a[i],向a[i]右侧比其小的和a[i]左侧比其大的都要连一条边.也就是说,只要选了结点i,那…
洛谷P2507 [SCOI2008]配对 题解(dp+贪心) 标签:题解 阅读体验:https://zybuluo.com/Junlier/note/1299251 链接题目地址:洛谷P2507 [SCOI2008]配对 感觉是道很好的推断题 贪心 想到贪心的结论就很容易,没想到就很难做出来了 结论:对\(A,B\)数组分别排序之后,在\(A\)中选第\(i\)个数,与之配对的数一定在\(B[i-1]\)~\(B[i+1]\)内 其实证明是很好证的,在与你是否往这方面想了... 因为题目有一个很…