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)的更多相关文章

随机推荐

  1. flutter 环境配置以及我的第一个flutter程序(Hello World)

    电脑配置: 操作系统: Windows 7 或更高版本 (64-bit) 磁盘空间: 400 MB (不包括Android Studio的磁盘空间). Windows下所需安装有: 1.Flutter ...

  2. web后端之表单传值

    第一种 第二种 第三种陪置web.xml文件

  3. Java 实现汉字按照首字母分组排序

    一.实现思路: 1.将数据list 进行排序Collections,排序后是按照汉字字母排序的 2.循环找出26个字母,以字母为key,以list中相同首字母的数据为值(集合) 二.代码实现: // ...

  4. C#和C++差异化对比

    这里只记录和C++面向对象的区别,也并无比较成分,只做差异化学习使用. 1. 访问修饰符区别:多了一个Internal:成员仅能被同一个项目中的代码访问. 2. 字段的访问:增加了Get,Set访问器 ...

  5. mybatis-config.xml头信息

    1 <?xml version="1.0" encoding="UTF-8" ?> 2 <!DOCTYPE configuration 3 P ...

  6. Java新手问题 请问各路大佬这是什么问题导致的呢?

  7. Google Play新功能 让您的应用在Play商店中闪耀

    Google Play 商店的商品详情内容是帮助潜在用户了解您应用的功能和价值的最佳方式.您提供的资源和信息 (应用说明.图像和视频) 对用户决定下载应用而言至关重要. 随着越来越多的用户购买移动设备 ...

  8. Java--接口和抽象类有什么区别

    他们都不能实例化对象,都可以包含抽象方法,而且抽象方法必须被继承的类全部实现. 区别: 1.抽象类和接口都不能直接实例化,如果要实例化,抽象类变量必须指向实现所有抽象方法的子类对象,接口变量必须指向实 ...

  9. conda Installing on Linux - 搬运

    转自:Installing on Linux - conda 23.1.0 documentation Installing on Linux Download the installer: Min ...

  10. POI给单元格添加超链接(xls,xlsx)

    package com.topcheer.html; import java.io.FileOutputStream; import java.io.IOException; import org.a ...