#include<bits/stdc++.h> using namespace std; typedef long long ll; namespace MCMF { const int MAXN = 10000, MAXM = 10000, INF = 0x7fffffff; int head[M ...
分类:
其他好文 时间:
2021-05-25 17:42:56
阅读次数:
0
原题链接 题意:给出 \(|s| \lesqlant 1500\) 并且给出哪些字母是好哪些是坏,然后要求求出一共有多少本质不同的字串,使得坏串个数不超过 \(k\) 个。 题解:显然可以直接 \(n^2\) 暴力找然后,用字符串 \(Hash\) 判重。 代码: #include <bits/st ...
分类:
其他好文 时间:
2021-05-24 17:09:10
阅读次数:
0
() Problem CF luogu Solution 提供一种奇怪的乱搞做法,求叉 没有怎么找特殊性质,就是边构造边判断。 考虑一个无解的充分条件,从左往右构造,把所有 1 都给两个串都填上左括号,所有 0 给当前未匹配的左括号少的串填上左括号,另一个填上右括号,如果最终还有未匹配的右括号时,一 ...
分类:
其他好文 时间:
2021-05-24 15:41:30
阅读次数:
0
题链 dp[x] 表示以 x 为进化终点能取得的最大进化次数; 可以发现 dp[x] 等于 树上x的前缀最大值 +1; 但是不可能递归寻找x的父亲直到根节点,因为会超时; 所以采用重链剖分+线段树维护前缀最大值,复杂度O(nlogn*logn); #include <bits/stdc++.h> u ...
分类:
其他好文 时间:
2021-05-24 14:49:30
阅读次数:
0
c语言中按位逻辑运算符、位移运算符 #include <stdio.h> int count_bits(unsigned x) { int bits = 0; while(x) { if(x & 1U) bits++; x >>= 1; } return bits; } int int_bits(v ...
分类:
编程语言 时间:
2021-05-24 14:42:05
阅读次数:
0
c语言中按位逻辑运算符、位移运算符 #include <stdio.h> int count_bits(unsigned x) { int bits = 0; while(x) { if(x & 1U) bits++; x >>= 1; } return bits; } int int_bits(v ...
分类:
编程语言 时间:
2021-05-24 14:41:08
阅读次数:
0
原题链接 题意:给出一棵树,边权全为 \(1\),要求出所有的距离为 \(k\) 的点对。 题解:暴力树上 \(dp\) 真的没想到,\(dp_{i,j}\) 代表的是距离 \(i\) 点的距离为 \(k\) 的点对数量。 代码: #include <iostream> #include <bits ...
分类:
其他好文 时间:
2021-05-24 08:40:27
阅读次数:
0
思路: 图论。参考了https://codeforces.com/blog/entry/71080。 实现: 1 #include<bits/stdc++.h> 2 using namespace std; 3 typedef long long ll; 4 const ll INF = 0x3f3 ...
分类:
其他好文 时间:
2021-05-24 08:39:17
阅读次数:
0
是个背包问题,很彻底的背包,故记录一下 题意:X想升级武器,有n个商店,第i个商店提供能量为ai的能量包,当ai可以被2n整除时,武器可以升n级,且X每次购买的能量包所包含的能量必须严格递增。问武器最多能升多少级 没啥特别的思路,就是彻底背包,直接上(抄的)码 1 #include <bits/st ...
分类:
其他好文 时间:
2021-05-24 07:37:04
阅读次数:
0
浮点数二分 模板 假如求平方根 #include<bits/stdc++.h> //万能头文件 using namespace std; int main() { double x; cin>>x; double l = 0, r = max(1, x); while (r - l > 1e-8) ...
分类:
其他好文 时间:
2021-05-24 04:47:23
阅读次数:
0