#define HAVE_STRUCT_TIMESPEC
#include<bits/stdc++.h>
using namespace std;
const long long mod = 1e9+;
long long pre[][],temp[][];
int main(){
ios::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
int n,m;
cin>>n>>m;
for(int i=;i<=n;++i){
pre[][i]=;
temp[][i]=;
}
for(int i=;i<=m;++i)//当前位
for(int j=;j<=n;++j)//第i位以数字j结尾
for(int k=;k<=j;++k)//保证非降序
pre[i][j]=(pre[i][j]+pre[i-][k])%mod;//状态转移
for(int i=;i<=m;++i)//当前位
for(int j=;j<=n;++j)//第i位以数字j结尾
for(int k=j;k<=n;++k)//保证非升序
temp[i][j]=(temp[i][j]+temp[i-][k])%mod;//状态转移
long long ans=;
for(int i=;i<=n;++i)//枚举第二个数组以数字i作为结尾
for(int j=;j<=i;++j)//枚举第一个数组以数字j作为结尾,j<=i保证了第一个数组最大的都小于等于第二个数组最小的,所以整个数组全部满足小于等于关系
ans=(ans+(temp[m][i]*pre[m][j])%mod)%mod;//相乘得到答案
cout<<ans;
return ;
}

Educational Codeforces Round 80 (Rated for Div. 2)C(DP)的更多相关文章

  1. Educational Codeforces Round 80 (Rated for Div. 2)E(树状数组,模拟,思维)

    #define HAVE_STRUCT_TIMESPEC #include<bits/stdc++.h> using namespace std; ],mx[],a[],pos[],sum ...

  2. Educational Codeforces Round 80 (Rated for Div. 2)D(二分答案,状压检验)

    这题1<<M为255,可以logN二分答案后,N*M扫一遍表把N行数据转化为一个小于等于255的数字,再255^2检验答案(比扫一遍表复杂度低),复杂度约为N*M*logN #define ...

  3. Educational Codeforces Round 57 (Rated for Div. 2)D(动态规划)

    #include<bits/stdc++.h>using namespace std;char s[100007];long long a[100007];long long dp[100 ...

  4. Educational Codeforces Round 79 (Rated for Div. 2) Finished (A-D)

    如果最大值比剩余两个加起来的总和+1还大,就是NO,否则是YES #include<bits/stdc++.h> using namespace std; int main(){ int ...

  5. Educational Codeforces Round 82 (Rated for Div. 2)E(DP,序列自动机)

    #define HAVE_STRUCT_TIMESPEC #include<bits/stdc++.h> using namespace std; ],t[]; int n,m; ][]; ...

  6. Educational Codeforces Round 82 (Rated for Div. 2)D(模拟)

    从低位到高位枚举,当前位没有就去高位找到有的将其一步步拆分,当前位多余的合并到更高一位 #define HAVE_STRUCT_TIMESPEC #include<bits/stdc++.h&g ...

  7. Educational Codeforces Round 75 (Rated for Div. 2)D(二分)

    #define HAVE_STRUCT_TIMESPEC#include<bits/stdc++.h>using namespace std;pair<int,int>a[20 ...

  8. Educational Codeforces Round 73 (Rated for Div. 2)D(DP,思维)

    #define HAVE_STRUCT_TIMESPEC#include<bits/stdc++.h>using namespace std;long long a[300007],b[3 ...

  9. Educational Codeforces Round 72 (Rated for Div. 2)C(暴力)

    #define HAVE_STRUCT_TIMESPEC#include<bits/stdc++.h>using namespace std;char s[200007];int a[20 ...

随机推荐

  1. Codeforces1295D. Same GCDs (欧拉函数)

    https://codeforces.com/contest/1295/problem/D 设gcd(a,m)= n,那么找gcd(a +x ,m)= n个数,其实就等于找gcd((a+x)/n,m/ ...

  2. SpringBoot学习- 8、整合Shiro

    SpringBoot学习足迹 Shiro是什么,引自百度百科:Apache Shiro是一个强大且易用的Java安全框架,执行身份验证.授权.密码和会话管理.使用Shiro的易于理解的API,您可以快 ...

  3. 生成器和迭代器_python

    一.生成器简介(generator) 在进行较大数据的存储,如果直接存储在列表之中,则会可能造成内存的不够与速度的减慢,因为列表创建完是立即创建并存在的,而在python中生成器(generator) ...

  4. Django教程(1)

    增加新的视图: 1. 在app/view.py下增加调用视图函数 def horizonG(request): return render(request, 'horizonG.html') 2. 在 ...

  5. [CF]Round 516

    A Make a triangle! 题意:给定三根线段,问最少要延长多少才能拼成一个三角形. 数学题. B Equations of Mathematical Magic 题意:求$a - (a \ ...

  6. PHP multipart/form-data 远程DOS漏洞

    import sys import urllib,urllib2 import datetime from optparse import OptionParser def http_proxy(pr ...

  7. android button setMinHeight setMinWidth 无效解决办法

    setMinWidth(0);setMinHeight(0);setMinimumWidth(0);//必须同时设置这个setMinimumHeight(0);//必须同时设置这个 两个方法同时设置才 ...

  8. C++-POJ1988-Cube Stacking[数据结构][并查集]

    int find(int x){return fa[x]==x?x:fa[x]=find(fa[x]);} #include <set> #include <map> #inc ...

  9. AcWing 793. 高精度乘法

    https://www.acwing.com/problem/content/795/ #include<bits/stdc++.h> using namespace std; //A*b ...

  10. numpy特性

    numpy特性 待办 可获取最小值最大值或者排序等操作的索引,然后通过索引取得对应值或者对应值的序列 按行按列求和.按行按列求积 方差等等统计函数使用 enter description here e ...