自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(199)
  • 收藏
  • 关注

转载 知识点-数论进阶

知识点-数论进阶abstract:整除分块,积性函数,线性筛,莫比乌斯反演,迪利克雷卷积,积性函数前缀和,0.引入Gym - 101485D debugging(之后会发现,这道dp的转移方程和杜教筛的转移如出一辙。)题意有一份包含1个 bug 的n( 1≤????≤1e6)行代码,运行一次到崩溃需要的时间为 r( 1≤????≤1e9)。你可以任意行添加 printf 语句来输出调试...

2019-09-06 21:17:00 190

转载 concrete maths ch2 求和

ch2 求和1.sigma及相关符号\(\sum\limits_{i=1}^{n}i\) 是确定式,\(\sum\limits_{1\le i\le n}i\)是一般式。 一般式进行下标换元不容易出错,确定式写代码的时候好写些。边界问题:越简单越好。Kenneth E. Iverson括号: \([p\ prime]\) 可以用于化简一般式:\[\sum\limits_{p...

2019-09-03 20:43:00 138

转载 concrete maths ch4 number theory

ch4 number theory数论研究正数的性质1.整除gcd lcm 扩展欧几里得。整除求和\(\sum_{n|m}\)的几个公式。ch2的知识会很有用。2.质数Fundamental Theorem of Arithmetic:根据唯一分解定理,每个数可以用质数的次数数组表示:\[(n_2,n_3,n_5...)\]这样gcd lcm都有了新的定义。这种...

2019-09-02 22:12:00 119

转载 Aho-Corasick algorithm

Aho-Corasick algorithmLet there be a set of strings with the total length \(m\) (sum of all lengths).The Aho-Corasick algorithm constructs a data structure similar to a trie with some additiona...

2019-08-20 20:22:00 241

转载 Finding repetitions

Finding repetitionsGiven a string \(s\) of length \(n\).A repetition is two occurrences of a string in a row.In other words a repetition can be described by a pair of indices \(i < j\) suc...

2019-08-20 20:21:00 106

转载 Suffix Automaton

Suffix AutomatonA suffix automaton is a powerful data structure that allows solving many string-related problems.For example, you can search for all occurrences of one string in another, or cou...

2019-08-20 20:20:00 219

转载 Z-function and its calculation

Z-function and its calculationSuppose we are given a string \(s\) of length \(n\). The Z-function for this string is an array of length \(n\) where the \(i\)-th element is equal to the greatest ...

2019-08-20 20:19:00 174

转载 Prefix function. Knuth–Morris–Pratt algorithm

Prefix function. Knuth–Morris–Pratt algorithmPrefix function definitionYou are given a string \(s\) of length \(n\).The prefix function for this string is defined as an array \(\pi\) of length...

2019-08-20 20:18:00 158

转载 Suffix Array

Suffix ArrayDefinitionLet \(s\) be a string of length \(n\). The \(i\)-th suffix of \(s\) is the substring \(s[i \ldots n - 1]\).A suffix array will contain integers that represent the starti...

2019-08-20 20:16:00 192

转载 知识点 - 计算几何基础

知识点 - 计算几何基础讲义点我们把点 \(\mathbf r\) 看成从 \(\mathbf 0\) 到 \(\mathbf r\)的向量 \(\vec{\mathbf r}\)#define ftype long doublestruct point2d { ftype x, y; point2d() {} point2d(ftype x, ftyp...

2019-08-17 21:12:00 163

转载 知识点 - 树状数组

知识点 - 树状数组解决问题类型:单点更新,前缀查询,很简单地拓展到2维复杂度即代码://压行#define lowbit(x) ((x)&(-(x)))void add(int x, int y) { for (; x <= idx; x += lowbit(x)) f[x] += y; }int sum(int x) { int ans = 0; for ...

2019-08-16 21:25:00 145

转载 知识点 - 线段树 权值 树套树 二维 可持续

知识点 - 线段树 权值 树套树 二维 可持续//区间更新求和inline int ls(int p) { return p << 1; }//左儿子 inline int rs(int p) { return p << 1 | 1; }//右儿子 void push_up(int p) { t[p] = t[ls(p)] + t[rs(p)];...

2019-08-16 21:13:00 112

转载 Operations on polynomials and series

Operations on polynomials and seriesIn this article we will cover common operations that you will probably have to do if you deal with polynomials.Basic Notion and FactsConsider a polynomial \...

2019-08-14 16:39:00 200

转载 AtCoder 137 F 插值 差分 或构造

AtCoder 137 F 插值求系数 想法题题意:AtCoder 137 F已知:\(f(x)\)在p个点的值:\(f(i) \equiv a_i \pmod p\) \((0 \leq i \leq p-1)\)求:\(f(x) = b_{p-1} x^{p-1} + b_{p-2} x^{p-2} + \ldots + b_0\)的所有系数\(b_i\)保证:\(2 \le...

2019-08-13 22:24:00 89

转载 Burnside's lemma / Pólya enumeration theorem

Burnside's lemma / Pólya enumeration theoremBurnside's lemmaBurnside's lemma was formulated and proven by Burnside in 1897, but historically it was already discovered in 1887 by Frobenius, and ...

2019-08-08 22:21:00 163

转载 The Inclusion-Exclusion Principle

The Inclusion-Exclusion PrincipleThe inclusion-exclusion principle is an important combinatorial way to compute the size of a set or the probability of complex events. It relates the sizes of in...

2019-08-08 22:05:00 1449

转载 图的联通性

图的联通性0.【前置知识】 图上dfs相关概念vis数组:在图的遍历中,往往设置了一个标记数组vis的bool值来记录顶点是否被访问过。但有些时候需要改变vis值的意义。令vis具有3种值并表示3种不同含义vis = 0,表示该顶点没没有被访问vis = 1,表示该顶点已经被访问,但其子孙后代还没被访问完,也就没从该点返回vis = 2,表示该顶点已经被访问,其子孙后代也已经访...

2019-07-25 22:11:00 148

转载 数据结构入门

单调栈与单调队列 Minimum stack / Minimum queue问题1:如何O(1)地访问一个栈的最小值?Ans:我们给栈里的数附上第二个域,代表在这个数之前(包含这个数)的最小值。stack<pair<int, int>> st;void push(int new_elem){ int new_min = st.empty() ? ...

2019-04-11 17:13:00 75

转载 数论函数补充 公式推导

\(\begin{array}{l} 考虑问题\sum\limits ^{n}_{i=1}\sum\limits ^{m}_{j=1} [gcd(i,j)=p]\ \ \ ( n,m\leqslant 1e7)\\ \\ \Leftrightarrow \sum\limits _{p}\sum\nolimits ^{\lfloor \frac{min( m,n)}{p} \rfloor...

2019-04-08 13:01:00 80

转载 几何入门合集 gym101968 problem F. Mirror + gym102082 Problem F Fair Chocolate-Cutting + gym101915 problem ...

abstract:V const & a 加速F. Mirror题意链接问题:有n个人在y=0的平面上(及xoz平面)。z=0平面上有一面镜子(边平行于坐标轴)。z=a平面上有q个点(保证a大于所有人的z坐标)。 所有人面朝镜子,且在镜子和q个点之间(即每个人的z坐标保证0<z<a)。问对于某个点,让所有人能够通过镜子看到那个点的镜子的最小面积。...

2019-04-08 12:41:00 470

转载 COCI 2018/2019 CONTEST #2 T4 Maja T5Sunčanje Solution

COCI 2018/2019 CONTEST #2 T4 T5 Solutionabstract花式暴力#2 T5 Sunčanje题意按顺序给你1e5个长方形(左下角坐标&&长宽),对于每个长方形询问是否有后面的长方形盖住了它。题解暴力几何。不需要线段树维护。用一个排序剪枝,先按矩形的左下角x坐标排序,对于每一个矩形i,枚举后面的所有矩形j,当矩形...

2019-03-24 20:59:00 181

转载 数论函数

基本定义直接上图还有神奇教学网站 莫比乌斯反演入门和欧拉反演orz上图中k的含义:将n分解\(n = {p_1}^{a_1}{p_2}^{a_2}...{p_k}^{a_k}\) n的所有因子中,有r个质因子的方案数为C(r,k),\(\therefore \mu = (-1)^rC(r,k)\)\(\sum_{i=1}^{n}\lfloor\frac{n}{i}\rflo...

2019-03-22 16:27:00 158

转载 【数论】模运算 模板及其正确性复杂度证明

\(a \cdot x = b \pmod n\)线性同余方程题解法1.n,a互质时使用逆元,否则两边除掉gcd(a,x)然后逆元。(如果b除不尽及无解)法2.化为\(a \cdot x + n \cdot k = b\) 扩展欧几里得线性同余方程组 中国剩余定理 板题测试:51nod1079题意\[\begin{align} a &\equiv a_...

2019-03-21 15:59:00 611

转载 数论入门

abstract线性筛与容斥本文解决以下问题:\(\sum\limits ^{n}_{i=1} i[ gcd( i,n) =1] =\frac{N*\phi (N)}{2}\)\(\sum\limits ^{n}_{i=1}\sum\limits ^{n}_{i=1}[ gcd( i,j) =p]\)\(\sum\limits ^{n}_{i=1} gcd( i,n) \\)...

2019-03-20 20:58:00 73

转载 USACO1.4 1.5 搜索剪枝与数字 洛谷OJ P1214 P1215 P1217 P1218

USACO1.4 题解Arithmetic Progressions题意让你求长为n的由小于2*m*m的双平方数组成的等差数列有几个双平方数:形如 B=P*P+Q*Q,p,q>0的数题解枚举首项和公差,判n个数是否为等差数列,复杂度为m^4m*m/(n-1)为公差的枚举次数,m*m为首项的结局次数,n为数列的枚举次数,其中还可以剪枝一下,如果数列的最后一项大于2*...

2019-03-14 16:08:00 91

转载 USACO Section 1.3 题解 (洛谷OJ P1209 P1444 P3650 P2693)

usaco ch1.4sort(d , d + c, [](int a, int b) -> bool { return a > b; }); 生成与过滤 generator&&filter dfs:简化多重循环,枚举点对与判环洛谷OJP1209 [USACO1.3]修理牛棚 Barn RepairP1444 [USACO1.3]虫洞wormh...

2019-03-13 15:51:00 141

转载 Codeforces Round #542 题解

Codeforces Round #542abstractI决策中的独立性,II联通块染色板子IIIVoronoi diagram O(N^2 logN)VI环上距离分类讨论加取模,最值中的决定性元素V代数构造B题意2n个数排成一行,1..n各出现两次,两个人分别从1按顺序走到n(每个数只能被一个人路过),问他们两个人的距离和的最小值(两个数之间的距离等于他们位置(...

2019-03-02 20:22:00 67

转载 Codeforces Round div2 #541 题解

codeforces Round #541abstract:I构造题可能代码简单证明很难II拓扑排序III并查集 启发式排序,带链表IV dp 处理字符串递推问题V 数据结构巧用:于二叉树同构VI更新了头文件,将很难敲的东西放到define里面,初始化数组可以a[100]={};C题意给你100个人,让你将它们围成一个圆,使得:“任意相邻的两人身高差的绝对值” ...

2019-02-27 21:41:00 94

转载 Codeforces Round #539 div2

Codeforces Round #539 div2abstractI 离散化三连sort(pos.begin(), pos.end());pos.erase(unique(pos.begin(), pos.end()), pos.end());if (pos.size() == 0) pos.push_back(0);int id = lower_bound (pos.beg...

2019-02-26 15:50:00 93

转载 test

公式测试\(\begin{array}{l} 考虑问题\sum\limits ^{n}_{i=1}\sum\limits ^{m}_{j=1} [gcd(i,j)=p]\ \ \ ( n,m\leqslant 1e7)\\ \\ \Leftrightarrow \sum\limits _{p}\sum\nolimits ^{\lfloor \frac{min( m,n)}{p} \rf...

2019-02-25 19:21:00 61

转载 DM

Chapter1 propositon Logic1.1propositon A declarative sentence With a unique value. A proposition can be represented by a proposition variable (i.e., a symbol).A simple statement can be ...

2019-01-15 22:01:00 290

转载 JAVA期末考试整理

Technical problem:0.read: Scanner input= new Scanner(System.in)random#: x=(int)(Math.random()*10) ,makes 0<=x<10.Random class: Random ran=new Random(3);Ran.nextInt();Switch(...

2019-01-14 13:28:00 174

转载 【立体几何】Journey to Jupiter Gym - 101991J 立体几何模板

https://cn.vjudge.net/problem/Gym-101991J题目很长,其实就是给你一个正三角形,并且告诉你它的中点在Z轴上以及法向量,边长和顶点A的坐标(自由度已定),让你求A,B,C到Z轴上一点H的距离。题解:高考向量题,考虑正三角形ABC,我们把OB拆成OD加DB,OD=-OA/2,DB可以通过连立三个方程得到(它垂直于AO和法向量,他的长度为...

2018-11-24 20:04:00 97

转载 [Database.System.Concepts(6th.Edition.2010)].Abraham.Silberschatz. Ch8学习笔记

DatabaseCh8.relational design8.1 features of good design8.1.1 larger alternativeswhy design is good ?Otherwise ,a larger alternative(schema) may cause:1)redundancy2)update may cause...

2018-11-19 17:52:00 408

转载 【模拟与阅读理解】Gym - 101954C Rullete

http://codeforces.com/gym/101954/problem/C题意:14行伪代码让你翻译。坑得yibi#include<stdio.h>#include<stdlib.h>#include<string.h>#include<algorithm>#include<iostream&...

2018-11-17 19:08:00 107

转载 【立体几何】分类讨论很细节 Gym - 101967I Путешествие по тору

http://codeforces.com/gym/101967/attachments题意:定义了一个甜甜圈。(torus)不是让你二重积分啦233现在有一个星球是甜甜圈形状的,它有四条很关键的纬线,南极北极里赤道外赤道。同时有n条均匀分布的经线。每一圈经线和四条和纬线交出四个点。现在你从内赤道的某圈经线上出发,沿着经纬线访问所有的经线,访问的意思是:对于每个经线...

2018-11-11 19:11:00 95

转载 gcd最大生成树模板

出处:ACM International Collegiate Programming Contest, Egyptian Collegiate Programming ContestArab Academy for Science, Technology and Maritime Transport, 2017想法题:n=1e5. 有n*n/2条边,不能kruskal...

2018-11-10 16:14:00 133

转载 【日更】蓝书第一章

打完这个赛季(上个青岛铜牌),刷刷蓝书题目合集:https://cn.vjudge.net/article/737eg1:https://cn.vjudge.net/problem/UVA-11292#include<stdio.h>#include<stdlib.h>#include<string.h>#inc...

2018-11-07 20:40:00 85

转载 【插头dp】 hdu4285 找bug

打模板的经验:1.变量名取一样,换行也一样,不要宏定义2.大小写,少写,大括号#include<algorithm>#include<iostream>#include<stdlib.h>#include<string.h>#include<math.h>#include&l...

2018-10-30 12:31:00 61

转载 【每日dp】 Gym - 101889E Enigma 数位dp 记忆化搜索

题意:给你一个长度为1000的串以及一个数n 让你将串中的‘?’填上数字 使得该串是n的倍数而且最小(没有前导零)题解:dp,令dp[len][mod]为是否出现过 填到第len位,余数为mod 的状态(dp=0 or 1)用记忆化搜索来实现,dfs返回1或0.如果搜到最后一位并且余数为0,返回1.如果搜到已经更新过的dp状态,直接返回0。将mod作为全局变量,...

2018-10-05 19:42:00 92

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除