随笔分类 - nwd的痛
摘要:关键点就是节点的度。m为偶数时直接全部邀请,考虑m为奇数。 去掉一个度为奇的点或一对度均为偶数的点,均可以改变图的边的奇偶性。 为什么不去掉单个度为偶数的点?不改变边的奇偶性,更劣解。 因而对于去除离散的点的情况,去除单个为奇数的即是最优。 为什么不去掉更多?去掉更多以达到偶数边,意味更多人缺席,那
阅读全文
摘要:抄完题解之好像不难系列 求最小,用dfs,尽可能选择相邻的点对,如果以某个儿子为顶点的子树sz为odd,则儿子v与当前节点u所连的边必取,儿子v的其余点两两相连1,与u无关。 因此,只需要统计子树大小为奇数的v与其父亲u之间这条边的权值。 求最大,同样基于dfs。画一张图我们可以看出来,越靠近“中间
阅读全文
摘要:https://codeforces.ml/contest/1465/problem/E 好题好题 做不来的都是好题[滑稽] 写的太好了555 羡慕这样的博客 https://www.cnblogs.com/dysyn1314/p/14183815.html 图片截取自上述链接 1 #include
阅读全文
摘要:https://codeforces.ml/contest/1465/problem/D 参考:https://www.cnblogs.com/JDFZ-ZZ/p/14171488.html & https://blog.csdn.net/weixin_43918473/article/detail
阅读全文
摘要:1 #include<bits/stdc++.h> 2 using namespace std; 3 const int N = 1e5 + 10; 4 int f[N]; 5 6 inline int find(int x) 7 { 8 return (f[x] == x) ? x : f[x]
阅读全文
摘要:unique&erase: https://blog.csdn.net/hellokandy/article/details/51317593 参考博文:https://www.cnblogs.com/DeepJay/p/14115735.html 这个代码是真的简洁清晰,看的太舒服了 https:
阅读全文
摘要:https://codeforces.ml/contest/1409/problem/B 我是蠢蛋 1 #include<bits/stdc++.h> 2 #define ll long long 3 using namespace std; 4 5 inline ll min(ll a, ll b
阅读全文
摘要:巧用队列+树状数组求逆序对 1 #include<bits/stdc++.h> 2 #define ll long long 3 using namespace std; 4 const int N = 2e5 + 10; 5 ll pos[N], t[N]; 6 int n; 7 8 inline
阅读全文
摘要:好题 看似线段树的nlogn 实则是multiset + pair 1 #include<bits/stdc++.h> 2 #define fi first 3 #define se second 4 #define ll long long 5 using namespace std; 6 con
阅读全文
摘要:https://codeforces.ml/contest/1428/problem/E 优先队列题,需要维护的东西是将一个萝卜拆成t份的获得值: 假设当前它被均分为t - 1份,则拆分为t份只需要多一次操作,也即上帝视角可以反悔。 这个获得值就是拆成t份与拆成t - 1份之后的二者平方和的差。 参
阅读全文
摘要:抄完韩教代码感觉自己本来也应该想出这种方法的。。。 这道题搁置了有一段时间了 总结一下 本题给出字符串s,要求在其中截取长度为k的01串共n-k+1个,问能不能找出一个字典序最小的、长度也为k的01串,使得这个结果串与n-k+1中每一个串至少有一位相同。 其实答案也挺暴力的,但也有一定的特殊性。对于
阅读全文
摘要:1 #include<bits/stdc++.h> 2 #define ll long long 3 using namespace std; 4 const int N = 110; 5 6 double dp[N][N * N]; 7 int a[N], b[N]; 8 9 int main()
阅读全文
摘要:1 #include<bits/stdc++.h> 2 #define ll long long 3 using namespace std; 4 const int N = 1e5 + 10; 5 struct node 6 { 7 ll t, x; 8 }a[N]; 9 10 int main(
阅读全文
摘要:1 #include<bits/stdc++.h> 2 #define ll long long 3 using namespace std; 4 5 ll n, m; 6 7 ll powmod(ll base, ll k, ll mod) 8 { 9 ll ans = 1; 10 while(k
阅读全文
摘要:1 #include<bits/stdc++.h> 2 using namespace std; 3 const int N = 4e5 + 10; 4 int a[N]; 5 int main(){ 6 cin.tie(0);cout.tie(0); 7 ios_base::sync_with_s
阅读全文
摘要:1 #include<bits/stdc++.h> 2 #define ll long long 3 using namespace std; 4 5 const int N = 2e5 + 10; 6 ll a[N]; 7 8 int main(){ 9 ios_base::sync_with_s
阅读全文
摘要:1 #include<iostream> 2 #include<algorithm> 3 #include<cstring> 4 #include<string> 5 #include<cstdio> 6 #include<cmath> 7 #define rg register 8 #define
阅读全文
摘要:1 #include<iostream> 2 #include<cmath> 3 #include<cstring> 4 #include<string> 5 #include<vector> 6 #include<stack> 7 #include<set> 8 using namespace s
阅读全文
摘要:太差劲了 1 #include<iostream> 2 #include<algorithm> 3 #include<cstring> 4 #include<cmath> 5 using namespace std; 6 7 double dp[10010][150], p[150][150]; 8
阅读全文
摘要:太差劲了 1 #include<iostream> 2 #include<algorithm> 3 #include<cstring> 4 #include<cmath> 5 #define ll long long 6 using namespace std; 7 const int N = 1e
阅读全文

浙公网安备 33010602011771号