自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 Nim 游戏及其变形

Nim 在博弈中经常出现,很多看似复杂的题目,在分析和变形之后就回归了最初的nim游戏。经典的nim游戏一共有N堆石子,编号1..n,第i堆中有个a[i]个石子。每一次操作Alice和Bob可以从任意一堆石子中取出任意数量的石子,至少取一颗,至多取出这一堆剩下的所有石子。两个人轮流行动,取走最后一个的人胜利。Alice为先手。我们定义PositionP:表示当前局面

2016-12-22 20:25:37 18247 6

原创 bzoj 4520: [Cqoi2016]K远点对(KD-tree)

4520: [Cqoi2016]K远点对Time Limit: 30 Sec  Memory Limit: 512 MBSubmit: 628  Solved: 334[Submit][Status][Discuss]Description已知平面内 N 个点的坐标,求欧氏距离下的第 K 远点对。Input输入文件第一行为用空格隔开的两个整数 N, K。

2016-12-30 10:45:11 389

原创 bzoj 4034: [HAOI2015]树上操作 (树链剖分)

4034: [HAOI2015]树上操作Time Limit: 10 Sec  Memory Limit: 256 MBSubmit: 3553  Solved: 1118[Submit][Status][Discuss]Description有一棵点数为 N 的树,以点 1 为根,且树点有边权。然后有 M 个操作,分为三种:操作 1 :把某个节点 x 的点权增加

2016-12-30 10:16:01 683

原创 bzoj 3230: 相似子串 (后缀数组+RMQ+二分)

3230: 相似子串Time Limit: 20 Sec  Memory Limit: 128 MBSubmit: 1502  Solved: 364[Submit][Status][Discuss]DescriptionInput输入第1行,包含3个整数N,Q。Q代表询问组数。第2行是字符串S。接下来Q行,每行两个整数i和j。(1≤i≤j)。

2016-12-29 23:31:36 414

原创 bzoj 2251: [2010Beijing Wc]外星联络 (后缀数组)

2251: [2010Beijing Wc]外星联络Time Limit: 30 Sec  Memory Limit: 256 MBSubmit: 769  Solved: 459[Submit][Status][Discuss]Description小 P 在看过电影《超时空接触》(Contact)之后被深深的打动,决心致力于寻找外星人的事业。于是,他每天晚上都爬在屋

2016-12-29 20:35:01 356

原创 poj 1226 Substrings (后缀数组)

SubstringsTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 13919 Accepted: 4922DescriptionYou are given a number of case-sensitive strings of alphabetic

2016-12-29 19:26:47 492

原创 spoj 220 PHRASES - Relevant Phrases of Annihilation(后缀数组)

PHRASES - Relevant Phrases of Annihilationno tags You are the King of Byteland. Your agents have just intercepted a batch of encrypted enemy messages concerning the date of the planned a

2016-12-29 11:17:41 463

原创 poj 3294 Life Forms (后缀数组)

Life FormsTime Limit: 5000MS Memory Limit: 65536KTotal Submissions: 15125 Accepted: 4437DescriptionYou may have wondered why most extraterrestrial life forms rese

2016-12-29 10:22:43 249

原创 poj 3415 Common Substrings (后缀数组+单调栈)

Common SubstringsTime Limit: 5000MS Memory Limit: 65536KTotal Submissions: 10446 Accepted: 3444DescriptionA substring of a string T is defined as:T(i, k)=TiTi

2016-12-29 09:09:48 475

原创 poj 3693 Maximum repetition substring (后缀数组+RMQ)

Maximum repetition substringTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 9455 Accepted: 2913DescriptionThe repetition number of a string is defined a

2016-12-28 22:36:43 416

原创 poj 2406 Power Strings (后缀数组)

Power StringsTime Limit: 3000MS Memory Limit: 65536KTotal Submissions: 45998 Accepted: 19230DescriptionGiven two strings a and b we define a*b to be their concate

2016-12-28 20:04:52 736 2

原创 URAL 1297 Palindrome (后缀数组)

题目链接#include#include#include#include#define N 100003using namespace std;int n,m,k,len,sa[N],rank[N],height[N],xx[N],yy[N],*x,*y,p;int b[N],c[N],a[N],st[20][N],l[N];char s[N];int cmp(int

2016-12-28 19:34:05 358

原创 spoj 694 DISUBSTR - Distinct Substrings (后缀数组)

DISUBSTR - Distinct Substringsno tags Given a string, we need to find the total number of its distinct substrings.InputT- number of test cases. TEach test case consists of one st

2016-12-28 17:32:16 319

原创 poj 3261 Milk Patterns (后缀数组)

Milk PatternsTime Limit: 5000MS Memory Limit: 65536KTotal Submissions: 14691 Accepted: 6535Case Time Limit: 2000MSDescriptionFarmer John has noticed that th

2016-12-28 17:18:45 327

原创 poj 1743 Musical Theme (后缀数组)

Musical ThemeTime Limit: 1000MS Memory Limit: 30000KTotal Submissions: 27581 Accepted: 9301DescriptionA musical melody is represented as a sequence of N (1<=N<=20

2016-12-28 16:37:15 270

原创 UOJ #35 后缀排序(后缀数组)

题目链接题解:后缀数组板子之前学后缀数组只是学了个大概,而且写的是二维的。现在从头理一遍,改成了算法导论上的写法。。#include#include#include#include#define N 100003using namespace std;int rank[N],sa[N],xx[N],yy[N],*x,*y,height[N],b[N],a[N],p,

2016-12-28 10:54:47 1240

转载 Kd-Tree算法原理和开源实现代码

Kd-Tree算法原理和开源实现代码 本文介绍一种用于高维空间中的快速最近邻和近似最近邻查找技术——Kd-Tree(Kd树)。Kd-Tree,即K-dimensional tree,是一种高维索引树形数据结构,常用于在大规模的高维数据空间进行最近邻查找(Nearest Neighbor)和近似最近邻查找(Approximate Nearest Neighbor),例如图像检索和

2016-12-28 09:23:59 360

原创 bzoj 2626: JZPFAR (KD-tree)

2626: JZPFARTime Limit: 50 Sec  Memory Limit: 128 MBSubmit: 961  Solved: 362[Submit][Status][Discuss]Description  平面上有n个点。现在有m次询问,每次给定一个点(px, py)和一个整数k,输出n个点中离(px, py)的距离第k大的点的标号。如果有两个(或

2016-12-28 09:08:32 473

原创 bzoj 2683: 简单题 (KD-tree)

2683: 简单题Time Limit: 50 Sec  Memory Limit: 128 MBSubmit: 1098  Solved: 436[Submit][Status][Discuss]Description你有一个N*N的棋盘,每个格子内有一个整数,初始时的时候全部为0,现在需要维护两种操作: 命令参数限制内容

2016-12-28 07:53:55 342

原创 bzoj 4066: 简单题 (KD-tree)

4066: 简单题Time Limit: 50 Sec  Memory Limit: 20 MBSubmit: 2225  Solved: 592[Submit][Status][Discuss]Description你有一个N*N的棋盘,每个格子内有一个整数,初始时的时候全部为0,现在需要维护两种操作: 命令参数限制内容

2016-12-27 21:58:21 601

原创 bzoj 2850: 巧克力王国 (KD-tree)

2850: 巧克力王国Time Limit: 60 Sec  Memory Limit: 512 MBSubmit: 504  Solved: 203[Submit][Status][Discuss]Description巧克力王国里的巧克力都是由牛奶和可可做成的。但是并不是每一块巧克力都受王国人民的欢迎,因为大家都不喜欢过于甜的巧克力。对于每一块巧克力,我们设

2016-12-27 20:21:02 475

原创 bzoj 3053: The Closest M Points (KD-tree)

3053: The Closest M PointsTime Limit: 10 Sec  Memory Limit: 128 MBSubmit: 863  Solved: 310[Submit][Status][Discuss]DescriptionThe course of Software Design and Development Practice is obje

2016-12-27 19:09:20 466

原创 bzoj 1941: [Sdoi2010]Hide and Seek (KD-tree)

1941: [Sdoi2010]Hide and SeekTime Limit: 16 Sec  Memory Limit: 162 MBSubmit: 1001  Solved: 524[Submit][Status][Discuss]Description小猪iPig在PKU刚上完了无聊的猪性代数课,天资聪慧的iPig被这门对他来说无比简单的课弄得非常寂寞,为了消除寂寞

2016-12-27 09:17:56 371

原创 bzoj 2648: SJY摆棋子 (KD-tree)

2648: SJY摆棋子Time Limit: 20 Sec  Memory Limit: 128 MBSubmit: 3152  Solved: 1078[Submit][Status][Discuss]Description这天,SJY显得无聊。在家自己玩。在一个棋盘上,有N个黑色棋子。他每次要么放到棋盘上一个黑色棋子,要么放上一个白色棋子,如果是白色棋子,他会找出距离

2016-12-27 08:24:33 586

原创 bzoj 3729: Gty的游戏 (博弈+splay)

3729: Gty的游戏Time Limit: 20 Sec  Memory Limit: 128 MBSubmit: 335  Solved: 104[Submit][Status][Discuss]Description某一天gty在与他的妹子玩游戏。妹子提出一个游戏,给定一棵有根树,每个节点有一些石子,每次可以将不多于L的石子移动到父节点,询问将某个节点的子树

2016-12-26 20:29:06 528

原创 bzoj 3211: 花神游历各国 (线段树)

3211: 花神游历各国Time Limit: 5 Sec  Memory Limit: 128 MBSubmit: 2778  Solved: 1039[Submit][Status][Discuss]DescriptionInputOutput每次x=1时,每行一个整数,表示这次旅行的开心度Sample Input41

2016-12-26 10:46:16 285

原创 bzoj 2243: [SDOI2011]染色 (树链剖分+线段树)

2243: [SDOI2011]染色Time Limit: 20 Sec  Memory Limit: 512 MBSubmit: 6693  Solved: 2459[Submit][Status][Discuss]Description给定一棵有n个节点的无根树和m个操作,操作有2类:1、将节点a到节点b路径上所有点都染成颜色c;2、询问节点

2016-12-26 10:36:07 269

原创 bzoj 1593: [Usaco2008 Feb]Hotel 旅馆 (线段树)

1593: [Usaco2008 Feb]Hotel 旅馆Time Limit: 10 Sec  Memory Limit: 64 MBSubmit: 647  Solved: 361[Submit][Status][Discuss]Description奶牛们最近的旅游计划,是到苏必利尔湖畔,享受那里的湖光山色,以及明媚的阳光。作为整个旅游的策划者和负责人,贝茜选择在湖边

2016-12-26 08:45:24 353

原创 bzoj 1828: [Usaco2010 Mar]balloc 农场分配 (贪心+线段树)

1828: [Usaco2010 Mar]balloc 农场分配Time Limit: 3 Sec  Memory Limit: 32 MBSubmit: 592  Solved: 327[Submit][Status][Discuss]DescriptionInput第1行:两个用空格隔开的整数:N和M * 第2行到N+1行:第i+1行表示一个整数C_i *

2016-12-26 07:37:37 370

原创 bzoj 1651: [Usaco2006 Feb]Stall Reservations 专用牛棚 (线段树)

1651: [Usaco2006 Feb]Stall Reservations 专用牛棚Time Limit: 10 Sec  Memory Limit: 64 MBSubmit: 843  Solved: 479[Submit][Status][Discuss]DescriptionOh those picky N (1 <= N <= 50,000) cows! The

2016-12-26 07:20:45 315

原创 bzoj 3694: 最短路(树链剖分+线段树)

3694: 最短路Time Limit: 5 Sec  Memory Limit: 256 MBSubmit: 135  Solved: 66[Submit][Status][Discuss]Description给出一个n个点m条边的无向图,n个点的编号从1~n,定义源点为1。定义最短路树如下:从源点1经过边集T到任意一点i有且仅有一条路径,且这条路径是整个图1到i的最短

2016-12-25 22:00:31 342

原创 bzoj 3702: 二叉树 (线段树)

3702: 二叉树Time Limit: 15 Sec  Memory Limit: 256 MBSubmit: 428  Solved: 184[Submit][Status][Discuss]Description现在有一棵二叉树,所有非叶子节点都有两个孩子。在每个叶子节点上有一个权值(有n个叶子节点,满足这些权值为1..n的一个排列)。可以任意交换每个非叶子节点的左右

2016-12-25 19:30:51 373

原创 bzoj 3653: 谈笑风生 (主席树+dfs序)

3653: 谈笑风生Time Limit: 20 Sec  Memory Limit: 512 MBSubmit: 720  Solved: 277[Submit][Status][Discuss]Description设T 为一棵有根树,我们做如下的定义:• 设a和b为T 中的两个不同节点。如果a是b的祖先,那么称“a比b不知道高明到哪里去了”。• 设a 和

2016-12-25 19:23:46 431

原创 bzoj 2212: [Poi2011]Tree Rotations (线段树)

2212: [Poi2011]Tree RotationsTime Limit: 20 Sec  Memory Limit: 259 MBSubmit: 817  Solved: 320[Submit][Status][Discuss]DescriptionByteasar the gardener is growing a rare tree called Rotatus

2016-12-25 17:47:02 573 5

原创 bzoj 2555: SubString (LCT+后缀自动机)

2555: SubStringTime Limit: 30 Sec  Memory Limit: 512 MBSubmit: 1942  Solved: 554[Submit][Status][Discuss]Description      懒得写背景了,给你一个字符串init,要求你支持两个操作        (1):在当前字符串的后面插入一个字符串

2016-12-25 14:09:15 1048

原创 hdu 1538 A Puzzle for Pirates (海盗分金问题)

A Puzzle for PiratesTime Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 884    Accepted Submission(s): 337Problem DescriptionA bunch of

2016-12-24 22:00:24 503

原创 bzoj 3277: 串 (广义后缀自动机)

3277: 串Time Limit: 10 Sec  Memory Limit: 128 MBSubmit: 357  Solved: 144[Submit][Status][Discuss]Description字符串是oi界常考的问题。现在给定你n个字符串,询问每个字符串有多少子串(不包括空串)是所有n个字符串中至少k个字符串的子串(注意包括本身)。Inpu

2016-12-24 17:48:17 2477 2

原创 bzoj 2780: [Spoj]8093 Sevenk Love Oimaster (广义后缀自动机)

2780: [Spoj]8093 Sevenk Love OimasterTime Limit: 1 Sec  Memory Limit: 128 MBSubmit: 738  Solved: 257[Submit][Status][Discuss]Description     Oimaster and sevenk love each other.    But

2016-12-24 16:21:56 1326 3

原创 bzoj 1982: [Spoj 2021]Moving Pebbles (博弈)

1982: [Spoj 2021]Moving PebblesTime Limit: 10 Sec  Memory Limit: 64 MBSubmit: 172  Solved: 118[Submit][Status][Discuss]Description2021. Moving Pebbles Two players play the following game.

2016-12-24 14:09:06 443

原创 poj 2505 A multiplication game (博弈+找规律)

A multiplication gameTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 6073 Accepted: 3037DescriptionStan and Ollie play the game of multiplication by mul

2016-12-24 10:15:32 346

空空如也

空空如也

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

TA关注的人

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