- 博客(12)
- 资源 (1)
- 收藏
- 关注
原创 1031D - Minimum path
1072D - Minimum path 题目描述 传送门 题目大意 给你一个n×nn \times nn×n的只有小写字母的字符矩阵,你要从1,11,11,1走到n,nn,nn,n,只能往下,往右走,同时你可以改变这个矩阵中的kkk个字符,问你走到n,nn,nn,n所经过的路径的最小字典序是多少。 1≤n≤20001 \le n \le 20001≤n≤2000 Solution 比赛的时候最后...
2018-10-22 16:15:27
751
原创 CF919D Substring
Substring 题目描述 传送门 题目大意 一个有nnn个点mmm条边的有向图,每个点有一个小写字母权值,定义一条路径的权值是这条路径出现次数最多的字母的个数,求出这个图权值最大权值的路径的权值。 1≤n,m≤3000001 \le n, m \le 3000001≤n,m≤300000 PS : 若存在一条路径使得出现次数最多的字母数量为无穷大,则输出 -1,路径不要求为简单路径。 Solu...
2018-10-19 18:46:10
390
原创 我的EMACS配置文件
放在这里防止丢失,或许会不定时更新(毕竟不知道什么时候会突然找到一个更好地插件) ;; Added by Package.el. This must come before configurations of ;; installed packages. Don't delete this line. If you don't want it, ;; just comment it out...
2018-10-13 22:10:46
1744
原创 CF914D Bash and a Tough Math Puzzle
Bash and a Tough Math Puzzle 写发博客证明自己还活着QwQ 题目描述 Bash likes playing with arrays. He has an array a1,a2,... ana_{1},a_{2},...\ a_{n}a1,a2,... an of nnn integers. He likes to guess the grea...
2018-10-11 13:20:36
354
原创 高精度模板
我的高精度模板 用vector存储,带符号,带输入输出,加减乘,比较大小,暂时不完全。 (请无视前几行的zz操作) #include<cstdio> #include<iostream> #include<algorithm> #include<vector> #include<string&
2018-09-15 16:09:50
218
原创 JZOJ4727 挺进
题目大意 给你一棵树,让你断掉一条边,使得形成的两棵树的直径和最大。 1≤n≤1000001≤n≤1000001 \le n \le 100000 Solution1 看别人可以用DFSDFSDFS序 + 线段树 + RMQRMQRMQ求LCALCALCA来做,不过倍增的LCALCALCA会被卡,让我感到很难受,所以就没写。 Solution2 题解原话 :裸的树形DP。 照着这...
2018-09-05 16:02:21
288
原创 根号分治
说实话个人不是很喜欢根号类的算法,毕竟能logloglog不想根号,但是毕竟有很多根号类的算法是logloglog无法替代的,就比如说下面这个算法。 根号分治 根号分治,顾名思义,就是把大的问题拆成小的问题,不过根号分治不是从中间切的,而是从n−−√n\sqrt n的地方切的,具体怎么说呢,我们举个栗子。 例1 题目大意 给你一个长度为nnn的01串SSS,然后有mmm次询问,每次询问给...
2018-09-02 22:37:28
3364
7
原创 [USACO07OPEN]城市的地平线City Horizon
题目描述 Farmer John has taken his cows on a trip to the city! As the sun sets, the cows gaze at the city horizon and observe the beautiful silhouettes formed by the rectangular buildings. The entire ho...
2018-09-02 14:21:52
926
原创 [HNOI2009]最小圈
题目描述 考虑带权的有向图G=(V,E)G=(V,E)G=(V,E)以及w:E→Rw:E→Rw:E\rightarrow R,每条边e=(i,j)(i≠j,i∈V,j∈V)e=(i,j)(i≠j,i∈V,j∈V)e=(i,j)(i\neq j,i\in V,j\in V)的权值定义为wi,jwi,jw_{i,j},令n=|V|n=|V|n=|V|。c=(c1,c2,⋯,ck)(ci∈V)c=(c...
2018-09-02 10:33:51
823
原创 [USACO06JAN]冗余路径Redundant Paths
题目描述 In order to get from one of the F (1<=F<=5,0001<=F<=5,0001 1..F1..F1..F) to another field, Bessie and the rest of the herd are forced to cross near the Tree of Rotten Apples. The cow...
2018-09-02 09:42:37
471
2
原创 矩阵快速幂
阅读本知识点的基本条件 知道什么是矩阵,以及知道如何进行矩阵的乘法。 什么是矩阵快速幂 和快速幂一样,矩阵快速幂是一种可以在O(lognlognlogn)的时间复杂度内求出矩阵的nnn次方的算法。 如何写矩阵快速幂 前提1 封装好一个矩阵 struct Matrix{ ... friend Matrix operator * (Matrix a, M...
2018-09-02 08:52:57
255
原创 快速幂
快速幂 什么是快速幂 顾名思义,快速幂就是跑得特别快的算一个数几次方的的运算。 朴素算法 求anana^n的值 for (int i = 1; i <= n; i++) { res *= a; } 显然,复杂度是O(nnn)的,这显然不是十分快速的算法。 利用cmath库 res = pow(a, b); 告诉你,实际上它的复杂度也不是很健康,可...
2018-09-02 08:47:25
277
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人
RSS订阅