摘要: P2004 领地选择 简单的二维前缀和 点击查看代码 #include<bits/stdc++.h> using namespace std; using ll = long long; int main() { int n, m, c; cin >> n >> m >> c; vector<vec 阅读全文
posted @ 2025-05-17 14:47 Chuan81 阅读(35) 评论(0) 推荐(0)
摘要: P1884 [USACO12FEB] Overplanting S 难点不只是二维离散化,离散化后的差分部分简直要命 点击查看代码 #include<bits/stdc++.h> using namespace std; using ll = long long; int main() { int 阅读全文
posted @ 2025-05-17 14:33 Chuan81 阅读(9) 评论(0) 推荐(0)
摘要: P1955 [NOI2015] 程序自动分析 虽然说这题和上一题一样都是离散化,多了并查集,但我不觉得并查集多难,难点还是在于离散化,大多数题解都不喜欢使用unique我实在不太理解,STL设计出来就是给人用的啊。 点击查看代码 #include<bits/stdc++.h> using names 阅读全文
posted @ 2025-05-17 13:28 Chuan81 阅读(16) 评论(0) 推荐(0)
摘要: P1496 火烧赤壁 初见杀,如何将离散化后的数组标记染色才是最重要的 点击查看代码 #include<bits/stdc++.h> using namespace std; vector<int> f(4e4 + 10); vector<int>d; vector<int>c; map<int, 阅读全文
posted @ 2025-05-17 12:48 Chuan81 阅读(14) 评论(0) 推荐(0)
摘要: P3397 地毯 二维前缀和与差分问题一般出错就在于容斥原理、差分数组与总和数组间关系这两点,容易写着写着忘了怎样正确计算 点击查看代码 #include<bits/stdc++.h> using namespace std; const int N = 1010; // vector<vector 阅读全文
posted @ 2025-05-15 11:27 Chuan81 阅读(13) 评论(0) 推荐(0)
摘要: P2367 语文成绩 水题 点击查看代码 #include<bits/stdc++.h> using namespace std; int main() { int n, p; cin >> n >> p; vector<int>a(n + 1); vector<int>d(n + 1); for( 阅读全文
posted @ 2025-05-15 11:04 Chuan81 阅读(9) 评论(0) 推荐(0)
摘要: P1314 [NOIP 2011 提高组] 聪明的质监员 😟 🧾 题目背景(换种说法) 你是一个质监员,要对一批矿石进行抽检。 每块矿石有两个属性: 重量 w[i](比如:10 吨) 价值 v[i](比如:1000 块) 现在给你一些检查的“区间”,比如第 2 块到第 5 块矿石(从第几块到第几 阅读全文
posted @ 2025-05-15 10:53 Chuan81 阅读(12) 评论(0) 推荐(0)
摘要: P1719 最大加权矩形 容斥原理、二维前缀和、暴力 还有子矩阵求和 入门好题 点击查看代码 #include<bits/stdc++.h> using namespace std; vector<vector<int>>a(121, vector<int>(121)); vector<vector 阅读全文
posted @ 2025-05-14 21:13 Chuan81 阅读(10) 评论(0) 推荐(0)
摘要: P8218 【深进1.例1】求区间和 水题 点击查看代码 #include<bits/stdc++.h> using namespace std; const int N = 1e5+10; vector<int>a(N); vector<int>pre(N); int main() { int n 阅读全文
posted @ 2025-05-14 20:55 Chuan81 阅读(8) 评论(0) 推荐(0)
摘要: P1725 琪露诺 点击查看代码 #include<bits/stdc++.h> using namespace std; const int N = 2e6 + 10; vector<int>dp(N); vector<int>a(N); int main() { int n, l, r; cin 阅读全文
posted @ 2025-05-14 16:32 Chuan81 阅读(6) 评论(0) 推荐(0)