摘要:
bryce1010模板 http://codeforces.com/gym/101810#include using namespace std;#define ll long longconst int MAXN=1010;int a[MAXN>t; int ...
阅读全文
posted @ 2018-07-29 15:52
Bryce1010
阅读(185)
推荐(0)
摘要:
bryce1010模板 http://codeforces.com/gym/101810#includeusing namespace std;#define ll long longll a[1000005];int main(){ int t,n,temp;...
阅读全文
posted @ 2018-07-29 15:51
Bryce1010
阅读(101)
推荐(0)
摘要:
bryce1010模板 http://codeforces.com/gym/101810#includeusing namespace std;#define ll long long const ll maxn = 1e5 + 5;const ll mod = 1e...
阅读全文
posted @ 2018-07-29 15:50
Bryce1010
阅读(197)
推荐(0)
摘要:
bryce1010模板 http://codeforces.com/gym/101810#include using namespace std;#define ll long longint main(){ int t; scanf("%d",&t);...
阅读全文
posted @ 2018-07-29 15:49
Bryce1010
阅读(127)
推荐(0)
摘要:
bryce1010模板 http://codeforces.com/gym/101810#include using namespace std;#define ll long longll lowbit(ll x){ return x&(-x);}int m...
阅读全文
posted @ 2018-07-29 15:48
Bryce1010
阅读(125)
推荐(0)
摘要:
bryce1010模板 http://codeforces.com/gym/101810#include using namespace std;#define ll long longint main() { int T; cin >> T; wh...
阅读全文
posted @ 2018-07-29 15:40
Bryce1010
阅读(136)
推荐(0)
摘要:
bryce1010模板 http://codeforces.com/gym/101810/problem/A 大模拟,写崩了,代码借队友的。。。。。。注意处理段与段的连接问题:#includeusing namespace std;const int maxn=1e5...
阅读全文
posted @ 2018-07-29 15:39
Bryce1010
阅读(202)
推荐(0)
摘要:
bryce1010模板http://acm.hdu.edu.cn/showproblem.php?pid=2586#includeusing namespace std;#define ll long longconst int MAXN=40010;const in...
阅读全文
posted @ 2018-07-29 13:47
Bryce1010
阅读(186)
推荐(0)
摘要:
1、Targan算法(离线)http://poj.org/problem?id=1470/*伪代码Tarjan(u)//marge和find为并查集合并函数和查找函数{ for each(u,v) //访问所有u子节点v { Tarja...
阅读全文
posted @ 2018-07-29 11:49
Bryce1010
阅读(204)
推荐(0)
摘要:
bryce1010模板 http://poj.org/problem?id=1470/*伪代码Tarjan(u)//marge和find为并查集合并函数和查找函数{ for each(u,v) //访问所有u子节点v { Tarjan(...
阅读全文
posted @ 2018-07-29 11:48
Bryce1010
阅读(166)
推荐(0)
摘要:
LCT&&树链剖分专题参考: https://blog.csdn.net/forever_wjs/article/details/52116682
阅读全文
posted @ 2018-07-28 11:11
Bryce1010
阅读(80)
推荐(0)
摘要:
欧拉函数计算欧拉phi函数。phi(n)为不超过n且与n互素的正整数个数。2.7.1 分解质因数求欧拉函数getFactors(n);int ret = n;for(int i = 0;i 1) ans −= ans/n; return ans;...
阅读全文
posted @ 2018-07-28 10:48
Bryce1010
阅读(122)
推荐(0)
摘要:
2.4.1 扩展欧几里得法//求逆元//1.扩展欧几里得法//ax=1(mod n)ll mod_reverse(ll a,ll n){ ll x,y; ll d=extend_gec(a,n,x,y); if(d==1)return (x%n+n)...
阅读全文
posted @ 2018-07-28 10:35
Bryce1010
阅读(73)
推荐(0)
摘要:
#include using namespace std;#define ll long long ll extgcd(ll a,ll b,ll &x,ll &y){ if(a==0&&b==0)return -1;//没有最大公约数 if(b==0){x...
阅读全文
posted @ 2018-07-28 10:10
Bryce1010
阅读(52)
推荐(0)
摘要:
2018 Multi-University Training Contest 2)HDU 6311 CoverHDU 6312 GameHDU 6313 Hack ItHDU 6314 MatrixHDU 6315 Naive Operations...
阅读全文
posted @ 2018-07-27 18:51
Bryce1010
阅读(86)
推荐(0)
摘要:
bryce1010模板http://acm.hdu.edu.cn/showproblem.php?pid=6318求逆序数的对数#include#include#include#include#includeusing namespace std;const int ...
阅读全文
posted @ 2018-07-27 18:48
Bryce1010
阅读(94)
推荐(0)
摘要:
bryce1010模板http://acm.hdu.edu.cn/showproblem.php?pid=6315/*hdu 1007首先我们在建立线段树之前应该思考的是线段树的节点维护一个什么值,在比赛过程中,我想到了维护a[i]的值但是时间复杂度太高,又想到维护a...
阅读全文
posted @ 2018-07-27 18:46
Bryce1010
阅读(117)
推荐(0)
摘要:
bryce1010模板http://acm.hdu.edu.cn/showproblem.php?pid=6314…………. 又是一个数学题! 这个题使用容斥原理解决的,现场看dls推公式。 我也推了一遍:f[n][m]=sum { r=0...n,c=0....m ...
阅读全文
posted @ 2018-07-27 18:45
Bryce1010
阅读(98)
推荐(0)
摘要:
bryce1010模板http://acm.hdu.edu.cn/showproblem.php?pid=6313参考dls的讲解: 以5*5的矩阵为例: 后一列分别对前一列+0+1+2+3+4操作: +0:10000 10000 10000 10000 10...
阅读全文
posted @ 2018-07-27 18:26
Bryce1010
阅读(114)
推荐(0)
摘要:
bryce1010模板http://acm.hdu.edu.cn/showproblem.php?pid=6312输出前几项,都是“Yes”#include using namespace std;int main(){ int n; while(cin>...
阅读全文
posted @ 2018-07-27 18:14
Bryce1010
阅读(84)
推荐(0)
摘要:
bryce1010模板http://acm.hdu.edu.cn/showproblem.php?pid=6311 从dls思路中,我整理一下自己的思路: 1、首先也是建图2、建图结束后,一个dfs查找联通块和度数为奇数的点 从第二对奇数度点开始给奇数度点对开始加辅助...
阅读全文
posted @ 2018-07-27 18:12
Bryce1010
阅读(115)
推荐(0)
摘要:
#include#include#include#include#includeusing namespace std;const int maxn=1e5+5;int is1[maxn],is2[maxn];// is1为原数组,is2为临时数组,n为个人定义的长度...
阅读全文
posted @ 2018-07-27 11:41
Bryce1010
阅读(190)
推荐(0)
摘要:
一、复杂度1.1什么是复杂度?在设计满足问题要求的算法时,复杂度的估算是非常重要的。我们不可能把每个想到的算法实现一遍看看是否足够快。应当通过估计算法的复杂度来判断所想的算法是否足够高效。1.2 时间复杂度一、概念时间复杂度是总运算次数表达式中受n的变化影响最大的那一...
阅读全文
posted @ 2018-07-27 09:59
Bryce1010
阅读(128)
推荐(0)
摘要:
https://blog.csdn.net/billluffy/article/details/78920578
阅读全文
posted @ 2018-07-26 23:03
Bryce1010
阅读(929)
推荐(0)
摘要:
Bryce1010模板CDQ分治1、与普通分治的区别普通分治中,每一个子问题只解决它本身(可以说是封闭的) 分治中,对于划分出来的两个子问题,前一个子问题用来解决后一个子问题而不是它本身2、试用的情况在很多问题中(比如大多数数据结构中),经常需要添加一些动态问题,然...
阅读全文
posted @ 2018-07-24 17:05
Bryce1010
阅读(78)
推荐(0)
摘要:
C++中this指针的理解先要理解class的意思。class应该理解为一种类型,象int,char一样,是用户自定义的类型。用这个类型可以来声明一个变量,比如int x, myclass my等等。这样就像变量x具有int类型一样,变量my具有myclass类型。理...
阅读全文
posted @ 2018-07-24 11:28
Bryce1010
阅读(123)
推荐(0)
摘要:
Codeforces Round #497 (Div. 2)打的虚拟赛,感觉这场比赛出题人成功背锅,不仅给了N个Announcement,题意也比较难懂。打完后D过了一个,E题防AK了。像我这样的菜鸟也能半小时内A完前三个(当时第一名的大佬是10分钟解决了前3个)A....
阅读全文
posted @ 2018-07-24 10:54
Bryce1010
阅读(63)
推荐(0)
摘要:
Bryce1010模板http://codeforces.com/contest/1008/problems#include using namespace std;#define ll long longconst int MAXN=1e5+10;const int...
阅读全文
posted @ 2018-07-24 10:50
Bryce1010
阅读(67)
推荐(0)
摘要:
Bryce1010模板http://codeforces.com/contest/1008/problems#include using namespace std;#define ll long longconst int MAXN=1e5+10;const int...
阅读全文
posted @ 2018-07-24 10:48
Bryce1010
阅读(74)
推荐(0)
摘要:
Bryce1010模板http://codeforces.com/contest/1008/problems#include using namespace std;int main(){ sets; s.insert('a'); s.insert(...
阅读全文
posted @ 2018-07-24 10:45
Bryce1010
阅读(83)
推荐(0)
摘要:
MAKE TREE() — 新建一棵只有一个结点的树。CUT(v) — 删除 v 与它的父亲结点 parent(v) 的边,相当于将点 v 的子树分离了出来。JOIN(v,w) — 让 v 成为 w 的新的儿子。其中 v 是一棵树的根结点,并且 v 和 w 是不同的两...
阅读全文
posted @ 2018-07-23 23:50
Bryce1010
阅读(96)
推荐(0)
摘要:
2018杭电多校第一场1001 Maximum Multiple1002 Balanced Sequence1003 Triangle Partition1004 Distinct Values1011 Time Zone
阅读全文
posted @ 2018-07-23 21:41
Bryce1010
阅读(83)
推荐(0)
摘要:
Bryce1010模板http://acm.hdu.edu.cn/showproblem.php?pid=6300排个序就好了#include#include#include#include#includeusing namespace std;const int m...
阅读全文
posted @ 2018-07-23 21:38
Bryce1010
阅读(66)
推荐(0)
摘要:
Bryce1010模板 http://acm.hdu.edu.cn/showproblem.php?pid=6301 队友AC的,没怎么看#include#include#include#include#include#include#includeusing nam...
阅读全文
posted @ 2018-07-23 21:37
Bryce1010
阅读(65)
推荐(0)
摘要:
Bryce1010模板 http://acm.hdu.edu.cn/showproblem.php?pid=6308将时间化简为分钟计算,同时不要用浮点数计算,精度会出现问题; 如果采用精度,最好加个0.1 my code#includeusing namespace...
阅读全文
posted @ 2018-07-23 21:34
Bryce1010
阅读(102)
推荐(0)
摘要:
Bryce1010模板 http://acm.hdu.edu.cn/showproblem.php?pid=6299两个字符串的排序可以分成四种情况: (1)str1左少右多 vs str2 左多右少 str2排在str1前面 (2)str1 左多右少 vs s...
阅读全文
posted @ 2018-07-23 21:31
Bryce1010
阅读(69)
推荐(0)
摘要:
Bryce1010模板 http://acm.hdu.edu.cn/showproblem.php?pid=6298打表找规律:#includeusing namespace std;#define ll long longconst int MAXN = 1e5 +...
阅读全文
posted @ 2018-07-23 21:25
Bryce1010
阅读(72)
推荐(0)
摘要:
Bryce1010模板http://acm.hdu.edu.cn/showproblem.php?pid=1255 线段树模板:矩形面积并#includeusing namespace std;#define ll long long#define lson l,m,...
阅读全文
posted @ 2018-07-23 09:20
Bryce1010
阅读(93)
推荐(0)
摘要:
Bryce1010模板http://www.51nod.com/onlineJudge/questionCode.html#!problemId=2133#include using namespace std;int a[1100];int main(){ /...
阅读全文
posted @ 2018-07-22 11:43
Bryce1010
阅读(102)
推荐(0)
摘要:
Prob Hint BZOJ 3323 文艺平衡树 区间翻转 BZOJ 1251 序列终结者 区间翻转,询问最值 BZOJ 1895 supermemo 区间加,翻转,剪切,询问最值。点插入,删除。 BZOJ 1056 排名系统 专治操作完不伸展...
阅读全文
posted @ 2018-07-21 13:47
Bryce1010
阅读(94)
推荐(0)