题目传送门 /* 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…
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…
题目链接: 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…
解题报告:输入一个数列,选取一个子数列,要求最多只能改动这个子数列中的一个数,使得这个子数列是严格的升序的(严格升序没有相等的) 我的做法是,第一步把这个 数列的每个升序的子数列都找出来,然后看这些子数列能不能和跟它相邻的升序的子数列连接起来. #include<cstdio> #include<cstring> #include<iostream> #include<algorithm> #include<cmath> using namesp…
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…
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://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…
DZY has a hash table with p buckets, numbered from 0 to p - 1. He wants to insert n numbers, in the order they are given, into the hash table. For the i-th number xi, DZY will put it into the bucket numbered h(xi), where h(x) is the hash function. In…