NOIP2022 游记
Usada_Pekora · · 个人记录
关于 NOIP2022 题目以及本人训练的内容,现在不会有,以后也不会有。
因为教练告知我 Z 省的某群体体验名额取消了,原因是 nullptr。
虽然一周前就有心理准备,但还是有点难以接受。
为什么已经不参与评奖了,还要继续打击呢?
仅仅是在考场,甚至是考场外腾出一些空位来,让体验组在同样的时间内做同样的题也不行吗?
就算高中生报名复赛(即 S 分数 >= 0)的人全部参与,也有一百来个名额留给初中生参与。
我不明白。
现在我不得不收拾我的东西,回到教室去,学习我道理一样的文化课。在一百多人的三个班里,我的排名是倒数的。
彻底败北。
2022.11.15
upd in 2022.11.26
T1 维护
#include <bits/stdc++.h>
typedef long long ll;
typedef unsigned long long ull;
using namespace std;
const int mod = 998244353, N = 1005;
int a[N][N], b[N][N], c[N][N];
signed main() {
cin.tie(nullptr)->sync_with_stdio(false);
int T, task_id, n, m, C, F;
cin >> T >> task_id;
while (T--) {
cin >> n >> m >> C >> F;
for (int i = 1; i <= n; i++) {
static string str;
cin >> str;
for (int j = 1; j <= m; j++)
a[i][j] = str[j - 1] - '0';
}
for (int i = 0; i <= n + 1; i++)
for (int j = 0; j <= m + 1; j++)
b[i][j] = c[i][j] = 0;
for (int i = 1; i <= n; i++)
for (int j = m; j >= 1; j--)
b[i][j] = (a[i][j]) ? (0) : (b[i][j + 1] + 1);
for (int i = n; i >= 1; i--)
for (int j = 1; j <= m; j++)
c[i][j] = (a[i][j]) ? (0) : (c[i + 1][j] + 1);
ll ans_c = 0ll, ans_f = 0ll;
static const auto mod_add = [&](int __x, int __y) -> int {
__x += __y;
return __x >= mod ? __x - mod : __x;
};
for (int j = 1; j <= m; j++)
for (int i = 1, cnt = 0; i <= n; i++) {
if (b[i][j] > 1)
ans_c = mod_add(ans_c, 1ll * cnt * (b[i][j] - 1));
if (b[i][j] > 1 && c[i][j] > 1)
ans_f = mod_add(ans_f, cnt * 1ll * (b[i][j] - 1) * 1ll * (c[i][j] - 1) % mod);
if (b[i - 1][j] > 1)
cnt = mod_add(cnt, b[i - 1][j] - 1);
if (a[i][j])
cnt = 0;
}
cout << (C * ans_c) << ' ' << (F * ans_f) << '\n';
}
return 0;
}
T2 很困难,只会暴力。
T3 是 Tarjan,还不会。
T4 是一个经典(?)题目【HNOI 2016】序列 的变式,用单调栈预处理元素的贡献然后扫描线做一下。