【USTC女生赛校内选拔】管道
You cannot submit for this problem because the contest is ended. You can click "Open in Problem Set" to view this problem in normal mode.
题目描述
L 形管道排成 行 列,每个管道有 4 种摆放方式:
第 行第 个管道的权值为 ,注意权值不一定为正。
如果两个相邻的管道接口相连,那么会产生两管道权值和的价值,但如果权值和为负数,贡献为 。
你现在可以任意调整管道的摆放方式,请求出最大可能的价值和。
输入格式
- 第一行两个整数 。
- 接下来 行,每行 个整数,第 行第 个数表示 。
输出格式
- 一个数,表示最大价值。
样例
Input 1
1 7
15 -5 100 -40 10 10 10
Output 1
115
Input 2
3 3
-10 4 -10
3 1 -10
6 2 8
Output 2
28
样例解释
样例解释 1
这是一种可能的最优方案,总价值为 。
样例解释 2
数据范围
。
2024 CCPC 女生赛选拔
- Status
- Done
- Rule
- ACM/ICPC
- Problem
- 8
- Start at
- 2024-10-13 8:30
- End at
- 2024-10-13 11:30
- Duration
- 3 hour(s)
- Host
- Partic.
- 10