题目要求选择一些花的集合,如果暴力去枚举每种选择方法明显是不行的.换种方式考虑:每一个集合都能为最后的答案做出要么正的.要么负的.要么0贡献,先把所有集合能做出的贡献预处理,然后从m个集合里面选择贡献为正的即可. AC代码: #include<cstdio> const int maxn=100+5; struct node{ int l,r; int ans; }b[maxn]; int a[maxn]; int main(){ int n,m; while(scanf("%d%d…
Alyona and flowers CodeForces - 740B Little Alyona is celebrating Happy Birthday! Her mother has an array of n flowers. Each flower has some mood, the mood of i-th flower is ai. The mood can be positive, zero or negative. Let's define a subarray as a…