摘要: 先用线段树做了一下,结果用cin超时,数据太变态了,此题正解应该是倍增算法。先看看线段树怎么做这题;如果不懂线段树的先看此视频:https://www.bilibili.com/video/BV1cb411t7AM?from=search&seid=130930450619969892401.线段树 阅读全文
posted @ 2020-04-26 22:27 ACWink 阅读(298) 评论(0) 推荐(0) 编辑
摘要: 先用线段树做了一下,结果用cin超时,数据太变态了,此题正解应该是倍增算法。 先看看线段树怎么做这题; 如果不懂线段树的先看此视频:https://www.bilibili.com/video/BV1cb411t7AM?from=search&sei... 阅读全文
posted @ 2020-04-26 22:27 ACWink 阅读(46) 评论(0) 推荐(0) 编辑
摘要: 单链表不会数组模拟的参考此博客:https://blog.csdn.net/Satur9/article/details/104072845?depth_1-utm_source=distribute.pc_relevant_t0.none-task-blog-BlogCommendFromBaid 阅读全文
posted @ 2020-04-26 21:34 ACWink 阅读(189) 评论(0) 推荐(0) 编辑
摘要: 单链表不会数组模拟的参考此博客:https://blog.csdn.net/Satur9/article/details/104072845?depth_1-utm_source=distribute.pc_relevant_t0.none-task-bl... 阅读全文
posted @ 2020-04-26 21:34 ACWink 阅读(43) 评论(0) 推荐(0) 编辑
摘要: 如上图所示,我们看这代码分析首先,单调栈必须保证单调对吧,所以说我们将大于栈顶元素的元素入栈,直到遇到一个小于栈顶元素的数,然后因为是单调栈,所以我们想让它入栈,就必须删除栈中比他大的元素,但是又要不影响结果,所以每个栈顶元素出栈是都要计算它与前面出栈元素组成的最大矩形,直到在栈中找到一个比待入栈元 阅读全文
posted @ 2020-04-26 19:19 ACWink 阅读(320) 评论(0) 推荐(0) 编辑
摘要: 如上图所示,我们看这代码分析 首先,单调栈必须保证单调对吧,所以说我们将大于栈顶元素的元素入栈,直到遇到一个小于栈顶元素的数,然后因为是单调栈,所以我们想让它入栈,就必须删除栈中比他大的元素,但是又要不影响结果,所以每个栈顶元素出栈是都要计算它与前面出... 阅读全文
posted @ 2020-04-26 19:19 ACWink 阅读(45) 评论(0) 推荐(0) 编辑
摘要: 用两个栈来模拟光标的移动,sum来维护A栈的前缀和,f用来维护最大值。 1 #include <iostream> 2 #include <algorithm> 3 #include <stack> 4 using namespace std; 5 stack<int> A, B; 6 conste 阅读全文
posted @ 2020-04-26 15:15 ACWink 阅读(161) 评论(0) 推荐(0) 编辑
摘要: 用两个栈来模拟光标的移动,sum来维护A栈的前缀和,f用来维护最大值。 1 #include 2 #include 3 #include 4 using namespace std; 5 stack A, B; 6 const... 阅读全文
posted @ 2020-04-26 15:15 ACWink 阅读(56) 评论(0) 推荐(0) 编辑
摘要: 1 #include <iostream> 2 #include <string> 3 4 using namespace std; 5 6 const int N = 1e5 + 10, M = 1e4 + 10; 7 8 int m, n; 9 string p, t; 10 11 int ne 阅读全文
posted @ 2020-04-26 10:48 ACWink 阅读(210) 评论(0) 推荐(0) 编辑
摘要: 1 #include 2 #include 3 4 using namespace std; 5 6 const int N = 1e5 + 10, M = 1e4 + 10; 7 8 int m, n; 9 strin... 阅读全文
posted @ 2020-04-26 10:48 ACWink 阅读(70) 评论(0) 推荐(0) 编辑