cf1809e(edu145e)
1 /*
2 _ooOoo_
3 o8888888o
4 88" . "88
5 (| -_- |)
6 O\ = /O
7 ____/`---'\____
8 .' \\| |// `.
9 / \\||| : |||// \
10 / _||||| -:- |||||- \
11 | | \\\ - /// | |
12 | \_| ''\---/'' | |
13 \ .-\__ `-` ___/-. /
14 ___`. .' /--.--\ `. . __
15 ."" '< `.___\_<|>_/___.' >'"".
16 | | : `- \`.;`\ _ /`;.`/ - ` : | |
17 \ \ `-. \_ __\ /__ _/ .-` / /
18 ======`-.____`-.___\_____/___.-`____.-'======
19 `=---='
20 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
21 AC 护体
22 */
23
24 #include <bits/stdc++.h>
25 #define for_(i,a,b) for (int i = (a); i < (b); i++)
26 #define rep_(i,a,b) for (int i = (a); i <= (b); i++)
27 #define per_(i,a,b) for (int i = (a); i >= (b); i--)
28 #define ll long long
29 #define pii pair<int, int>
30 #define fi first
31 #define se second
32 #define sz(a) (int)a.size()
33 #define all(v) v.begin(), v.end()
34 #define ull unsigned long long
35 #define pb push_back
36 #define CE cout << endl;
37 #define CO cout << "OK" << endl;
38 #define D DEBUG
39 #define DEBUG(x) cerr << #x << '=' << x << endl
40 #define endl '\n'
41 using namespace std;
42 const int maxn = 5e5 + 10, mod = 998244353;// mod = 1949777;
43 const double EPS = 1e-3;
44 int n, m, a, b;
45 int ans[1005][1005];
46 signed main() {
47 #ifdef LOCAL
48 freopen("w.in", "r", stdin);
49 //freopen("w.ans", "w", stdout);
50 #endif
51 ios::sync_with_stdio(false);
52 cin.tie(nullptr);
53 //int tt; cin >> tt; while(tt--) solve();
54 cin >> n >> a >> b;
55 vector<int> v(n);
56 rep_(i, 0, n - 1) cin >> v[i];
57 rep_(i, 0, a + b) {
58 int x = max(0, i - b), y = min(i, a); // 水量总和为i时水箱1的上下界
59 int lo = x, hi = y;
60 per_(j, n - 1, 0) {
61 lo = max(lo + v[j], x);
62 hi = min(hi + v[j], y);
63 }//从水箱1的上下界从后往前,把倒水的过程逆过去,得出有影响的水的上下界
64 int flo = lo, fhi = hi;
65 rep_(j, 0, n - 1) {
66 flo = max(min(flo - v[j], y), x);
67 fhi = min(max(fhi - v[j], x), y);
68 } // 从有影响的水的上下界从前往后模拟倒水,得出答案的水的上下界
69 rep_(j, x, y) {
70 int d = i - j;
71 if (j <= lo) {
72 ans[j][d] = flo; //水箱1水太少,对答案贡献是下界flo
73 } else if (j >= hi) {
74 ans[j][d] = fhi;//太多
75 } else {
76 ans[j][d] = flo + j - lo;
77 //处于有影响范围
78 }
79 }
80 }
81 rep_(i, 0, a) {
82 rep_(j, 0, b) {
83 cout << ans[i][j] << ' ';
84 }
85 cout << endl;
86 }
87 return 0;
88 }
cf1809e(edu145e)的更多相关文章
随机推荐
- 2020ccpc威海C.Rencontre题解(树形dp)
题目大意:给定一棵带边权树,给三份点的集合U1,U2,U3,求0.5*(E(dis(u1,u2))+E(dis(u1,u3))+E(dis(u2,u3))). 即,我们需要维护两份点的所有距离和.显然 ...
- Linux系列---【设置ssh连接超时时间】
设置ssh连接超时时间 shell工具总是不断的超时,上个厕所就断开了,很不方便,这里根据自己习惯设置一下. echo "export TMOUT=600" >> /e ...
- Graphics绘制图形
List<double> labels = form.channelData2[kp.Key]; List<double> listY = kp.Value; int labe ...
- mysql语句优化总结
Sql语句优化和索引 1.Innerjoin和左连接,右连接,子查询 A. inner join内连接也叫等值连接是,left/rightjoin是外连接. SELECT A.id,A.nam ...
- Javaheima20
Java 学习内容 单元测试 反射 注解 动态代理 开发好的系统中存在很多的方法,如和对这些方法的正确性进行测试 如何在程序运行时取得到Class对象,然后取获得Class中的每个成分 注解是什么,具 ...
- 树莓派 IIC功能安装及测试
参考连接: https://blog.csdn.net/panwen1111/article/details/81044428 https://blog.csdn.net/xukai871105/ar ...
- github pic test
- Pytorch 感知机
单层感知机 \[\begin{aligned} & y = XW + b \\ & y = \sum x_i*w_i+b\\ \end{aligned} \] Derivative \ ...
- 第二章 excel的快捷键操作
本章介绍excel中部分常用的快捷键 1.文件类 工作簿操作:Ctrl + N 新建:Ctrl + w 关闭当前:Ctrl + S 保存 F12 当前另存为 Ctrl + p 打印当前 2.通用类 C ...
- Web服务器2
Web服务器2 基于华为鲲鹏云服务器CentOS中(或Ubuntu),使用Linux Socket实现: Web服务器的客户端服务器,提交程序运行截图 实现GET即可,请求,响应要符合HTTP协议规范 ...