一开始没有想到枚举所有模数求解,卡了很久。 写法见代码注释。 ...
分类:
其他好文 时间:
2018-09-22 00:57:08
阅读次数:
201
题意:判断最小割是否唯一. 分析:跑出最大流后,在残余网上从源点和汇点分别dfs一次,对访问的点都打上标记. 若还有点没有被访问到,说明最小割不唯一. https://www.cnblogs.com/ka200812/archive/2011/07/30/2121872.html 这里面的鬼畜图说的 ...
分类:
其他好文 时间:
2018-09-21 15:05:42
阅读次数:
218
1 #include 2 using namespace std; 3 bool flagM, flagN; 4 void dfs(int m, int n, int factor){ 5 if (m == 1 && n == 1){//两个都被完全因式分解 6 flagM = flagN = tr... ...
分类:
其他好文 时间:
2018-09-19 19:44:01
阅读次数:
210
#include <cstdio> #include <cstring> #include <cmath> #include <queue> #include <map> #include <vector> #include <iostream> #include <algorithm> using ...
分类:
其他好文 时间:
2018-09-18 22:58:07
阅读次数:
204
#include #include #include #include #include #include using namespace std; #define ll long long const int N =1e5+9; int t,n,a[N]; int b[50]; /* 要想两个数的... ...
分类:
其他好文 时间:
2018-09-18 11:21:06
阅读次数:
124
At 0 second, the LED light is initially off. After BaoBao presses the button 2 times, the LED light turns on and the value of the counter changes to 1 ...
分类:
其他好文 时间:
2018-09-18 11:14:46
阅读次数:
168
4053 思路: 主席树 先分别求前缀和后缀的逆序数 然后要求某一段的逆序数,就可以根据前缀或着后缀根据容斥求出答案, 这样需要枚举这一段中的数,求之前或者之后有多少个比他大或比他小的数, 这个可以通过用主席数维护权值线段树来做 然后每次枚举断开后小的那段区间,这样最多需要枚举n*log(n)次 复 ...
分类:
其他好文 时间:
2018-09-18 00:15:32
阅读次数:
214
题解: 比较好想 首先注意到如果最暴力的做法复杂度无法接受 而5000的范围基本是n^2做法了 只使用已经遍历过的点数目和当前子树中的点数目转移我们知道复杂度是n^2的 于是大胆猜测一波同一个节点为根值域是连续的 然后就可以暴力dp了 查询的时候我们可以把序列差分一下(原问题等价于 区间修改,区间询 ...
分类:
其他好文 时间:
2018-09-17 00:01:35
阅读次数:
295
Description 请注意本题的数据范围。 Description 请注意本题的数据范围。 Description 请注意本题的数据范围。 请注意本题的数据范围。 Input Input Input Output Output Output Sample Input 2 2 15 19 3 30 ...
分类:
其他好文 时间:
2018-09-16 22:06:15
阅读次数:
275
对于三个点求最小路径长度和,答案肯定在某两个点的lca上,因为如果把集合点定在公共lca上,一定有两个点汇合后再一起上到lca,这样显然不如让剩下的那个点下来 这个lca可能是深度最深的……但是我懒得证了,反正只有三个lca,每个都求一遍然后取个max就好啦 cpp include include ...
分类:
其他好文 时间:
2018-09-14 14:33:02
阅读次数:
179