
计蒜客
qq_34287501
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
展开
-
计蒜客2017第一场 B 阿里天池的新任务(简单) KMP
题目链接:https://nanti.jisuanke.com/t/15500解析:裸的KMP,先把模式串求出来,然后进行KMP代码:#include#define N 1000009using namespace std;typedef long long LL;char p[N], s[N];int w[N], nx[N];void cal_next(cha原创 2017-06-07 15:53:49 · 375 阅读 · 0 评论 -
计蒜客2017 第五场 UCloud 的安全秘钥(中等) 尺取法
题目链接:https://nanti.jisuanke.com/t/15768解析:一直尺取,记录相同的个数,复杂度O(n)代码:#include#define N 50009using namespace std;const int INF = 0x3f3f3f3f;int a[N], b[N], c[N];int judge(int n, int nn, in原创 2017-06-07 15:58:23 · 341 阅读 · 0 评论 -
计蒜客2017 第六场 微软大楼设计方案(中等)
题目链接:https://nanti.jisuanke.com/t/15772解析:一个核心部门a位于楼L(高h1)到其他核心部门b位于楼R(高h2),求L~R的最小的高度h,然后最短路径为abs(R-L)+abs(h-h1)+abs(h-h2),关键问题就是一个RMQ代码:#include#define N 200009using namespace std;int原创 2017-06-07 16:07:25 · 490 阅读 · 0 评论