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)的更多相关文章
随机推荐
- Android studio Internet跳转活动
<?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android=" ...
- angular-gridster2使用
1.安装:npm install angular-gridster2 --save 2.引入 3.html代码 <div id="fullscreen" style=&quo ...
- PVE设置定时关闭、启动虚拟机
shell中输入命令: crontab -e 进入对应cron 添加命令: 例如: 00 2 * * * pvesh create /nodes/pve/qemu/102/status/stop 00 ...
- 解决office提示您的许可证不是正版的问题
https://blog.csdn.net/d_pcb66/article/details/125339872?spm=1001.2101.3001.6650.4&utm_medium=dis ...
- HTML第四章作业
学生实践4.1.3 1 <!doctype html> 2 <html> 3 <head> 4 <meta charset="utf-8" ...
- Q:oracle19c 如何重建vm_concat函数
没有wm_concat是因为oracle12c数据库中废弃了wm_concat函数 --–登录dba用户sys权限,为wmsys用户创建可用的wm_concat函数,依次执行以下语句 第一步 定义对象 ...
- 红米k40稳定版本刷开发版开启DC调光记录
刷个开发版还要申请资格.要么去淘宝买资格的账号,要么用其他方法: 包21.4.15,直接有有防闪烁功能下载地址:https://bigota.d.miui.com/21.4.15/miui_ALIOT ...
- c# Visual Studio|There is no editor available for ***,make sure the application for the file type(.vb) is installed问题解决方法
这个问题出现在在使用VS编码当中,电脑意外关机,导致的文件的缺失或者损坏. 使用反编译软件(如:ILSpy)对编译后的 .EXE文件进行反编译,在翻遍的结果中将相关代码拷贝至目标路径下,替换所需文件. ...
- 关于Windows10纯净启动的相关修改流程
关于纯净启动的相关流程 自动登录 打开命令提示符运行control userpasswords2后回车 在弹出的用户账户窗口中,取消勾选"要使用本计算机,用户必须输入用户名和密码" ...
- 搭建rust开发环境
1.打开https://www.rust-lang.org/tools/install 下载64位安装器 选择第一项默认安装 安装器会下载安装rust 相关工具链,并添加path C:\Users\z ...