Sequence II Time Limit: 5000/2500 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 652    Accepted Submission(s): 164 Problem Description Long long ago, there is a sequence A with length n. All numbers in this sequenc…
Sequence II Time Limit: 5000/2500 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Problem Description Long long ago, there is a sequence A with length n. All numbers in this sequence is no smaller than 1 and no bigger than n, and all nu…
题目链接 Sequence II Time Limit: 5000/2500 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 331    Accepted Submission(s): 151 Problem Description Long long ago, there is a sequence A with length n. All numbers in this se…
传送门 E.sequence •题意 定义序列 p 中的 "good",只要 i 之前存在 pj < pi,那么,pi就是 "good": 求删除一个数,使得序列中 "good" 的个数最多: •题解 一个数 pi 对 "good" 的贡献有两个来源: ①pi 本身为"good",对答案的贡献为 1: ②删除 pi 后,i 之后的本来是 "good" 的数因为 pi 被删除而变成非…
题意: 有点迷.有一些点,Stan先选择某个点,经过这个点画一条竖线,Ollie选择一个经过这条直接的点画一条横线.Stan选这两条直线分成的左下和右上部分的点,Ollie选左上和右下部分的点.Stan画一条竖线之后,Ollie有很多种选择,在所有选择中,Stan能获得 “分数最小值的最大值” ,而Ollie的选择便是让自己越多越好.问最后Stan最多能得到的分数是多少,以及在这种情况下Ollie能得到的分数有多少种可能. 解法: 因为Stan先选,然后主动权在Ollie手中,Ollie会优先让…
题意:给出n个数,再给出q个询问,求L到R的逆序对的个数 先自己写的时候,是每次询问都重新插入来求sum(r)-sum(l) 果断T 后来还是看了别人的代码---- 预处理一下,把所有可能的区间的询问都求出来(1000*1000), 然后询问就是O(1)了 然后想自己这样写超时,是因为询问太多了---- #include<iostream> #include<cstdio> #include<cstring> #include <cmath> #includ…
题目描述 约翰家的 N 头奶牛正在排队游行抗议.一些奶牛情绪激动,约翰测算下来,排在第 i 位的奶牛 的理智度为 A i ,数字可正可负. 约翰希望奶牛在抗议时保持理性,为此,他打算将这条队伍分割成几个小组,每个抗议小组的理 智度之和必须大于或等于零.奶牛的队伍已经固定了前后顺序,所以不能交换它们的位置,所以分在 一个小组里的奶牛必须是连续位置的.除此之外,分组多少组,每组分多少奶牛,都没有限制. 约翰想知道有多少种分组的方案,由于答案可能很大,只要输出答案除以 1000000009 的余数即…
Sereja has a sequence that consists of n positive integers, a1, a2, ..., an. First Sereja took a piece of squared paper and wrote all distinct non-empty non-decreasing subsequences of sequence a. Then for each sequence written on the squared paper, S…
题目链接: Codeforces261D 题目大意:$k$次询问,每次给出一个长度为$n$的序列$b$及$b$中的最大值$maxb$,构造出序列$a$为$t$个序列$b$连接而成,求$a$的最长上升子序列.$n,maxb\le10^5,maxb*n\le2*10^7,t\le10^9$. 设$b$中不同数的个数为$sum$.如果$sum\le t$,那么答案就是$sum$(只需要从第$i$个序列$b$中取第$i$小的数即可).现在只需要考虑$t<sum$的情况,因为$sum\le maxb$,所…
Increasing Speed Limits Time Limit: 2000/10000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 481    Accepted Submission(s): 245 Problem Description You were driving along a highway when you got caught by the road p…