10 2018 档案

摘要:题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1241 题意: 求某块平面上,连通块的数量。一个油田格子若周围八个方向也有一个油田格子,则认为两者相连通。 AC代码: 阅读全文
posted @ 2018-10-31 16:44 Dilthey 阅读(158) 评论(0) 推荐(0) 编辑
摘要:题目链接:http://poj.org/problem?id=3984 Description 定义一个二维数组: int maze[5][5] = { 0, 1, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 1, 0 阅读全文
posted @ 2018-10-31 15:40 Dilthey 阅读(442) 评论(0) 推荐(0) 编辑
摘要:题目链接:https://cn.vjudge.net/problem/UVA-11624 题意: 给出一个 $n \times m$ 的矩阵,上面有的格子能走,有的格子是墙不能走。 有若干个点是火源,火每分钟都往上下左右蔓延一格(不能越墙)。又给出一个点是Joe的出发点,他只要能在不碰到火的前提下走 阅读全文
posted @ 2018-10-31 00:24 Dilthey 阅读(338) 评论(0) 推荐(0) 编辑
摘要:Fat brother and Maze are playing a kind of special (hentai) game on an N*M board (N rows, M columns). At the beginning, each grid of this board is con 阅读全文
posted @ 2018-10-30 22:26 Dilthey 阅读(2217) 评论(0) 推荐(0) 编辑
摘要:题目链接:http://codeforces.com/gym/101873/problem/G 题意: 在点阵上,给出 $N$ 个点的坐标(全部都是在格点上),将它们按顺序连接可以构成一个多边形,求该多边形内包含的格点的数目。 题解: 首先,根据皮克定理 $S = a + \frac{b}{2} - 阅读全文
posted @ 2018-10-29 23:26 Dilthey 阅读(784) 评论(0) 推荐(0) 编辑
摘要:题目链接:http://poj.org/problem?id=3414 Time Limit: 1000MS Memory Limit: 65536K Description You are given two pots, having the volume of A and B liters re 阅读全文
posted @ 2018-10-29 21:15 Dilthey 阅读(343) 评论(0) 推荐(0) 编辑
摘要:题目链接:http://poj.org/problem?id=3087 Description A common pastime for poker players at a poker table is to shuffle stacks of chips. Shuffling chips is 阅读全文
posted @ 2018-10-29 20:00 Dilthey 阅读(235) 评论(0) 推荐(0) 编辑
摘要:题目链接:http://poj.org/problem?id=3126 题意: 给定两个四位素数 $a,b$,要求把 $a$ 变换到 $b$。变换的过程每次只能改动一个数,要保证每次变换出来的数都是一个没有前导零的四位素数。 要求每步得到的素数都不能重复,求从 $a$ 到 $b$ 最少需要变换多少步 阅读全文
posted @ 2018-10-28 23:44 Dilthey 阅读(145) 评论(0) 推荐(0) 编辑
摘要:题目链接:http://codeforces.com/gym/101775/problem/C 题意: 给出 $N$ 个红绿灯,又给出 $N+1$ 个距离 $S_i = S_0,S_1, \cdots, S_N$,代表从第 $i$ 个路灯到第 $i+1$ 个路灯的距离(第 $0$ 个距离代表从家到第 阅读全文
posted @ 2018-10-28 00:27 Dilthey 阅读(774) 评论(0) 推荐(0) 编辑
摘要:题目链接:http://codeforces.com/gym/101775/problem/B Aori is very careless so she is always making troubles. One day she does it again, with N big troubles 阅读全文
posted @ 2018-10-28 00:07 Dilthey 阅读(501) 评论(0) 推荐(0) 编辑
摘要:题目链接:http://codeforces.com/gym/101775/problem/A It is said that a dormitory with 6 persons has 7 chat groups ^_^. But the number can be even larger: s 阅读全文
posted @ 2018-10-27 23:41 Dilthey 阅读(843) 评论(0) 推荐(1) 编辑
摘要:链接:http://codeforces.com/contest/1068 A - Birthday - [计算题] 题意:一共 $N$ 种硬币,我已经有其中 $K$ 种,我的 $M$ 个朋友每人送我等数量的硬币,且送来的每一枚硬币都不属于同一种,要求最后我收到手上的硬币至少有 $L$ 种是我没有的 阅读全文
posted @ 2018-10-25 23:32 Dilthey 阅读(1093) 评论(0) 推荐(0) 编辑
摘要:题目链接:https://www.lydsy.com/JudgeOnline/problem.php?id=1003 Time Limit: 10 Sec Memory Limit: 162 MB Description 物流公司要把一批货物从码头A运到码头B。由于货物量比较大,需要n天才能运完。货 阅读全文
posted @ 2018-10-25 00:00 Dilthey 阅读(310) 评论(0) 推荐(0) 编辑
摘要:题目链接:https://www.nowcoder.com/acm/contest/211/E 题目描述 请实现一个数据结构支持以下操作:区间循环左右移,区间与,区间或,区间求和。 输入描述: 第一行n,q表示数列长度及操作次数。第二行n个数表示初始序列。接下来q行表示操作。 操作格式如下:一行表示 阅读全文
posted @ 2018-10-23 00:50 Dilthey 阅读(387) 评论(0) 推荐(0) 编辑
摘要:题目链接:http://poj.org/problem?id=1179 Time Limit: 1000MS Memory Limit: 10000K Description Polygon is a game for one player that starts on a polygon with 阅读全文
posted @ 2018-10-21 22:31 Dilthey 阅读(245) 评论(2) 推荐(0) 编辑
摘要:链接:http://codeforces.com/contest/1072/ A - Golden Plate - [计算题] B - Curiosity Has No Limits - [DFS] 对于常数 $C_1,C_2$ 和变量 $x,y$ 的方程组: $\left\{ {\begin{ar 阅读全文
posted @ 2018-10-21 21:07 Dilthey 阅读(580) 评论(4) 推荐(0) 编辑
摘要:题目链接:http://acm.xidian.edu.cn/problem.php?id=1046 题目描述 请输出两个数的和,差,积,商,取余。注意不要有前导零。 输入 多组数据,每组数据是两个整数A,B(0<=A<=10^100,0<B<=10^100). 输出 对于每组数据,输出五个整数,分别 阅读全文
posted @ 2018-10-21 15:08 Dilthey 阅读(262) 评论(0) 推荐(0) 编辑
摘要:题目链接:https://www.lydsy.com/JudgeOnline/problem.php?id=1002 Description 轮状病毒有很多变种,所有轮状病毒的变种都是从一个轮状基产生的。一个N轮状基由圆环上N个不同的基原子和圆心处一个核原子构成的,2个原子之间的边表示这2个原子之间 阅读全文
posted @ 2018-10-21 14:54 Dilthey 阅读(175) 评论(0) 推荐(0) 编辑
摘要:题目链接:https://www.lydsy.com/JudgeOnline/problem.php?id=1001 Description现在小朋友们最喜欢的"喜羊羊与灰太狼",话说灰太狼抓羊不到,但抓兔子还是比较在行的,而且现在的兔子还比较笨,它们只有两个窝,现在你做为狼王,面对下面这样一个网格 阅读全文
posted @ 2018-10-21 10:44 Dilthey 阅读(247) 评论(0) 推荐(0) 编辑
摘要:题目链接:https://www.lydsy.com/JudgeOnline/problem.php?id=1500 题目链接:https://www.luogu.org/problemnew/show/P2042 Description 请写一个程序,要求维护一个数列,支持以下 6 种操作: 请注 阅读全文
posted @ 2018-10-20 23:37 Dilthey 阅读(192) 评论(0) 推荐(0) 编辑
摘要:题目链接:https://www.nowcoder.com/acm/contest/211/B 题目描述 炎热的早上,gal男神们被迫再操场上列队,gal男神们本来想排列成x∗x的正方形,可是因为操场太小了(也可能是gal男神太大了),校长安排gal男神们站成多个4∗4的正方形(gal男神们可以正好 阅读全文
posted @ 2018-10-20 15:41 Dilthey 阅读(200) 评论(0) 推荐(0) 编辑
摘要:题目链接:https://www.lydsy.com/JudgeOnline/problem.php?id=3224 Description 您需要写一种数据结构(可参考题目标题),来维护一些数,其中需要提供以下操作:1. 插入x数2. 删除x数(若有多个相同的数,因只删除一个)3. 查询x数的排名 阅读全文
posted @ 2018-10-19 14:25 Dilthey 阅读(234) 评论(0) 推荐(0) 编辑
摘要:题目链接:https://www.lydsy.com/JudgeOnline/problem.php?id=1150 Time Limit: 10 Sec Memory Limit: 162 M Description 你在一家 IT 公司为大型写字楼或办公楼(offices)的计算机数据做备份。然 阅读全文
posted @ 2018-10-18 23:36 Dilthey 阅读(297) 评论(0) 推荐(0) 编辑
摘要:题目链接:http://poj.org/problem?id=2442 Time Limit: 6000MS Memory Limit: 65536K Description Given m sequences, each contains n non-negative integer. Now w 阅读全文
posted @ 2018-10-17 23:09 Dilthey 阅读(775) 评论(0) 推荐(0) 编辑
摘要:1、引言 《算法竞赛进阶指南》中指出,在二叉树中,有两组非常重要的条件,分别是两类数据结构的基本性质。 其一是“堆性质”,若二叉树中的任意一个节点的权值都大于等于(小于等于)其父亲节点,则称该二叉树满足“小顶堆性质(大顶堆性质)”。 其二是“BST性质”,二叉树上的每个节点都带有一个数值,称为该节点 阅读全文
posted @ 2018-10-16 23:56 Dilthey 阅读(980) 评论(0) 推荐(0) 编辑
摘要:题目链接:http://poj.org/problem?id=1456 Time Limit: 2000MS Memory Limit: 65536K Description A supermarket has a set Prod of products on sale. It earns a p 阅读全文
posted @ 2018-10-16 23:47 Dilthey 阅读(693) 评论(0) 推荐(0) 编辑
摘要:题目链接:http://poj.org/problem?id=1741 Time Limit: 1000MS Memory Limit: 30000K Description Give a tree with n vertices, each edge has a length(positive i 阅读全文
posted @ 2018-10-16 13:09 Dilthey 阅读(332) 评论(0) 推荐(0) 编辑
摘要:链接:http://poj.org/problem?id=1655 Time Limit: 1000MS Memory Limit: 65536K Description Consider a tree T with N (1 <= N <= 20,000) nodes numbered 1...N 阅读全文
posted @ 2018-10-16 12:30 Dilthey 阅读(257) 评论(0) 推荐(0) 编辑
摘要:题目链接:传送门 描述在一片广袤无垠的原野上,散落着N块磁石。每个磁石的性质可以用一个五元组(x,y,m,p,r)描述,其中x,y表示其坐标,m是磁石的质量,p是磁力,r是吸引半径。若磁石A与磁石B的距离不大于磁石A的吸引半径,并且磁石B的质量不大于磁石A的磁力,那么A可以吸引B。小取酒带着一块自己 阅读全文
posted @ 2018-10-15 13:02 Dilthey 阅读(548) 评论(0) 推荐(0) 编辑
摘要:题目链接:https://www.luogu.org/problemnew/show/P1494 题目描述 作为一个生活散漫的人,小Z每天早上都要耗费很久从一堆五颜六色的袜子中找出一双来穿。终于有一天,小Z再也无法忍受这恼人的找袜子过程,于是他决定听天由命…… 具体来说,小Z把这N只袜子从1到N编号 阅读全文
posted @ 2018-10-15 01:25 Dilthey 阅读(333) 评论(0) 推荐(0) 编辑
摘要:题目链接:https://leetcode-cn.com/problems/container-with-most-water/description/ 给定 n 个非负整数 $a_1,a_2,\cdots,a_{n-1},a_n$,每个数代表坐标中的一个点 $(i, a_i)$。在坐标内画 n 条 阅读全文
posted @ 2018-10-14 23:14 Dilthey 阅读(369) 评论(0) 推荐(0) 编辑
摘要:题目链接:传送门 题目链接:https://www.luogu.org/problemnew/show/P4168 题解: 经典的在线求区间众数的问题,由于区间众数不满足区间可加性,所以考虑分块,假设分块长度为 $S$,则总共分成 $T=N/S$ 块, 对于每个询问 $[l,r]$,设点 $l$ 在 阅读全文
posted @ 2018-10-14 17:41 Dilthey 阅读(308) 评论(0) 推荐(0) 编辑
摘要:题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=6229 转载: https://blog.csdn.net/Anna__1997/article/details/78494788 题目大意 N * N的区域内,有K个格子不能到达,机器人从(0, 0)出 阅读全文
posted @ 2018-10-13 22:47 Dilthey 阅读(637) 评论(0) 推荐(0) 编辑
摘要:题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=6228 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 262144/262144 K (Java/Others) Problem Descrip 阅读全文
posted @ 2018-10-13 22:37 Dilthey 阅读(283) 评论(0) 推荐(0) 编辑
摘要:题目链接:https://nanti.jisuanke.com/t/31436 作为一名车手,为了提高自身的姿势水平,平时的练习是必不可少的。小 J 每天的训练包含 $N$ 个训练项目,他会按照某个顺序依次练习这些项目。出于一些玄妙的原因,训练的效果跟项目的顺序有着很大关系。当项目 $i$ 被安排在 阅读全文
posted @ 2018-10-12 12:32 Dilthey 阅读(282) 评论(0) 推荐(0) 编辑
摘要:题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5992 题目链接:https://www.nowcoder.com/acm/contest/207/K Problem DescriptionThere are N hotels all over the 阅读全文
posted @ 2018-10-12 11:57 Dilthey 阅读(267) 评论(0) 推荐(0) 编辑
摘要:本文参考: https://www.cnblogs.com/GerynOhenz/p/8727415.html kuangbin的ACM模板(新) 题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4347 Problem Description The 阅读全文
posted @ 2018-10-11 13:11 Dilthey 阅读(597) 评论(0) 推荐(0) 编辑
摘要:题目链接:传送门 描述 后缀数组 (SA) 是一种重要的数据结构,通常使用倍增或者DC3算法实现,这超出了我们的讨论范围。 在本题中,我们希望使用快排、Hash与二分实现一个简单的 $O(n \log^2 ⁡n )$ 的后缀数组求法。 详细地说,给定一个长度为 n 的字符串S(下标 0~n-1),我 阅读全文
posted @ 2018-10-08 23:58 Dilthey 阅读(457) 评论(0) 推荐(0) 编辑
摘要:题目链接:https://nanti.jisuanke.com/t/31434 小 D 是一位著名的车手,他热衷于在广场上飙车。每年儿童节过后,小 D 都会在广场上举行一场别样的车技大赛。 小 D 所在的广场可以看作一个 W×H 的网格,初始时小 D 位于左下角的 (1,1) 处,他的目的地是位于右 阅读全文
posted @ 2018-10-08 22:53 Dilthey 阅读(488) 评论(0) 推荐(1) 编辑
摘要:题目链接:https://leetcode-cn.com/problems/median-of-two-sorted-arrays/description/ 给定两个大小为 m 和 n 的有序数组 nums1 和 nums2 。 请找出这两个有序数组的中位数。要求算法的时间复杂度为 O(log (m 阅读全文
posted @ 2018-10-08 20:05 Dilthey 阅读(640) 评论(0) 推荐(0) 编辑
摘要:题目链接:https://www.nowcoder.com/acm/contest/207/D 题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5985 时间限制:C/C++ 1秒,其他语言2秒空间限制:C/C++ 262144K,其他语言524288K 阅读全文
posted @ 2018-10-08 15:58 Dilthey 阅读(284) 评论(0) 推荐(0) 编辑
摘要:题目链接:https://www.nowcoder.com/acm/contest/207/G 题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5988 时间限制:C/C++ 2秒,其他语言4秒空间限制:C/C++ 262144K,其他语言524288K 阅读全文
posted @ 2018-10-07 20:59 Dilthey 阅读(311) 评论(0) 推荐(0) 编辑
摘要:题目链接:https://www.nowcoder.com/acm/contest/206/A 题目描述 恬恬的生日临近了。宇扬给她准备了一个蛋糕。正如往常一样,宇扬在蛋糕上插了n支蜡烛,并把蛋糕分为m个区域。因为某种原因,他必须把第i根蜡烛插在第ai个区域或第bi个区域。区域之间是不相交的。宇扬在 阅读全文
posted @ 2018-10-07 08:09 Dilthey 阅读(168) 评论(0) 推荐(0) 编辑
摘要:题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1166 题解: 本题作为一个模板题,我用它来检验过总查询时间复杂度为 $O(q \log n)$ 的树状数组模板、线段树模板以及zkw线段树模板;而今天,我们要来用分块来写这道题目。 时间复杂度: 初始化 阅读全文
posted @ 2018-10-06 01:31 Dilthey 阅读(289) 评论(0) 推荐(0) 编辑