摘要: 1 #include <bits/stdc++.h> 2 using namespace std; 3 typedef long long ll; 4 typedef pair<int, int> PII; 5 const int N = 100010; 6 int n, m; 7 PII mchs 阅读全文
posted @ 2020-11-24 23:20 kyk333 阅读(112) 评论(0) 推荐(0) 编辑
摘要: 解析转载自https://www.acwing.com/solution/content/4127/ 转载开始 左上角和右下角两个点可以确定一个矩形。枚举这两个点要用4个for循环 如果用二维前缀和,那么这个做法的复杂度的就是O(n^4)。 其实这个方案可以优化,那就是不枚举点。 所以我们可以利用前 阅读全文
posted @ 2020-11-24 22:08 kyk333 阅读(88) 评论(0) 推荐(0) 编辑
摘要: 样例解释:用方块表示牛 题目意思就是,我们要安排一个从上到下的顺序,使得牛按照这个顺序叠高高 然后使得所有牛的危险系数的最大值最小 每个牛的危险系数 = 它上面所有牛的重量w之和 减去 它自己的强壮值s 证明: 首先有成立 然后需要证明,用反证法:假设最优解不是按照wi + si从小到大排序的 那么 阅读全文
posted @ 2020-11-24 20:09 kyk333 阅读(117) 评论(0) 推荐(0) 编辑
摘要: 1 #include <bits/stdc++.h> 2 using namespace std; 3 int main() { 4 int t; 5 cin >> t; 6 while (t--) { 7 int a, b; 8 string a_line, b_line; 9 cin >> a 阅读全文
posted @ 2020-11-24 20:01 kyk333 阅读(79) 评论(0) 推荐(0) 编辑
摘要: 1 #include <bits/stdc++.h> 2 using namespace std; 3 const int N = 10010; 4 int n; 5 int px[N], py[N]; 6 int work(int a[]) { 7 int res = 0; 8 sort(a, a 阅读全文
posted @ 2020-11-24 11:50 kyk333 阅读(50) 评论(0) 推荐(0) 编辑
摘要: 1 #include <bits/stdc++.h> 2 using namespace std; 3 const int N = 1000010; 4 typedef long long ll; 5 ll a[N]; 6 int main() { 7 ios::sync_with_stdio(fa 阅读全文
posted @ 2020-11-24 11:13 kyk333 阅读(72) 评论(0) 推荐(0) 编辑
摘要: 1 #include <bits/stdc++.h> 2 using namespace std; 3 typedef pair<int, int> PII; 4 const int N = 1010; //最多给了500个草的位置,所以最多有1000个数需要离散化 5 int C, n; 6 PI 阅读全文
posted @ 2020-11-24 11:12 kyk333 阅读(84) 评论(0) 推荐(0) 编辑