Loading

01 2021 档案

摘要:描述 二叉树的非递归后序遍历,改编自王道习题答案的一种方法 在几个月之前写王道的选择题的时候便碰到了它,当时先入为主的考虑了递归实现的遍历方法,在看了讲解视频的评论后才知道原来是通过后续遍历来实现,这样可以很方便的的实现路径的查找。(其实我觉得直接dfs瞎搞也挺好写的,但是毕竟这个知识点在考研的时候 阅读全文
posted @ 2021-01-20 21:57 Yiduuannng 阅读(122) 评论(0) 推荐(0)
摘要:描述 传送门:我是传送门 In July 2004, Google posted on a giant billboard along Highway 101 in Silicon Valley (shown in the picture below) for recruitment. The co 阅读全文
posted @ 2021-01-20 21:52 Yiduuannng 阅读(61) 评论(0) 推荐(0)
摘要:描述 传送门:我是传送门 Given a sequence of KK integers { N1,N2,…,NKN1,N2,…,NK }. A continuous subsequence is defined to be { Ni,Ni+1,…,NjNi,Ni+1,…,Nj } where 1≤ 阅读全文
posted @ 2021-01-20 21:50 Yiduuannng 阅读(31) 评论(0) 推荐(0)
摘要:问题描述 运行与pygame相关的程序,显示白/灰/黑屏幕 系统环境 macOS MOjave 版本 10.14.2 (18C54) 解决方案 首先测试是否是相同的原因,运行这段代码,测试是否是能听到声音看不到画面 1 python -m pygame.examples.aliens 将python 阅读全文
posted @ 2021-01-20 21:48 Yiduuannng 阅读(124) 评论(0) 推荐(0)
摘要:描述 传送门:我是传送门 A family hierarchy is usually presented by a pedigree tree. Your job is to count those family members who have no child. 输入 Each input fi 阅读全文
posted @ 2021-01-20 21:46 Yiduuannng 阅读(53) 评论(0) 推荐(0)
摘要:Numpy简介 NumPy(Numerical Python) 是 Python 语言的一个扩展程序库,支持大量的维度数组与矩阵运算,此外也针对数组运算提供大量的数学函数库。 NumPy 的前身 Numeric 最早是由 Jim Hugunin 与其它协作者共同开发,2005 年,Travis Ol 阅读全文
posted @ 2021-01-20 21:45 Yiduuannng 阅读(165) 评论(0) 推荐(0)
摘要:描述 传送门:我是传送门 在日常生活中,通过年、月、日这三个要素可以表示出一个唯一确定的日期。 牛牛习惯用8位数字表示一个日期,其中,前4位代表年份,接下来2位代表月 份,最后2位代表日期。显然:一个日期只有一种表示方法,而两个不同的日期的表 示方法不会相同。 牛牛认为,一个日期是回文的,当且仅当表 阅读全文
posted @ 2021-01-20 21:44 Yiduuannng 阅读(376) 评论(0) 推荐(0)
摘要:描述 传送门:我是传送门 Ivan is a novice painter. He has nn dyes of different colors. He also knows exactly mmpairs of colors which harmonize with each other. Iv 阅读全文
posted @ 2021-01-20 21:42 Yiduuannng 阅读(112) 评论(0) 推荐(0)
摘要:描述 传送门:我是传送门 A mysterious country will hold a football world championships—-Abnormal Cup, attracting football teams and fans from all around the world 阅读全文
posted @ 2021-01-20 21:41 Yiduuannng 阅读(82) 评论(0) 推荐(0)
摘要:描述 传送门:我是传送门 Two people face two piles of stones and make a game. They take turns to take stones. As game rules, there are two different methods of ta 阅读全文
posted @ 2021-01-20 21:39 Yiduuannng 阅读(69) 评论(0) 推荐(0)
摘要:描述 传送门:我是传送门 DreamGrid has nn integers a1,a2,…,ana1,a2,…,an. DreamGrid also has mm queries, and each time he would like to know the value of ∑1≤i≤n⌊ai 阅读全文
posted @ 2021-01-20 21:38 Yiduuannng 阅读(57) 评论(0) 推荐(0)
摘要:描述 传送门:我是传送门 Edward, the headmaster of the Marjar University, is very busy every day and always forgets the date. There was one day Edward suddenly fo 阅读全文
posted @ 2021-01-20 21:36 Yiduuannng 阅读(47) 评论(0) 推荐(0)
摘要:描述 传送门:我是传送门 White Rabbit has a rectangular farmland of n*m. In each of the grid there is a kind of plant. The plant in the j-th column of the i-th ro 阅读全文
posted @ 2021-01-20 21:35 Yiduuannng 阅读(79) 评论(0) 推荐(0)
摘要:描述 传送门:我是传送门 The shorter, the simpler. With this problem, you should be convinced of this truth. You are given an array A of N postive integers, and M 阅读全文
posted @ 2021-01-20 21:31 Yiduuannng 阅读(56) 评论(0) 推荐(0)
摘要:描述 传送门:我是传送门 Japari Park is a large zoo home to extant species, endangered species, extinct species, cryptids and some legendary creatures. Due to a m 阅读全文
posted @ 2021-01-20 21:29 Yiduuannng 阅读(46) 评论(0) 推荐(0)
摘要:描述 传送门:我是传送门 Nowadays, at least one wrestling match is held every year in our country. There are a lot of people in the game is “good player”, the res 阅读全文
posted @ 2021-01-20 21:28 Yiduuannng 阅读(76) 评论(0) 推荐(0)
摘要:描述 传送门:我是传送门 A musical melody is represented as a sequence of N (1<=N<=20000)notes that are integers in the range 1..88, each representing a key on th 阅读全文
posted @ 2021-01-20 21:26 Yiduuannng 阅读(67) 评论(0) 推荐(0)
摘要:描述 传送门:我是传送门 A clique is a complete graph, in which there is an edge between every pair of the vertices. Given a graph with N vertices and M edges, yo 阅读全文
posted @ 2021-01-20 21:25 Yiduuannng 阅读(62) 评论(0) 推荐(0)
摘要:描述 传送门:我是传送门 Student Andrey has been skipping physical education lessons for the whole term, and now he must somehow get a passing grade on this subje 阅读全文
posted @ 2021-01-20 21:20 Yiduuannng 阅读(70) 评论(0) 推荐(0)
摘要:描述 注意,这一份后缀数组的代码并不能AC 传送门:我是传送门 Given two strings a and b we define ab to be their concatenation. For example, if a = “abc” and b = “def” then ab = “a 阅读全文
posted @ 2021-01-20 21:18 Yiduuannng 阅读(52) 评论(0) 推荐(0)
摘要:描述 传送门:我是传送门 The Pocket Cube, also known as the Mini Cube or the Ice Cube, is the 2 × 2 × 2 equivalence of a Rubik’s Cube.The cube consists of 8 piece 阅读全文
posted @ 2021-01-20 21:17 Yiduuannng 阅读(131) 评论(0) 推荐(0)
摘要:描述 传送门:我是传送门 You are a member of the space station engineering team, and are assigned a task in the construction process of the station. You are expec 阅读全文
posted @ 2021-01-20 21:15 Yiduuannng 阅读(81) 评论(0) 推荐(0)
摘要:描述 传送门:我是传送门 小t非常感谢大家帮忙解决了他的上一个问题。然而病毒侵袭持续中。在小t的不懈努力下,他发现了网路中的“万恶之源”。这是一个庞大的病毒网站,他有着好多好多的病毒,但是这个网站包含的病毒很奇怪,这些病毒的特征码很短,而且只包含“英文大写字符”。当然小t好想好想为民除害,但是小t从 阅读全文
posted @ 2021-01-20 21:13 Yiduuannng 阅读(109) 评论(0) 推荐(0)
摘要:描述 传送门:我是传送门 The Head Elder of the tropical island of Lagrishan has a problem. A burst of foreign aid money was spent on extra roads between villages 阅读全文
posted @ 2021-01-20 21:10 Yiduuannng 阅读(114) 评论(0) 推荐(0)
摘要:描述 传送门:我是传送门 A tree is a well-known data structure that is either empty (null, void, nothing) or is a set of one or more nodes connected by directed e 阅读全文
posted @ 2021-01-20 21:08 Yiduuannng 阅读(62) 评论(0) 推荐(0)
摘要:描述 传送门:我是传送门 上次Gardon的迷宫城堡小希玩了很久(见Problem B),现在她也想设计一个迷宫让Gardon来走。但是她设计迷宫的思路不一样,首先她认为所有的通道都应该是双向连通的,就是说如果有一个通道连通了房间A和B,那么既可以通过它从房间A走到房间B,也可以通过它从房间B走到房 阅读全文
posted @ 2021-01-20 21:07 Yiduuannng 阅读(96) 评论(0) 推荐(0)
摘要:描述 传送门:我是传送门 有一个长度为n的序列给出Q条限制l,r,strstr==oddl,r,strstr==odd 表示[l,r][l,r]区间内的数的和是奇数,否则为偶数请你输出最小的不满足条件的编号-1(即最后一个满足的),如果全部满足,输出总数Q! 输入 第一行一个n(n<=109)n(n 阅读全文
posted @ 2021-01-20 21:05 Yiduuannng 阅读(139) 评论(0) 推荐(0)
摘要:描述 传送门:我是传送门 Recently Monocarp got a job. His working day lasts exactly mm minutes. During work, Monocarp wants to drink coffee at certain moments: th 阅读全文
posted @ 2021-01-20 21:04 Yiduuannng 阅读(84) 评论(0) 推荐(0)
摘要:描述 传送门:我是传送门 TT and FF are … friends. Uh… very very good friends -__-b FF is a bad boy, he is always wooing TT to play the following game with him. Th 阅读全文
posted @ 2021-01-20 21:03 Yiduuannng 阅读(117) 评论(0) 推荐(0)
摘要:描述 传送门:我是传送门 南亚发生了一次地震。ACM (Asia Cooperated Medical 亚洲联合医疗队) 已经为膝上型电脑搭建了一个无线网络,但受到了一次不可预知的余震攻击,因此网络中的所有电脑都被破坏了。电脑被逐台修复,网络逐步恢复了工作。由于受到硬件的约束,每台电脑只能与距离它不 阅读全文
posted @ 2021-01-20 21:02 Yiduuannng 阅读(112) 评论(0) 推荐(0)
摘要:描述 传送门:我是传送门 有一家公司有NN个员工(从1到N)(从1到N),公司里每个员工都有一个直接的老板(除了整个公司的领导)。如果你是某人的直接老板,那个人就是你的下属,他的所有下属也都是你的下属。如果你是没有人的老板,那么你就没有下属,没有直接老板的员工就是整个公司的领导,也就是说NN个员工构 阅读全文
posted @ 2021-01-20 21:01 Yiduuannng 阅读(50) 评论(0) 推荐(0)
摘要:描述 传送门:我是传送门 During the War of Resistance Against Japan, tunnel warfare was carried out extensively in the vast areas of north China Plain. Generally 阅读全文
posted @ 2021-01-20 20:59 Yiduuannng 阅读(59) 评论(0) 推荐(0)
摘要:应用场景 静态: 查询区间第K大 动态: 带修改的查询区间第K大 静态 P3834【模板】可持久化线段树 1(主席树) 1 #include <bits/stdc++.h> 2 using namespace std; 3 #define clr(a, x) memset(a, x, sizeof( 阅读全文
posted @ 2021-01-20 20:55 Yiduuannng 阅读(98) 评论(0) 推荐(0)
摘要:描述 传送门:我是传送门 Alice, a student of grade 66, is thinking about an Olympian Math problem, but she feels so despair that she cries. And her classmate, Bob 阅读全文
posted @ 2021-01-20 20:53 Yiduuannng 阅读(71) 评论(0) 推荐(0)
摘要:描述 传送门:我是传送门 Given a sequence of integers a1,a2,…,ana1,a2,…,an and qq pairs of integers (l1,r1),(l2,r2),…,(lq,rq)(l1,r1),(l2,r2),…,(lq,rq), find count 阅读全文
posted @ 2021-01-20 20:49 Yiduuannng 阅读(121) 评论(0) 推荐(0)
摘要:描述 参考资料:我是传送门 一维树状数组的差分写法 二维树状数组 注意要差分处理 一维树状数组 (1). 单点修改+区间查询 (2). 区间修改+单点查询 // 给位置p增加x<br /> void add(int p,int x) { while(p &lt;= n) sum[p] += x,p 阅读全文
posted @ 2021-01-20 20:47 Yiduuannng 阅读(73) 评论(0) 推荐(0)
摘要:描述 传送门:我是传送门 CA loves strings, especially loves the palindrome strings. One day he gets a string, he wants to know how many palindromic substrings in 阅读全文
posted @ 2021-01-20 20:43 Yiduuannng 阅读(60) 评论(0) 推荐(0)
摘要:应用场景 1.求串S前缀font>0~i内本质不同回文串的个数(两个串长度不同或者长度相同且至少有一个字符不同便是本质不同) 2.求串S内每一个本质不同回文串出现的次数 3.求串S内回文串的个数(其实就是1和2结合起来) 4.求以下标i结尾的回文串的个数 参考资料: Palindromic Tree 阅读全文
posted @ 2021-01-20 20:40 Yiduuannng 阅读(60) 评论(0) 推荐(0)
摘要:描述 传送门:我是传送门 当太阳的光辉逐渐被月亮遮蔽,世界失去了光明,大地迎来最黑暗的时刻。。。。在这样的时刻,人们却异常兴奋——我们能在有生之年看到500年一遇的世界奇观,那是多么幸福的事儿啊~~但网路上总有那么些网站,开始借着民众的好奇心,打着介绍日食的旗号,大肆传播病毒。小t不幸成为受害者之一 阅读全文
posted @ 2021-01-20 20:35 Yiduuannng 阅读(87) 评论(0) 推荐(0)
摘要:应用场景 多模式匹配问题 多串匹配一个串 预定义 1 const int N = 1e6+100; 2 char s[N],m[N]; 3 struct node 4 { 5 int son[26]; 6 int fail; 7 int count; 8 }ac[N]; 9 int tot = 0; 阅读全文
posted @ 2021-01-20 20:34 Yiduuannng 阅读(54) 评论(0) 推荐(0)
摘要:描述 传送门:我是传送门 During tea-drinking, princess, amongst other things, asked why has such a good-natured and cute Dragon imprisoned Lpl in the Castle? Drag 阅读全文
posted @ 2021-01-20 20:32 Yiduuannng 阅读(118) 评论(0) 推荐(0)
摘要:描述 传送门:我是传送门 A prefix of a string is a substring starting at the beginning of the given string. The prefixes of “carbon” are: “c”, “ca”, “car”, “carb” 阅读全文
posted @ 2021-01-20 20:30 Yiduuannng 阅读(108) 评论(0) 推荐(0)
摘要:描述 传送门:我是传送门 Ignatius最近遇到一个难题,老师交给他很多单词(只有小写字母组成,不会有重复的单词出现),现在老师要他统计出以某个字符串为前缀的单词数量(单词本身也是自己的前缀). 输入 输入数据的第一部分是一张单词表,每行一个单词,单词的长度不超过10,它们代表的是老师交给Igna 阅读全文
posted @ 2021-01-20 18:20 Yiduuannng 阅读(63) 评论(0) 推荐(0)
摘要:字典树 预定义 1 const int N = 1e6+10; 2 int tot = 1; 3 struct node 4 { 5 int son[26]; 6 int cnt; // 特殊标记 7 bool have; 8 node() 9 { 10 memset(son,0,sizeof so 阅读全文
posted @ 2021-01-20 18:16 Yiduuannng 阅读(86) 评论(0) 推荐(0)
摘要:描述 传送门:我是传送门 John is a manager of a CPU chip factory, the factory produces lots of chips everyday. To manage large amounts of products, every processo 阅读全文
posted @ 2021-01-20 18:14 Yiduuannng 阅读(52) 评论(0) 推荐(0)
摘要:描述 传送门:我是传送门 最经,skyzhong得到了一本好厉害的字典,这个字典里整整有n个单词(1<=n<=200000) 现在skyzhong需要在字典里查询以某一段字母开头的单词 如:skyzhong想查询a 那么只要是a开头的单词就可以了 skyzhong只想知道里面有没有这一个单词(因为没 阅读全文
posted @ 2021-01-20 18:12 Yiduuannng 阅读(124) 评论(0) 推荐(0)
摘要:描述 参考资料: Manacher算法 - 经典算法与数据结构 - SegmentFault 思否 hdu3068之manacher算法+详解 代码 头部 1 #include <cstring> 2 #include <algorithm> 3 4 const int N = 1e5+10; 5 阅读全文
posted @ 2021-01-20 18:10 Yiduuannng 阅读(44) 评论(0) 推荐(0)
摘要:概述 参考资料: 字符串匹配—最大最小表示法 最小表示法和最大表示法模板 最小(大)表示法是字符串问题中不同于匹配与失配的另一种O(n)的算法,它主要解决的是字符串的同构问题。将单个字符串循环左移右移算作该串的同构,最小(大)表示法能够在O(n)时间内求出这个串的所有同构串中的字典序最小的串的起始位 阅读全文
posted @ 2021-01-20 18:08 Yiduuannng 阅读(115) 评论(0) 推荐(0)
摘要:费马小定理 结论 假如p是质数,且gcd(a,p)=1,那么 a(p-1)≡1(mod p)。 即:假如a是整数,p是质数,且a,p互质(即两者只有一个公约数1),那么a的(p-1)次方除以p的余数恒等于1。 证明:传送门 推论:对于任意正整数a,有a^p ≡ a (mod p),因为a能被p整除时 阅读全文
posted @ 2021-01-20 18:05 Yiduuannng 阅读(362) 评论(0) 推荐(0)
摘要:描述 1 import java.util.*; 2 import java.math.*; 3 4 public class Main{ 5 public static void main(String [] args){ 6 Scanner in = new Scanner(System.in) 阅读全文
posted @ 2021-01-20 18:03 Yiduuannng 阅读(56) 评论(0) 推荐(0)
摘要:概述 参考资料: 刘雅琼PPT讲解kuangbin的博客 给出模板串A和子串B,长度分别为lenAlenA和lenBlenB,要求在线性时间内,对于每个A[i]A[i](0<=i<lenA)(0<=i<lenA) 求出A[i..lenA−1]A[i..lenA−1] 与B的最长公共前缀长度,记为ex 阅读全文
posted @ 2021-01-20 17:57 Yiduuannng 阅读(83) 评论(0) 推荐(0)
摘要:概述 模板出自kuangbin的博客 典型应用: 给你两个字符串,寻找其中一个字符串是否包含另一个字符串,如果包含,返回包含的起始位置。 (1) 头文件 1 #include <bits/stdc++.h> 2 using namespace std; 3 const int N = 1e5+10; 阅读全文
posted @ 2021-01-20 17:56 Yiduuannng 阅读(72) 评论(0) 推荐(0)
摘要:牛客多校 牛客多校第一场 J Different Integers 离线树状数组 牛客多校第二场 J farm 二维树状数组 牛客多校第三场 C Shuffle Cards rope(看脸)、Splay(区间反转)、Treap E Sort String 字符串hash / KMP找循环节 牛客多校 阅读全文
posted @ 2021-01-20 17:52 Yiduuannng 阅读(66) 评论(0) 推荐(0)
摘要:概述 线段树,类似区间树,它在各个节点保存一条线段(数组中的一段子数组),主要用于高效解决连续区间的动态查询问题,由于二叉结构的特性,它基本能保持每个操作的复杂度为O(logn)O(logn)。 (0) 定义 1 const int INF = 0x3f3f3f3f; 2 const int MAX 阅读全文
posted @ 2021-01-20 17:51 Yiduuannng 阅读(166) 评论(0) 推荐(0)
摘要:描述 传送门:P4375 传送门:UPC6347 留意着农场之外的长期职业生涯的可能性,奶牛Bessie开始在不同的在线编程网站上学习算法。 她到目前为止最喜欢的算法是“冒泡排序”。这是Bessie的对长度为 NN 的数组 AA进行排序的奶牛码实现。 12345678 sorted = falsew 阅读全文
posted @ 2021-01-20 17:48 Yiduuannng 阅读(77) 评论(0) 推荐(0)
摘要:Bone Collector 描述 传送门:Bone Collector Many years ago , in Teddy’s hometown there was a man who was called “Bone Collector”. This man like to collect va 阅读全文
posted @ 2021-01-20 17:45 Yiduuannng 阅读(81) 评论(0) 推荐(0)
摘要:Miller_Rabin算法(素数判定) 作用 单独判断一个大数是否素数。缺点他是一个不保证正确的算法,我们只能通过多次执行算法让这个错误的概率很小,不过幸运的是通常来看它的错误概率可以小到忽略不计。 补充:【模板】素数测试(Miller-Rabin测试) 算法的理论基础 Fermat定理:若n是奇 阅读全文
posted @ 2021-01-20 17:39 Yiduuannng 阅读(170) 评论(0) 推荐(0)
摘要:描述 传送门: F. Divisions David is a young boy and he loves numbers. Recently he learned how to divide two numbers. David divides the whole day. He is happ 阅读全文
posted @ 2021-01-20 17:35 Yiduuannng 阅读(74) 评论(0) 推荐(0)