[链接] 我是链接,点我呀:) [题意] 让你把数组分成k个连续的部分 使得每个部分最大的m个数字的和最大 [题解] 把原数组降序排序 然后选取前m*k个数字打标记 然后对于原数组 一直贪心地取 直到这个区间选了m个打标记的数字为止. 然后就划分一个区间>_< [代码] import java.io.*; import java.util.*; public class Main { static int N = (int)2e5; static InputReader in; static…
time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard output Recently Maxim has found an array of n integers, needed by no one. He immediately come up with idea of changing it: he invented positive integer…
time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard output One spring day on his way to university Lesha found an array A. Lesha likes to split arrays into several parts. This time Lesha decided to split…
[题目链接] http://codeforces.com/contest/451/problem/B [算法] 模拟 在序列中找到一段单调递增的子序列,将这段序列反转,然后判断序列是否变得单调递增,即可 [代码] #include<bits/stdc++.h> using namespace std; ; int i,n,l,r; bool flag; int a[MAXN]; int main() { scanf("%d",&n); ; i <= n; i+…
[题目链接]:http://codeforces.com/contest/719/problem/E [题意] 给你一个数列,有两种操作1 l r x 给[l,r]区间上的数加上x, 2 l r 询问[l,r]区间fibonacci数列的和(f[l]+f[l+1]+--f[r]) [题解] 斐波那契数列有个矩阵乘法公式 f[n]= [0 1] ^n× [0 0] [1 1] [0 1] 最后得到的矩阵A A[1][2]就是答案;(即第一行第二列) 写个线段树的成段更新; 用懒惰标记记录加上的数字…
time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard output This is an interactive problem. You should use flush operation after each printed line. For example, in C++ you should use fflush(stdout), in Jav…
[链接] 我是链接,点我呀:) [题意] 题意 [题解] 把a[i]处理成前缀和 离散化. 枚举i从1..n假设a[i]是区间和的a[r] 显然我们需要找到a[r]-a[l]<t的l的个数 即a[r]<t+a[l] 那么我们处理完每个i之后,每次把a[i]+t加入到树状数组中去. 每次以进入i的时候,找到比a[r]大的a[l]+t的个数就好(用树状数组求和即可) [代码] #include <bits/stdc++.h> #define ll long long using nam…
任意门:http://codeforces.com/contest/1114/problem/B B. Yet Another Array Partitioning Task time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output An array bb is called to be a subarray of aa if it f…
[codeforces 415D]Mashmokh and ACM 题意:美丽数列定义:对于数列中的每一个i都满足:arr[i+1]%arr[i]==0 输入n,k(1<=n,k<=2000),问满足[数列长度是k && 数列中每一个元素arr[i]在1~n之间 && 数列中元素可以重复]的数列有多少个?结果对10^9+7取余 解题思路:dp[i][j]表示长度是j,最后一位是i的种数 if(kk%i==0) dp[kk][j+1]+=dp[i][j] #inc…
B. Yet Another Array Partitioning Task time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output An array bb is called to be a subarray of aa if it forms a continuous subsequence of aa , that is, if…