C. Epidemic in Monstropolis】的更多相关文章

C. Epidemic in Monstropolis time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output There was an epidemic in Monstropolis and all monsters became sick. To recover, all monsters lined up in queue fo…
C. Epidemic in Monstropolis time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output There was an epidemic in Monstropolis and all monsters became sick. To recover, all monsters lined up in queue fo…
Epidemic in Monstropolis 题目链接:http://codeforces.com/contest/733/problem/C 贪心 新序列的m个数肯定是由原序列的连续的m个子序列构成的,只需要找到每个连续子序列中最大的数即可. 细节中需要注意:一个连续子序列可能有很多个最大数,最大数的左右两个数必须要有一个小于这个数:还有下标的处理. 代码如下: import sys n = int(input()) a = [int(x) for x in input().split()…
C. Epidemic in Monstropolis time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output There was an epidemic in Monstropolis and all monsters became sick. To recover, all monsters lined up in queue fo…
time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard output There was an epidemic in Monstropolis and all monsters became sick. To recover, all monsters lined up in queue for an appointment to the only doc…
题意 现在有一个怪兽序列a[i],权值大的怪兽可以吃权值小的怪兽,吃完之后权值大的怪兽的权值会变成两者权值的和,相邻的怪兽才能吃 吃完之后,位置合并,队列前移,从左到右重新编号,重复这一过程, 然后给你一个怪兽序列b[i],问你a[i]怎么操作能变成b[i],如果能操作,输出操作序列,如果不能操作就输出NO 难点一,划分序列,由于b[i]的概念类似于前缀和,一旦b[i]是确定的数,那么a[i]序列的划分就是唯一的,b[i]和a[i]的和相等 b[i]序列实际上就是对序列a[i]的唯一划分 难点二…
http://codeforces.com/problemset/problem/733/C 题意:给出一个序列的怪兽体积 ai,怪兽只能吃相邻的怪兽,并且只有体积严格大于相邻的怪兽才能吃,吃完之后,这只怪兽的体积会变成原体积 + 吃的怪兽的体积,接下来给出 k 个怪兽的体积 bi,问能不能满足经过一系列操作后让剩下的怪兽体积变得满足下面的序列. 思路:昨晚想的时候觉得好复杂,今天补题发现实际上只有一种情况,就是每一个区间里的怪兽体积对应于一个 bi,然后拆成 k 个区间,分别找区间里面最大的去…
模拟. 连续的一段$a$合成一个$b$.每段中如果数字只有$1$个,那么可以合成.如果数字个数大于等于$2$个,如果都是一样的,那么无法合成,否则要找到一个可以移动的最大值位置开始移动.一开始写了一个模拟,没考虑到严格大于,$WA$在$106$组数据了...... #pragma comment(linker, "/STACK:1024000000,1024000000") #include<cstdio> #include<cstring> #include&…
http://codeforces.com/contest/733/problem/C 一道很恶心的模拟题. 注意到如果能凑成b[1],那么a的前缀和一定是有一个满足是b[1]的,因为,如果跳过了一些前面的数不用,就会剩下一个多余的东西在哪里.所以就是把a数组分成了若干段,判断每一段是否凑成b[i]了, 能凑成b[i]的条件是: 这一段a[]中,最大值的左边或者右边要有一个比它小,然后吃了它,就能吃全部了. 注意当只有1个的时候,是一定是true的.不用吃其他了, 剩下的就是恶心的模拟了,因为它…
A. Grasshopper And the String time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output One day, the Grasshopper was jumping on the lawn and found a piece of paper with a string. Grasshopper became i…