http://codeforces.com/contest/447/problem/E 题意: 给定一个数组, m次操作, 1 l r 表示区间修改, 每次 a[i] +  Fibonacci[i-l+] 2 l r 区间求和 每次修改操作,只需要记录 每个点前两个值就可以了, 后面的和以及孩子需要加的值都可以通过这两个求出来. 推推公式就出来了. 注意 溢出. #include <bits/stdc++.h> using namespace std; typedef long long LL…
题目传送门 /* DP:先用l,r数组记录前缀后缀上升长度,最大值会在三种情况中产生: 1. a[i-1] + 1 < a[i+1],可以改a[i],那么值为l[i-1] + r[i+1] + 1 2. l[i-1] + 1 3. r[i+1] + 1 //修改a[i] */ #include <cstdio> #include <algorithm> #include <cstring> using namespace std; ; const int INF…
DZY Loves Fibonacci Numbers Time Limit:4000MS     Memory Limit:262144KB     64bit IO Format:%I64d & %I64u Submit Status Appoint description:  System Crawler  (2014-07-14) Description In mathematical terms, the sequence Fn of Fibonacci numbers is defi…
题目:DZY Loves Fibonacci Numbers 题意比較简单,不解释了. 尽管官方的题解也是用线段树,但还利用了二次剩余. 可是我没有想到二次剩余,然后写了个感觉非常复杂度的线段树,还是mark一下吧. 我是这样考虑这个问题的,首先准备三个数组F,G,K,功能后面解释. 然后对它们有这样一个计算: F[0] = G[0] = 0; F[1] = 1; G[1] = 0; K[0] = 1; K[1] = 0; for(int i=2; i<N; i++){ F[i] = (F[i-…
B. DZY Loves Modification 题目连接: http://www.codeforces.com/contest/446/problem/B Description As we know, DZY loves playing games. One day DZY decided to play with a n × m matrix. To be more precise, he decided to modify the matrix with exactly k opera…
A. DZY Loves Sequences 题目连接: http://www.codeforces.com/contest/446/problem/A Description DZY has a sequence a, consisting of n integers. We'll call a sequence ai, ai + 1, ..., aj (1 ≤ i ≤ j ≤ n) a subsegment of the sequence a. The value (j - i + 1) d…
D. DZY Loves Modification time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output As we know, DZY loves playing games. One day DZY decided to play with a n × m matrix. To be more precise, he decid…
枚举行取了多少次,如行取了i次,列就取了k-i次,假设行列单独贪心考虑然后相加,那么有i*(k-i)个交点是多出来的:dpr[i]+dpc[k-i]-i*(k-i)*p 枚举i取最大值.... B. DZY Loves Modification time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output As we know, DZY l…
B. DZY Loves Strings time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output DZY loves collecting special strings which only contain lowercase letters. For each lowercase letter c DZY knows its val…
题目链接: http://www.codeforces.com/contest/446/problem/A 题解: dp1[x]表示以x结尾的最大严格升序连续串,dp2[x]表示以x开头的最大严格升序连续串 #include<iostream> #include<cstdio> #include<cstring> #include<map> #include<list> #include<stack> #include<algo…