
ACM_数据结构
文章平均质量分 95
蔡军帅
好好学习,天天向上!
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
POJ 2823 Sliding Window(单调队列入门题)
Sliding WindowTime Limit: 12000MS Memory Limit: 65536KTotal Submissions: 67218 Accepted: 19088Case Time Limit: 5000MSDescriptionAn array of size n ≤ 106 is given to you....原创 2018-05-14 19:39:00 · 218 阅读 · 0 评论 -
POJ2559 Largest Rectangle in a Histogram(单调栈)
Largest Rectangle in a HistogramTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 24316 Accepted: 7866DescriptionA histogram is a polygon composed of a sequence of re...原创 2018-04-17 21:40:00 · 116 阅读 · 0 评论 -
POJ 3250 Bad Hair Day(单调栈)
Bad Hair Day Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 20917 Accepted: 7150 
原创 2018-04-17 21:55:00 · 105 阅读 · 0 评论 -
POJ 1276 Cash Machine(单调队列优化多重背包)
Cash Machine Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 38986 Accepted: 14186 原创 2018-04-24 21:58:00 · 248 阅读 · 0 评论 -
codeforce1029B B. Creating the Contest(简单dp,简单版单调栈)
codeforce1029B B. Creating the Contest(简单dp,简单版单调栈) B. Creating the Contesttime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard...原创 2018-08-28 14:38:00 · 255 阅读 · 0 评论 -
第一次使用优先队列
问题 F: 优先队列时间限制: 1 Sec 内存限制: 128 MB提交: 8 解决: 4[提交][状态][讨论版]题目描述已知进入优先队列的各结点的优先级(为<20的正整数,该值越小,则表示优先级越高),以及各结点入队列和出队列的操作序列,要求输出各结点的出队列顺序(输出编号)。注意,结点的编号为入队列时的序号,且从1开始计起。输入输入文件...原创 2018-01-21 22:23:00 · 207 阅读 · 0 评论 -
poj 3253 Fence Repair (贪心,优先队列)
DescriptionFarmer 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 wood, each having some integ...原创 2018-02-06 18:33:00 · 373 阅读 · 0 评论 -
L2-020. 功夫传人(dfs+vector 或者 邻接矩阵+dij+优先队列)
L2-020. 功夫传人时间限制400 ms内存限制65536 kB代码长度限制8000 B判题程序Standard作者陈越一门武功能否传承久远并被发扬光大,是要看缘分的。一般来说,师傅传授给徒弟的武功总要打个折扣,于是越往后传,弟子们的功夫就越弱…… 直到某一支的某一代突然出现一个天分特别高的弟子(或者是吃到了灵丹、挖到了特别的秘笈),...原创 2018-03-29 11:23:00 · 131 阅读 · 0 评论 -
HDU 2544 最短路(邻接表+优先队列+dijstra优化模版)
最短路Time Limit: 5000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 81706 Accepted Submission(s): 35385Problem Description在每年的校赛里,所有进入决赛的同学都会获得一件很...原创 2018-05-01 20:58:00 · 172 阅读 · 0 评论 -
poj3190 Stall Reservations (贪心+优先队列)
Cleaning ShiftsTime Limit : 2000/1000ms (Java/Other) Memory Limit : 131072/65536K (Java/Other)Total Submission(s) : 9 Accepted Submission(s) : 2Problem DescriptionFarmer John is assign...原创 2018-02-02 14:36:00 · 201 阅读 · 0 评论 -
HDU 1166 敌兵布阵(树状数组)
敌兵布阵 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 107289 Accepted Submission(s): 45092 Problem Description C国...原创 2018-02-25 21:21:00 · 104 阅读 · 0 评论 -
逆序对(树状数组)
链接:https://www.nowcoder.com/acm/contest/77/A来源:牛客网 逆序数 时间限制:C/C++ 2秒,其他语言4秒 空间限制:C/C++ 131072K,其他语言262144K 64bit IO Format...原创 2018-02-26 19:25:00 · 299 阅读 · 0 评论 -
HDU 1541 Stars(树状数组)
StarsTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 11234 Accepted Submission(s): 4472Problem DescriptionAstronomers often exami...原创 2018-03-01 14:54:00 · 120 阅读 · 0 评论 -
HDU 4970 Killing Monsters(树状数组)
Killing Monsters Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 131072/131072 K (Java/Others)Total Submission(s): 2838 Accepted Submission(s): 1068 Problem Descript...原创 2018-03-01 17:11:00 · 239 阅读 · 0 评论 -
POJ 1990 MooFest(树状数组)
MooFest Time Limit: 1000MS Memory Limit: 30000K Total Submissions: 9006 Accepted: 4073 &原创 2018-03-01 13:57:00 · 169 阅读 · 0 评论 -
情人节的电灯泡(二维树状数组)
题目描述情人节到了,小芳和小明手牵手,打算过一个完美的情人节,但是小刚偏偏也来了,当了一个明晃晃的电灯泡,小明很尴尬,就和小刚说,我交给你个任务,你完成了我俩就带你玩,否则你就回家吧。小刚很有当单身狗的觉悟,他坚决不想让小明过好情人节,同为单身狗的你能帮帮他吗?现在有一个n×n(1 <= n <= 1000)的格子,每一个格子都有一个电灯泡,可能是亮的,也可能是灭的...原创 2018-02-26 20:17:00 · 281 阅读 · 1 评论 -
POJ 3468 A Simple Problem with Integers(线段树)
A Simple Problem with Integers Time Limit: 5000MS Memory Limit: 131072K Total Submissions: 126311 Accepted: 39238 原创 2018-03-02 20:49:00 · 89 阅读 · 0 评论 -
问题 H: 老管家的忠诚(线段树)
问题 H: 老管家的忠诚(线段树) 问题 H: 老管家的忠诚时间限制:0 Sec内存限制:128 MB提交:54解决:21[提交][状态][讨论版][命题人:外部导入]题目描述 老管家是一个聪明能干的人。他为财主工作了整整10年,财主为了让自已账目更加清楚。要求管家每天记k次账,由于管家聪明能干,因而管家总是让财主十分满意。但是由于一些人的挑...原创 2019-04-02 18:53:00 · 1541 阅读 · 0 评论 -
HDU 1166 敌兵布阵 (线段树模版题)
敌兵布阵Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 107484 Accepted Submission(s): 45175Problem DescriptionC国的死对头A国这段时间正在进行军事演习,所...原创 2018-02-28 16:41:00 · 107 阅读 · 0 评论 -
POJ 2991 Crane(线段树)
Crane Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 7687 Accepted: 2075 Special Judge &a原创 2018-03-01 13:13:00 · 181 阅读 · 0 评论 -
HDU 1754 I Hate It(线段树)
I Hate It Time Limit: 9000/3000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 89455 Accepted Submission(s): 34142 Problem Descript...原创 2018-02-28 18:45:00 · 91 阅读 · 0 评论 -
hdu1 247 Hat’s Words(字典树)
Hat’s Words Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 16970 Accepted Submission(s): 6098 Problem Description...原创 2018-02-15 22:11:00 · 93 阅读 · 0 评论 -
HDU 1671 Phone List(字典树)
Phone ListTime Limit: 3000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 22697 Accepted Submission(s): 7684Problem DescriptionGiven a list of ph...原创 2018-02-17 22:46:00 · 108 阅读 · 0 评论 -
HDU 2846 Repository(字典树,每个子串建树,*s的使用)
Repository Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 6444 Accepted Submission(s): 2096 Problem Description ...原创 2018-02-18 12:40:00 · 203 阅读 · 0 评论 -
HDU 1298 T9(字典树+dfs)
T9 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 3527 Accepted Submission(s): 1318 Problem Description A while...原创 2018-02-16 15:54:00 · 245 阅读 · 0 评论 -
HDU 1251 统计难题(字典树)
统计难题Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 131070/65535 K (Java/Others)Total Submission(s): 48444 Accepted Submission(s): 17131Problem DescriptionIgnatius最近遇到一个难题,老师交给他...原创 2018-02-17 23:37:00 · 114 阅读 · 0 评论 -
PAT 甲级 1079 Total Sales of Supply Chain (25 分)(简单,不建树,bfs即可)
1079Total Sales of Supply Chain(25分)A supply chain is a network of retailers(零售商), distributors(经销商), and suppliers(供应商)-- everyone involved in moving a product from supplier to cu...原创 2019-12-04 15:17:00 · 212 阅读 · 0 评论 -
PAT 甲级 1020 Tree Traversals (25分)(后序中序链表建树,求层序)***重点复习
1020Tree Traversals(25分)Suppose that all the keys in a binary tree are distinct positive integers. Given the postorder and inorder traversal sequences, you are supposed to output the le...原创 2019-12-06 15:26:00 · 142 阅读 · 0 评论 -
给出先序和中序,给一个数找到位置并输出它左子树里最大的数
题意:给出先序和中序,给一个数,找到这个数在树中的位置并输出它左子树里最大的数,如果这个数不在树中,输出-1样例输入:920 15 10 12 18 16 17 25 3010 12 15 16 17 18 20 25 30样例输出:15代码:#include<iostream>#include<algorithm>using namespa...原创 2019-11-17 10:42:00 · 194 阅读 · 0 评论 -
PAT 甲级 1147 Heaps (30 分) (层序遍历,如何建树,后序输出,还有更简单的方法~)...
1147Heaps(30分)In computer science, aheapis a specialized tree-based data structure that satisfies the heap property: if P is a parent node of C, then the key (the value) of P is ei...原创 2019-11-20 17:20:00 · 262 阅读 · 0 评论 -
PAT 甲级1057 Stack (30 分)(不会,树状数组+二分)*****
1057Stack(30分)Stack is one of the most fundamental data structures, which is based on the principle of Last In First Out (LIFO). The basic operations include Push (inserting an element...原创 2019-09-20 16:06:00 · 264 阅读 · 0 评论 -
树的遍历(25分)
L2-006. 树的遍历时间限制400 ms内存限制65536 kB代码长度限制8000 B判题程序Standard作者陈越给定一棵二叉树的后序遍历和中序遍历,请你输出其层序遍历的序列。这里假设键值都是互不相等的正整数。输入格式:输入第一行给出一个正整数N(<=30),是二叉树中结点的个数。第二行给出其后序遍历序列。第三行给出其...原创 2018-03-25 21:01:00 · 438 阅读 · 0 评论 -
PAT 甲级 1086 Tree Traversals Again (25分)(先序中序链表建树,求后序)***重点复习...
1086Tree Traversals Again(25分)An inorder binary tree traversal can be implemented in a non-recursive way with a stack. For example, suppose that when a 6-node binary tree (with the keys...原创 2019-12-06 14:26:00 · 174 阅读 · 0 评论 -
二叉搜索树的结构(30 分) PTA 模拟+字符串处理 二叉搜索树的节点插入和非递归遍历...
二叉搜索树的结构(30 分) PTA 模拟+字符串处理 二叉搜索树的节点插入和非递归遍历 二叉搜索树的结构(30 分)二叉搜索树或者是一棵空树,或者是具有下列性质的二叉树: 若它的左子树不空,则左子树上所有结点的值均小于它的根结点的值;若它的右子树不空,则右子树上所有结点的值均大于它的根结点的值;它的左、右子树也分别为二叉搜索树。(摘自百度百科)给定一系列互不相等...原创 2018-03-29 20:35:00 · 450 阅读 · 0 评论 -
PAT 甲级 1043 Is It a Binary Search Tree (25 分)(链表建树前序后序遍历)*不会用链表建树 *看不懂题...
1043Is It a Binary Search Tree(25分)A Binary Search Tree (BST) is recursively defined as a binary tree which has the following properties:The left subtree of a node conta...原创 2019-09-02 15:25:00 · 213 阅读 · 0 评论 -
Codeforce 101B. Buses(线段树or树状数组+离散化)
Buses t...原创 2018-04-15 13:29:00 · 222 阅读 · 0 评论 -
PAT-2019年冬季考试-甲级 7-4 Cartesian Tree (30分)(最小堆的中序遍历求层序遍历,递归建树bfs层序)...
7-4Cartesian Tree(30分)ACartesian treeis a binary tree constructed from a sequence of distinct numbers. The tree is heap-ordered, and an inorder traversal returns the original sequence...原创 2019-12-08 13:07:00 · 313 阅读 · 0 评论 -
L2-012. 关于堆的判断
L2-012. 关于堆的判断时间限制400 ms内存限制65536 kB代码长度限制8000 B判题程序Standard作者陈越将一系列给定数字顺序插入一个初始为空的小顶堆H[]。随后判断一系列相关命题是否为真。命题分下列几种:“x is the root”:x是根结点;“x and y are siblings”:x和y是兄弟结点...原创 2018-03-27 17:07:00 · 187 阅读 · 0 评论 -
关于堆的判断(25 分)
关于堆的判断(25 分)将一系列给定数字顺序插入一个初始为空的小顶堆H[]。随后判断一系列相关命题是否为真。命题分下列几种:x is the root:x是根结点;x and y are siblings:x和y是兄弟结点;x is the parent of y:x是y的父结点;x is a child of y:x是y的一个子结点。输入格式:每组测试第1...原创 2018-03-19 23:46:00 · 1853 阅读 · 0 评论 -
FBI树-数据结构(二叉树)
FBI树-数据结构(二叉树) 问题 B: [2004_p4]FBI树-数据结构时间限制:1 Sec内存限制:125 MB提交:57解决:46题目描述我们可以把由“0”和“1”组成的字符串分为三类:全“0”串称为B串,全“1”串称为I串,既含“0”又含“1”的串则称为F串。FBI树是一种二叉树(如下图),它的结点类型也包括F结点,B结点和I结点三...原创 2019-04-26 13:48:00 · 865 阅读 · 0 评论