11 2016 档案

摘要:题意 维护一个字符串的集合$D$, 支持3种操作: 1. 插入一个字符串$s$ 2. 删除一个字符串$s$ 3. 查询一个字符串$s$在$D$中作为子串出现的次数 强制在线 解法 AC自动机+二进制分组 二进制分组 二进制分组 是一种用 (套用) 离线方法解决要求 强制在线 问题的 分块 技巧. 我 阅读全文
posted @ 2016-11-28 16:51 Pat 阅读(479) 评论(0) 推荐(0) 编辑
摘要:Committer: root 您的姓名和邮件地址基于登录名和主机名进行了自动设置。请检查它们正确 与否。您可以通过下面的命令对其进行明确地设置以免再出现本提示信息: git config global user.name "Your Name" git config global user.ema 阅读全文
posted @ 2016-11-27 17:13 Pat 阅读(2908) 评论(0) 推荐(0) 编辑
摘要:费马测试(Fermat test) Some of the cryptographic algorithms make use of big prime numbers. However, checking if a big number is prime is not so easy. Howev 阅读全文
posted @ 2016-11-24 12:58 Pat 阅读(293) 评论(0) 推荐(0) 编辑
摘要:传送门: Palindrome Index Problem Statement Problem Statement You are given a string of lower case letters. Your task is to figure out the index of the ch 阅读全文
posted @ 2016-11-22 12:58 Pat 阅读(366) 评论(0) 推荐(0) 编辑
摘要:游程编码(Run Length Coding, RLC)是串处理中常见的预处理方法。其写法是典型的双指针(Two-Pointer)。下面总结其写法1.输入为一串整数可以不把整数存在数组里 阅读全文
posted @ 2016-11-22 12:48 Pat 阅读(249) 评论(0) 推荐(0) 编辑
摘要:Problem 求 $[1 \dots N]$中素因子数最多且最小的数 $n$,$N$ 充分大。 Solution 将任意自然数 $n$ ($n>2$) 分解 $$ n = p_1^{k_1 } p_2^{k_2} p_3^{k_3} \dots P_m^{k_m} \quad (p_1<p_2< 阅读全文
posted @ 2016-11-22 12:02 Pat 阅读(387) 评论(0) 推荐(0) 编辑
摘要:传送门 Problem Statement Problem Statement You are given a tree where each node is labeled from 1 to n. How many similar pairs(S) are there in this tree? 阅读全文
posted @ 2016-11-22 11:59 Pat 阅读(315) 评论(0) 推荐(0) 编辑
摘要:Problem: 给定无序序列S:[b, e),求S中第K大的元素。 Solution 1.裸排序 2.现将区间均分成两段,S1, S2,对S1,S2分别排序,然后 阅读全文
posted @ 2016-11-22 11:57 Pat 阅读(175) 评论(0) 推荐(0) 编辑
摘要:Knights of the Round Table Time Limit: 7000MS Memory Limit: 65536K Total Submissions: 10911 Accepted: 3587 Description Being a knight is a very attrac 阅读全文
posted @ 2016-11-22 11:50 Pat 阅读(338) 评论(0) 推荐(0) 编辑
摘要:Problems (1) 给一棵带边权的树,求遍历这棵树(每个节点至少经过一次)再回到起点的最短路程。 答案是显然的:边权之和的两倍。 (2)给一棵带边权的树,求遍历这棵树(每个节点至少经过一次)的最短路程。 (3)给一棵带边权的树T(V, E ),求T的含K个节点的连通子图的边权和的最小值。 阅读全文
posted @ 2016-11-22 11:45 Pat 阅读(145) 评论(0) 推荐(0) 编辑
摘要:Finally I fully understand the augmenting-path-based algorithm for maximum bipartite matching. 阅读全文
posted @ 2016-11-22 11:45 Pat 阅读(372) 评论(0) 推荐(0) 编辑
摘要:传送门 Problem Statement Ms.Kox enjoys her job, but she does not like to waste extra time traveling to and from her office. After working for many years, 阅读全文
posted @ 2016-11-22 11:43 Pat 阅读(580) 评论(0) 推荐(0) 编辑
摘要:##[1001.Average](http://acm.hdu.edu.cn/showproblem.php?pid=5353) Summary $n$ people are sitting around a circle and every two adjacent people can exch 阅读全文
posted @ 2016-11-22 11:12 Pat 阅读(359) 评论(0) 推荐(0) 编辑
摘要:Overview 给出平面上两两不重合的$n$个整点, 求每个点到它在其他$n 1$个点的最近临点的欧几里得距离的平方. Solution k d tree 模板题. 关于k d tree, 见 "这篇博客" . Implementation c++ include define lson id 1 阅读全文
posted @ 2016-11-21 20:48 Pat 阅读(154) 评论(0) 推荐(0) 编辑
摘要:这篇随笔是对Wikipedia上 "k d tree" 词条的摘录, 我认为对该词条解释相当生动详细, 是不可多得的好文. Overview A $k$ d tree (short for $k$ dimensional tree) is a binary space partitioning tr 阅读全文
posted @ 2016-11-21 19:41 Pat 阅读(223) 评论(0) 推荐(0) 编辑
摘要:"pyx的难题" 被这题搞得生无可恋. 容易看出 题目完成时间与优先级之间的关系是单调的,故可以二分答案. 用于二分的答案可以取$O(n)$个离散值, 这样就很方便地保证了优先级各不相同. 可以用优先队列模拟, $O(n\log(n))$判断. 总复杂度是$O(n \log^2(n))$, 只能通过 阅读全文
posted @ 2016-11-16 17:04 Pat 阅读(228) 评论(0) 推荐(0) 编辑
摘要:见此 "链接" . 阅读全文
posted @ 2016-11-14 11:21 Pat 阅读(195) 评论(0) 推荐(0) 编辑
摘要:"传送门" Solution DP+滚动数组. DP状态 $dp[i][j][k]$: $A$的第$i$个字符和$B$的第$j$个字符匹配且该字符在第$k$个子串中的方案数. 转移方程 $dp[0][0][0]=1$ $dp[i][j][k] = dp[i 1][j 1][k] + \sum\lim 阅读全文
posted @ 2016-11-12 21:43 Pat 阅读(113) 评论(0) 推荐(0) 编辑
摘要:在 The C++ Programming Language, 4th. Edition , pp. 66 上读到一句话, 半天没反应过来: A container that implements the functions required by the interface defined by 阅读全文
posted @ 2016-11-11 19:10 Pat 阅读(145) 评论(0) 推荐(0) 编辑
摘要:问题1 给出一个$1 \sim n$的全排列$P$, 求它是所有全排列的第几个 (0 based)? 做法 从左到右看$P$的每一位, 考虑当前可以确认有多少全排列在$P$之前. $ $: 所有第一位是$1 \sim P_1 1$的排列都在$P$之前, 共有 $(P_1 1)(n 1)!$个. $P 阅读全文
posted @ 2016-11-07 15:58 Pat 阅读(141) 评论(0) 推荐(0) 编辑
摘要:Most of this note comes from the Beginning the Linux Command Line, Second Edition by Sander van Vugt The only reason why many administrators are using 阅读全文
posted @ 2016-11-06 15:32 Pat 阅读(194) 评论(0) 推荐(0) 编辑
摘要:多队列模拟. 与POJ 1025 Department类似, 不过简化很多. 貌似这类模拟题经常出现. 用STL中的优先队列 ( ) 很好写. 这题我写得很不顺, 老年选手退步太快, 记录一下我犯的一个很隐蔽的错误, 从前对此毫无认识, 想想都可怕, 太菜了. 这道题优先队列里维护的事件 (even 阅读全文
posted @ 2016-11-03 21:56 Pat 阅读(170) 评论(0) 推荐(0) 编辑
摘要:Reference Web cites for the C++ standard library 1. "cppreference" 2. "cplusplus" 3. "sgi" 4. "IBM" 5. "MSDN" 6. "isocpp" More resources at this "page 阅读全文
posted @ 2016-11-03 15:51 Pat 阅读(324) 评论(0) 推荐(0) 编辑
摘要:Useful Linux Utilities (This article is under constant construction) 1. ssh 相关文章 "How To Change OpenSSH Port On CentOS 7" 2. semanage 相关文章 "RHEL7.0修改S 阅读全文
posted @ 2016-11-03 13:53 Pat 阅读(251) 评论(0) 推荐(0) 编辑
摘要:1. 登录系统: 2. 查看当前用户列表: 3. 查看数据库列表: 4. 进入某数据库: 5. 查看某数据库中的数据表: `show tables;` 阅读全文
posted @ 2016-11-02 04:12 Pat 阅读(154) 评论(0) 推荐(0) 编辑
摘要:最近在调试OJ, 忙了4天多, 最后的问题是judge模块不能正常工作. judge 模块就是两个C++源文件, 它的工作是 1. 从数据库获取用户提交的源码 2. 测评 3. 将测评结果写到数据库 测评部分是与数据库无关的, 我遇到的问题是C++和数据库无法建立连接. 这个问题根源于我用的是LAM 阅读全文
posted @ 2016-11-01 23:08 Pat 阅读(180) 评论(0) 推荐(0) 编辑
摘要:( This article is under constant construction ) DISCLAIMER: 本文的主要内容来自 "https://gcc.gnu.org/onlinedocs/gcc/" 这篇随笔主要记录有关build C/C++程序的知识. 包括 gcc/g++ 的各个 阅读全文
posted @ 2016-11-01 17:52 Pat 阅读(1291) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示