随笔分类 -  ACM

摘要:B - Highways https://vjudge.net/contest/348411#problem/B POJ - 2485 //Kruskal #include<iostream> #include<cstdio> #include<cstdlib> #include<vector> # 阅读全文 »
posted @ 2021-09-08 17:16 IamIron-Man 阅读(29) 评论(0) 推荐(0) 编辑
摘要:dijkstra https://vjudge.net/contest/346398#problem/D #include<iostream> #include<cstdio> #include<cstdlib> #include<algorithm> #define rep(i,x,y) if(( 阅读全文 »
posted @ 2021-09-07 09:16 IamIron-Man 阅读(38) 评论(0) 推荐(0) 编辑
摘要:/* https://vijos.org/p/1028 */ #include<iostream> #include<cstdio> #include<cstring> #define rep(i,x,y) if ((x)<=(y)) for (register int i=(x);i<=(y);i 阅读全文 »
posted @ 2021-09-06 09:49 IamIron-Man 阅读(182) 评论(0) 推荐(0) 编辑
摘要:树 建树 题目详情 (pintia.cn) #include<iostream> #include<cstdio> #include<cstdlib> #include<set> #include<vector> #define rep(i,x,y) if ((x)<=(y)) for (regis 阅读全文 »
posted @ 2021-09-05 22:20 IamIron-Man 阅读(11) 评论(0) 推荐(0) 编辑
摘要:线性方程组形如,高斯消元可以用O(n^3)的复杂度解出x=。 二维vector数组定义后,只能通过push_back一个个读入。 C++代码: #include<iostream> #include<iomanip> #include<cstdlib> #include<cstdio> #inclu 阅读全文 »
posted @ 2020-09-24 11:55 IamIron-Man 阅读(226) 评论(0) 推荐(0) 编辑
摘要:并查集专题 Wireless Network POJ - 2236 思路 并查集裸题,路径压缩+判断每一个是否满足距离小于等于d的条件,这里可以不sqrt,判断与d*d的大小即可 C++(AC) #include<iostream> #include<iomanip> #include<cstdli 阅读全文 »
posted @ 2020-09-23 20:47 IamIron-Man 阅读(110) 评论(0) 推荐(0) 编辑
摘要:K-Kabaleo Lite 时间限制:C/C++ 1秒,其他语言2秒 空间限制:C/C++ 262144K,其他语言524288K 64bit IO Format: %lld 题目描述 Tired of boring WFH (work from home), Apollo decided to 阅读全文 »
posted @ 2020-08-05 11:03 IamIron-Man 阅读(182) 评论(0) 推荐(0) 编辑
摘要:线段树专题 参考如下链接的线段树代码风格:https://blog.csdn.net/qq_25605637/article/details/46967529 A - 基础线段树求和单点修改单点询问 A - 敌兵布阵 C++(AC) #include<iostream> #include<ioman 阅读全文 »
posted @ 2020-08-03 22:21 IamIron-Man 阅读(159) 评论(0) 推荐(0) 编辑
摘要:杭电多校第三场 D-不相交线段最多 Problem D. Tokitsukaze and Multiple Tokitsukaze has a sequence of length n, denoted by a. Tokitsukaze can merge two consecutive elem 阅读全文 »
posted @ 2020-08-02 23:42 IamIron-Man 阅读(182) 评论(0) 推荐(0) 编辑
摘要:Codeforces Round #648 (Div. 2) A. 题意: 玩搞矩阵的游戏,只能在同行和同列都是0的地方把这个位置的0变成1,谁没法继续变了谁就输了 tag: 贪心,模拟 题解: 没有什么麻烦的贪心策略,1的行和列设为false,从头到尾跑一遍,i行j列是不是还可以放,因为无后效性( 阅读全文 »
posted @ 2020-06-13 12:05 IamIron-Man 阅读(99) 评论(0) 推荐(0) 编辑
摘要:最长上升子串 f[i]=f[I-1]+1(f[I]>f[I-1]) f[I]=1;(f[I]<=f[I-1]) 输出max(f(I)) 最长上升子序列 f[I]=max(f[I],f[j]+1); For example:D. Remove One Element http://codeforces 阅读全文 »
posted @ 2019-12-19 21:50 IamIron-Man 阅读(195) 评论(0) 推荐(0) 编辑
摘要:数据运算时候int int不能和long long比,所有的都要开成long long! 由此可见,设计测试数据的时候还是设计大点吧,都跑一遍,要不然会死那里! For example: Walking Between Houses http://codeforces.com/problemset/ 阅读全文 »
posted @ 2019-12-17 21:01 IamIron-Man 阅读(143) 评论(0) 推荐(0) 编辑
摘要:计算机算法:枚举、排序、搜索、计数、贪心、动态规划、图论、数论、博弈论 、概 率论 、计算几何 、字符串算法等。 数据结构:数组、对象/结构、字符串、队列、栈、树、图、堆、平衡树/线段树、复杂 数据结构 、嵌套数据结构 等。 阅读全文 »
posted @ 2019-12-02 22:08 IamIron-Man 阅读(223) 评论(0) 推荐(0) 编辑
摘要:一道合理出栈顺序的很水的变式 阅读全文 »
posted @ 2019-11-29 12:21 IamIron-Man 阅读(738) 评论(0) 推荐(0) 编辑
摘要:美国学者实现汉诺塔的方法,自己写的一个应用 阅读全文 »
posted @ 2019-11-29 12:17 IamIron-Man 阅读(674) 评论(0) 推荐(0) 编辑
摘要:这是一个栈的应用题,利于深入了解栈的原理和功能,每次存元素的索引,遇到小的就触发,开始依次往左出栈,算的时候算到该的最右边,就实现了。注意长度是多少和栈里面现在都是递增,最后怎么处理,了解运行机制 阅读全文 »
posted @ 2019-11-29 11:45 IamIron-Man 阅读(394) 评论(0) 推荐(0) 编辑
摘要:粗心。字典序是搜索到一个小的,字典序就算小了,相等才往后比。想到一个难得算法先不要打怵,可能是一个噱头,比如这个题,就是个水题其实。 阅读全文 »
posted @ 2019-11-28 21:29 IamIron-Man 阅读(203) 评论(0) 推荐(0) 编辑
摘要:不要看到一道题太害怕了,有可能是简单题。初始处理就很大肯定有很强的优化。优化的时候一大步一大步压缩。要善于找数学规律不要死磕算法啦到后来的时候。 阅读全文 »
posted @ 2019-11-28 21:09 IamIron-Man 阅读(218) 评论(0) 推荐(0) 编辑
摘要:并查集 并查集一般两个函数,合并和查找(带路径压缩),合并是将父节点关联起来,查找是找父节点,然后层层减层路径压缩,即将它指向它父亲的父亲,因为首节点父亲的父亲也是它自己,所以不会越界。用pre记录他的父节点 下面是畅通工程题目: 畅通工程 Time Limit: 4000/2000 MS (Jav 阅读全文 »
posted @ 2019-11-28 15:08 IamIron-Man 阅读(154) 评论(0) 推荐(0) 编辑
摘要:快速幂 阅读全文 »
posted @ 2019-11-27 22:17 IamIron-Man 阅读(106) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示