题目链接http://codeforces.com/contest/762/problem/D

多多分析状态;这个很明了

#include<bits/stdc++.h>
using namespace std;
#pragma comment(linker, "/STACK:102400000,102400000")
#define ls i<<1
#define rs ls | 1
#define mid ((ll+rr)>>1)
#define pii pair<LL,int>
#define MP make_pair
typedef long long LL;
const long long INF = 1e18;
const double Pi = acos(-1.0);
const int N = 1e6+, M = 2e6+, mod = 1e9+, inf = 2e9; void update(LL &x,const LL &y) {
if(x < y) x = y;
}
LL a[][N],dp[][N];
int n;
int main() {
scanf("%d",&n);
for(int i = ; i < ; ++i)
for(int j = ; j <= n; ++j) scanf("%I64d",&a[i][j]);
for(int i = ; i < ; ++i)
for(int j = ; j <= n; ++j) dp[i][j] = -INF;
dp[][] = ;
for(int i = ; i <= n; ++i) {
update(dp[][i],dp[][i-]+a[][i]);
update(dp[][i],dp[][i-]+a[][i]+a[][i]);
update(dp[][i],dp[][i-]+a[][i]+a[][i]+a[][i]);
update(dp[][i],dp[][i-]+a[][i]+a[][i]+a[][i]); update(dp[][i],dp[][i-]+a[][i]);
update(dp[][i],dp[][i-]+a[][i]+a[][i]);
update(dp[][i],dp[][i-]+a[][i]+a[][i]); update(dp[][i],dp[][i-]+a[][i]);
update(dp[][i],dp[][i-]+a[][i]+a[][i]);
update(dp[][i],dp[][i-]+a[][i]+a[][i]+a[][i]);
update(dp[][i],dp[][i-]+a[][i]+a[][i]+a[][i]); update(dp[][i],dp[][i-]+a[][i]+a[][i]+a[][i]);
update(dp[][i],dp[][i-]+a[][i]+a[][i]+a[][i]);
}
printf("%I64d\n",dp[][n]);
return ;
}

Educational Codeforces Round 17 D. Maximum path DP的更多相关文章

  1. Educational Codeforces Round 17

    Educational Codeforces Round 17 A. k-th divisor 水题,把所有因子找出来排序然后找第\(k\)大 view code //#pragma GCC opti ...

  2. Educational Codeforces Round 9 D. Longest Subsequence dp

    D. Longest Subsequence 题目连接: http://www.codeforces.com/contest/632/problem/D Description You are giv ...

  3. Codeforces Educational Codeforces Round 15 A. Maximum Increase

    A. Maximum Increase time limit per test 1 second memory limit per test 256 megabytes input standard ...

  4. Educational Codeforces Round 61 F 思维 + 区间dp

    https://codeforces.com/contest/1132/problem/F 思维 + 区间dp 题意 给一个长度为n的字符串(<=500),每次选择消去字符,连续相同的字符可以同 ...

  5. Educational Codeforces Round 51 D. Bicolorings(dp)

    https://codeforces.com/contest/1051/problem/D 题意 一个2*n的矩阵,你可以用黑白格子去填充他,求联通块数目等于k的方案数,答案%998244353. 思 ...

  6. Educational Codeforces Round 1 E. Chocolate Bar dp

    题目链接:http://codeforces.com/contest/598/problem/E E. Chocolate Bar time limit per test 2 seconds memo ...

  7. Educational Codeforces Round 17 颓废记

    又被虐了... (记一次惨痛的Codeforces) 好不容易登上去了Codeforces,22:35准时开打 第一题,一看:这不SB题嘛?直接枚举因数上啊.9min才过掉了pretest 第二题.. ...

  8. Educational Codeforces Round 32 E. Maximum Subsequence

    题目链接 题意:给你两个数n,m,和一个大小为n的数组. 让你在数组找一些数使得这些数的和模m最大. 解法:考虑 dfs但是,数据范围不允许纯暴力,那考虑一下折半搜索,一个从头开始往中间搜,一个从后往 ...

  9. Educational Codeforces Round 17 C. Two strings 打表二分

    C. Two strings time limit per test 2 seconds memory limit per test 256 megabytes input standard inpu ...

随机推荐

  1. Django 再次学习笔记整理

    url 路由系统 urlpatterns = [ # path('admin/', admin.site.urls), path('index/', views.index), re_path('^e ...

  2. 杭电 1241 Oil Deposits (很好的dfs)

    Description The GeoSurvComp geologic survey company is responsible for detecting underground oil dep ...

  3. java中如何将string转化成long

  4. BGP表

    BGP是一种基于策略的路由选择协议,让AS能够根据多种BGP属性来控制数据流的传输.运行BGP的路由器交换被称为路径矢量或者属性的NLRI.路径矢量信息中包含一个BGP-AS号列表称为AS-PATH属 ...

  5. CodeForces - 592D Super M 题解

    题目大意: 一棵树 n个点 有m个点被标记 求经过所有被标记的点的最短路径的长度以及起点(如有多条输出编号最小的起点). 思路: 1.当且仅当一个点本身或其子树中有点被标记时该点在最短的路径上因此,可 ...

  6. JS获取服务器时间并且计算距离当前指定时间差的函数

    项目中遇到了从服务器获取时间,现在记录一下方便以后查询: 1.后台代码:(创建一个date对象并以JSON的形式返回去) // 获取服务器时间 public String getNowServerTi ...

  7. msp430项目编程22

    msp430中项目---充电控制系统 1.定时器工作原理 2.电路原理说明 3.代码(显示部分) 4.代码(功能实现) 5.项目总结 msp430项目编程 msp430入门学习

  8. 微服务架构的基础框架选择:Spring Cloud还是Dubbo?

    本文转自:http://mt.sohu.com/20160803/n462486707.shtml 最近一段时间不论互联网还是传统行业,凡是涉及信息技术范畴的圈子几乎都在讨论 微服务架构 .近期也看到 ...

  9. ACM-ICPC 2018 焦作赛区网络预赛 H、L

    https://nanti.jisuanke.com/t/31721 题意 n个位置 有几个限制相邻的三个怎么怎么样,直接从3开始 矩阵快速幂进行递推就可以了 #include <bits/st ...

  10. HUD——1083 Courses

    HUD——1083   Courses Time Limit: 20000/10000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Ot ...