上一页 1 2 3 4 5 6 7 ··· 20 下一页
摘要: 三部曲 :初始化 合并 查找 目前来说,个人认为最重要的是关系(合并,因为合并的依据是关系) 经典例题 关押罪犯 思路 : 把怨气值从大到小排序,把大的两个人分开,直到两个人再不能分到不同的监狱,此时的怨气值就是要求的 排序简单,问题是怎么合并?设两监狱分别是i(朋友),i+n(敌人),如果是x,y 阅读全文
posted @ 2020-07-24 21:34 Hazelxcf 阅读(108) 评论(0) 推荐(0) 编辑
摘要: 分组背包 #include <bits/stdc++.h> using namespace std; const int maxn = 110; int n,V; int v[maxn][maxn],w[maxn][maxn],s[maxn],dp[maxn]; int main(){ ios::s 阅读全文
posted @ 2020-07-19 10:30 Hazelxcf 阅读(133) 评论(0) 推荐(0) 编辑
摘要: https://ac.nowcoder.com/acm/problem/21302 直接考虑了01背包,目前还不懂为什么会是-1 1 #include <bits/stdc++.h> 2 using namespace std; 3 #define int long long 4 const int 阅读全文
posted @ 2020-07-18 21:33 Hazelxcf 阅读(122) 评论(0) 推荐(0) 编辑
该文被密码保护。 阅读全文
posted @ 2020-07-01 11:17 Hazelxcf 阅读(0) 评论(0) 推荐(0) 编辑
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=2689 #include<bits/stdc++.h> #define low(x) (x&(-x)) using namespace std; const int maxn=1e5+5; typedef long 阅读全文
posted @ 2020-05-28 11:47 Hazelxcf 阅读(153) 评论(0) 推荐(1) 编辑
摘要: https://ac.nowcoder.com/acm/problem/20861 #include<bits/stdc++.h> #define low(x) (x&(-x)) using namespace std; const int N=1e5+5; typedef long long ll 阅读全文
posted @ 2020-05-28 11:27 Hazelxcf 阅读(130) 评论(0) 推荐(0) 编辑
摘要: https://ac.nowcoder.com/acm/problem/20032 #include <bits/stdc++.h> using namespace std; const int maxn = 5010; int N, R; int g[maxn][maxn]; int ans; i 阅读全文
posted @ 2020-05-28 09:49 Hazelxcf 阅读(138) 评论(0) 推荐(0) 编辑
摘要: https://www.acwing.com/problem/content/description/116/ #include <bits/stdc++.h> #include <iostream> #include <algorithm> #include <vector> using name 阅读全文
posted @ 2020-05-28 09:15 Hazelxcf 阅读(178) 评论(0) 推荐(0) 编辑
摘要: https://ac.nowcoder.com/acm/problem/53681 intial : a 从小到大,b 从大到小 finally b - a分为连部分 前部分 : 正的 a 从小到大, 后部分 : 负的 b 从大到小 ??? 最后收益是正的,也就是说m是一直增加的,自然要从消耗小的开 阅读全文
posted @ 2020-05-25 11:36 Hazelxcf 阅读(180) 评论(0) 推荐(0) 编辑
摘要: https://ac.nowcoder.com/acm/problem/24636 刚开始不是很明白为什么前缀和差分可以做 后来想了想,似乎是这样 区间驱赶 的时候,前缀和不为0 剩余的区间前缀和为0 #include<bits/stdc++.h> #define int long long usi 阅读全文
posted @ 2020-05-24 21:57 Hazelxcf 阅读(218) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 7 ··· 20 下一页