摘要: 问题描述 小明正在整理一批历史文献。这些历史文献中出现了很多日期。小明知道这些日期都在1960年1月1日至2059年12月31日。令小明头疼的是,这些日期采用的格式非常不统一,有采用年/月/日的,有采用月/日/年的,还有采用日/月/年的。更加麻烦的是,年份也都省略了前两位,使得文献上的一个日期,存在 阅读全文
posted @ 2020-09-02 16:30 yys_c 阅读(155) 评论(0) 推荐(0) 编辑
摘要: 01背包:指的是每种物品只能选0次或1次的背包问题。 在01背包的基础上说一下闫氏dp分析法: 状态计算使用的集合划分方法: #include<iostream> using namespace std; const int N = 1010; int n, m; int f[N][N]; int 阅读全文
posted @ 2020-09-01 16:33 yys_c 阅读(160) 评论(0) 推荐(0) 编辑
摘要: 天神小学 Description: 《corpse party:blood drive》中有这么一段,班长筱崎亚由美拿到六鬼门的晶石,导致了涅?的暴走,天小的崩溃,靠着幸子的力量才逃出了天小。(剧情什么的不重要) 现在我们假设没有幸子,班长需要靠自己的力量逃出天神小学。可以把天神小学看作是一个二维的 阅读全文
posted @ 2020-08-31 21:11 yys_c 阅读(111) 评论(0) 推荐(0) 编辑
摘要: prim最小生成树:维护集合外所有点到集合的最小距离,每次找集合外的离集合最近的点k,并用k点更新集合到集合外所有点的距离最小值 #include<iostream> #include<cstring> using namespace std; const int N = 510, INF = 0x 阅读全文
posted @ 2020-08-31 16:21 yys_c 阅读(147) 评论(0) 推荐(0) 编辑
摘要: 模拟一个小根堆,最重要的部分是heap_swap部分 heap_node和node_heap分别维护堆中的第a个元素是第几个插入的元素,和第k个插入的元素在堆中的位置 #include<iostream> using namespace std; const int N = 100010; int 阅读全文
posted @ 2020-08-31 15:47 yys_c 阅读(173) 评论(0) 推荐(0) 编辑
摘要: dijkstra算法的堆优化版本,把找dist数组中的最小值的复杂度优化为O(1). #include<iostream> #include<cstring> using namespace std; const int N = 150010; int heap[N], heap_node[N], 阅读全文
posted @ 2020-08-31 12:10 yys_c 阅读(104) 评论(0) 推荐(0) 编辑
摘要: 循环n次,每次用离源点最近的点去更新源点到其他点的距离。 #include<iostream> #include<cstring> using namespace std; const int N = 510; int dist[N]; int d[N][N]; int st[N]; int n, 阅读全文
posted @ 2020-08-30 18:35 yys_c 阅读(80) 评论(0) 推荐(0) 编辑
摘要: 按边权把边从小到大排序 用并查集加边 检查是否为连通图 #include<iostream> #include<algorithm> using namespace std; const int N = 100010, E = 200010; struct edge{ int a, b, w; bo 阅读全文
posted @ 2020-08-30 11:21 yys_c 阅读(115) 评论(0) 推荐(0) 编辑
摘要: 本题练习离散化,二分找位置,数组去重。 #include<iostream> #include<algorithm> using namespace std; const int N = 100010; struct node{ int x, c; }nodes[N]; int n, m, k = 阅读全文
posted @ 2020-08-30 10:58 yys_c 阅读(95) 评论(0) 推荐(0) 编辑
摘要: #include<iostream> using namespace std; /* e > h[k + 1],跳到k + 1 塔上的能量:e + e - h[k + 1] = 2 * e - h[k + 1] e <= h[k + 1], 跳到k + 1 塔上的能量:e - (h[k + 1] - 阅读全文
posted @ 2020-08-29 16:56 yys_c 阅读(133) 评论(0) 推荐(0) 编辑