随笔分类 -  数据结构

1
线段树、树状数组、并查集等
leetcode 684. Redundant Connection
摘要:We are given a "tree" in the form of a 2D array, with distinct values for each node. In the given 2D array, each element pair [u, v] represents that v 阅读全文
posted @ 2017-09-24 23:43 Beserious 阅读(399) 评论(0) 推荐(0) 编辑
leetcode 211. Add and Search Word - Data structure design
摘要:Design a data structure that supports the following two operations: search(word) can search a literal word or a regular expression string containing o 阅读全文
posted @ 2017-08-18 15:41 Beserious 阅读(315) 评论(0) 推荐(0) 编辑
155. Min Stack
摘要:Design a stack that supports push, pop, top, and retrieving the minimum element in constant time. push(x) -- Push element x onto stack. pop() -- Remov 阅读全文
posted @ 2017-07-25 11:12 Beserious 阅读(141) 评论(0) 推荐(0) 编辑
poj 3253 Fence Repair
摘要:Farmer John wants to repair a small length of the fence around the pasture. He measures the fence and finds that he needs N (1 ≤ N ≤ 20,000) planks of 阅读全文
posted @ 2016-11-07 20:04 Beserious 阅读(208) 评论(0) 推荐(0) 编辑
[1525] Cow Xor
摘要:问题描述 农民约翰在喂奶牛的时候被另一个问题卡住了。他的所有N(1 <= N <= 100,000)个奶牛在他面前排成一行(按序号1..N的顺序),按照它们的社会等级排序。奶牛#1有最高的社会等级,奶牛#N最低。每个奶牛同时被指定了一个不唯一的附加值,这个数在0..2^21 - 1的范围内。 帮助农 阅读全文
posted @ 2016-10-06 15:32 Beserious 阅读(260) 评论(0) 推荐(0) 编辑
给出树的前序遍历和后序遍历,构建树
摘要:必须知道一点: 前序遍历是:根、左、右 中序遍历是:左、根、右 后序遍历是:左、右、根 递归构建即可。 阅读全文
posted @ 2016-08-29 11:29 Beserious 阅读(629) 评论(0) 推荐(0) 编辑
HDU 5862Counting Intersections
摘要:Counting Intersections Time Limit: 12000/6000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 51 Accepted Submission(s) 阅读全文
posted @ 2016-08-18 18:21 Beserious 阅读(427) 评论(0) 推荐(0) 编辑
Codeforces Round #367 (Div. 2) D. Vasiliy's Multiset
摘要:D. Vasiliy's Multiset time limit per test 4 seconds time limit per test memory limit per test 256 megabytes memory limit per test input standard input 阅读全文
posted @ 2016-08-12 13:49 Beserious 阅读(465) 评论(0) 推荐(0) 编辑
HDU 5775 Bubble Sort
摘要:Bubble Sort Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 106 Accepted Submission(s): 76 Proble 阅读全文
posted @ 2016-07-28 20:12 Beserious 阅读(226) 评论(0) 推荐(0) 编辑
HDU 5687 Problem C
摘要:Problem C Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 131072/131072 K (Java/Others)Total Submission(s): 232 Accepted Submission(s): 82 Proble 阅读全文
posted @ 2016-05-17 20:24 Beserious 阅读(266) 评论(0) 推荐(0) 编辑
Educational Codeforces Round 10 D. Nested Segments
摘要:D. Nested Segments time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output You are given n segme 阅读全文
posted @ 2016-03-28 20:06 Beserious 阅读(207) 评论(0) 推荐(0) 编辑
D. Babaei and Birthday Cake--- Codeforces Round #343 (Div. 2)
摘要:D. Babaei and Birthday Cake time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output As you know, 阅读全文
posted @ 2016-02-24 10:38 Beserious 阅读(426) 评论(0) 推荐(0) 编辑
基础线段树
摘要:1.hdu 1166 单点更新,维护区间和 /* *********************************************** Author :pk28 Created Time :2015/9/15 19:38:46 File Name :4.cpp ************** 阅读全文
posted @ 2015-10-17 20:51 Beserious 阅读(250) 评论(0) 推荐(0) 编辑
usaco2008 nov 区间异或求和
摘要:数据 http://contest.usaco.org/TESTDATA/NOV08_1.htm 阅读全文
posted @ 2015-10-04 17:06 Beserious 阅读(315) 评论(0) 推荐(0) 编辑
HDU 5443 The Water Problem
摘要:The Water ProblemTime Limit: 1500/1000 MS (Java/Others)Memory Limit: 131072/131072 K (Java/Others)Total Submission(s): 153Accepted Submission(s): 123P... 阅读全文
posted @ 2015-09-13 20:08 Beserious 阅读(179) 评论(0) 推荐(0) 编辑
ZOJ 3261 Connections in Galaxy War
摘要:Connections in Galaxy WarTime Limit:3 Seconds Memory Limit:32768 KBIn order to strengthen the defense ability, many stars in galaxy allied together an... 阅读全文
posted @ 2015-08-17 13:11 Beserious 阅读(221) 评论(0) 推荐(0) 编辑
POJ 1182 食物链
摘要:食物链Time Limit:1000MSMemory Limit:10000KTotal Submissions:53679Accepted:15738Description动物王国中有三类动物A,B,C,这三类动物的食物链构成了有趣的环形。A吃B, B吃C,C吃A。现有N个动物,以1-N编号。每个... 阅读全文
posted @ 2015-08-17 00:03 Beserious 阅读(186) 评论(0) 推荐(0) 编辑
POJ 1733 Parity game
摘要:Parity gameTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 7101 Accepted: 2751DescriptionNow and then you play the following game with you... 阅读全文
posted @ 2015-08-16 15:55 Beserious 阅读(182) 评论(0) 推荐(0) 编辑
HDU3047 Zjnu Stadium
摘要:Zjnu StadiumTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 2302Accepted Submission(s): 876Problem... 阅读全文
posted @ 2015-08-15 17:08 Beserious 阅读(162) 评论(0) 推荐(0) 编辑
HDU 1829/POJ 2492 A Bug's Life
摘要:A Bug's LifeTime Limit: 15000/5000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 11981Accepted Submission(s): 3901Prob... 阅读全文
posted @ 2015-08-15 11:35 Beserious 阅读(200) 评论(1) 推荐(0) 编辑

1