数据结构
夜幕下的ACM之路
通往成功的路注定是孤独的,我不会放弃!!!!
展开
-
哈理工OJ 1795 发现王国之旅(最小生成树)
发现王国之旅 Time Limit: 1000 MS Memory Limit: 32768 K Total Submit: 20(9 users) Total Accepted: 11(9 users) Rating: Special Judge: No Description 暑期将至,壮壮和胖胖约定去“发现王国”游乐园游玩。壮壮看到过山车,跳楼机,海盗船等等已经激动得不能自原创 2016-08-16 17:39:09 · 435 阅读 · 0 评论 -
HDU 4027 Can you answer these queries?(线段树)【The 36th ACM/ICPC Asia Regional 上海站网赛】
Can you answer these queries?Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 65768/65768 K (Java/Others) Total Submission(s): 13662 Accepted Submission(s): 3137Problem Description A lot of原创 2016-08-13 12:58:09 · 296 阅读 · 0 评论 -
POJ 1988 Cube Stacking(并查集+求距离+连通块中元素个数)
题目链接:http://poj.org/problem?id=1988 Cube Stacking Time Limit: 2000MS Memory Limit: 30000K Total Submissions: 24136 Accepted: 8470 Case Time Limit: 1000MS DescriptionFarmer John and Bet原创 2016-11-04 19:31:49 · 628 阅读 · 0 评论 -
POJ 3125 Printer Queue(用队列模拟过程)
题目链接:http://poj.org/problem?id=3125Printer Queue Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 5001 Accepted: 2600 DescriptionThe only printer in the computer science students’原创 2016-10-25 19:53:02 · 694 阅读 · 0 评论 -
POJ 2259 Team Queue(队列模拟)
题目链接:http://poj.org/problem?id=2259Team Queue Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 4368 Accepted: 1516 DescriptionQueues and Priority Queues are data structures which原创 2016-10-25 20:01:00 · 815 阅读 · 0 评论 -
HDU 1702 ACboy needs your help again!(模拟两种数据结构)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1702ACboy needs your help again!Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 5984 Accepted原创 2016-10-25 20:04:34 · 433 阅读 · 0 评论 -
HDU 1896 Stones (优先队列的应用)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1896StonesTime Limit: 5000/3000 MS (Java/Others) Memory Limit: 65535/32768 K (Java/Others) Total Submission(s): 2243 Accepted Submission(s): 1465Pr原创 2016-10-25 20:16:20 · 390 阅读 · 0 评论 -
HDU 2795 Billboard(线段树)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2795BillboardTime Limit: 20000/8000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 20210 Accepted Submission(s): 8原创 2016-11-07 18:31:10 · 264 阅读 · 0 评论 -
HDU 1247 Hat’s Words(字典树)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1247Hat’s WordsTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 13822 Accepted Submission(s):原创 2016-11-07 19:36:16 · 284 阅读 · 0 评论 -
POJ 2001 Shortest Prefixes(字典树)
题目链接:http://poj.org/problem?id=2001Shortest Prefixes Time Limit: 1000MS Memory Limit: 30000K Total Submissions: 17746 Accepted: 7718 DescriptionA prefix of a string is a substring starti原创 2016-11-07 19:41:53 · 418 阅读 · 0 评论 -
HDU 1251 统计难题(字典树)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1251统计难题Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 131070/65535 K (Java/Others) Total Submission(s): 35696 Accepted Submission(s): 13345P原创 2016-11-07 19:51:34 · 291 阅读 · 0 评论 -
hihoCoder 1098 最小生成树二·Kruscal算法
题目链接:http://hihocoder.com/problemset/problem/1098基本全裸最小生成树。 下面是AC代码:#include<cstdio>#include<cstring>#include<algorithm>using namespace std;struct edge{ int x,y,cost;} ed[1000005];int pre[100原创 2016-10-20 15:18:35 · 413 阅读 · 0 评论 -
哈理工OJ 1248 The kth great number(线段树)
题目链接:http://acm.hrbust.edu.cn/index.php?m=ProblemSet&a=showProblem&problem_id=1248The kth great number Time Limit: 1000 MS Memory Limit: 65536 K Total Submit: 107(36 users) Total Accepted: 64(35 user原创 2016-11-17 07:30:25 · 428 阅读 · 0 评论 -
哈理工OJ 1248 The kth great number(平衡树求第k大数)
题目链接:http://acm.hrbust.edu.cn/index.php?m=ProblemSet&a=showProblem&problem_id=1248The kth great number Time Limit: 1000 MS Memory Limit: 65536 K Total Submit: 108(36 users) Total Accepted: 65(35 user原创 2016-11-17 19:04:26 · 755 阅读 · 0 评论 -
POJ 3264 Balanced Lineup(RMQ查找区间最值)
题目链接:http://poj.org/problem?id=3264Balanced Lineup Time Limit: 5000MS Memory Limit: 65536K Total Submissions: 49179 Accepted: 23031 Case Time Limit: 2000MS DescriptionFor the daily milk原创 2016-11-17 23:52:06 · 305 阅读 · 0 评论 -
POJ 1442 Black Box(【Treap】求动态区间第k大)
题目链接:http://poj.org/problem?id=1442 Black Box Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 13493 Accepted: 5492 DescriptionOur Black Box represents a primitive database. I原创 2017-08-08 15:23:55 · 511 阅读 · 0 评论 -
HDU 4006 The kth great number (求动态第k大值【Treap】)
题目链接:http://acm.split.hdu.edu.cn/showproblem.php?pid=4006 The kth great numberTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65768/65768 K (Java/Others) Total Submission(s): 11885 Accepte原创 2017-08-08 15:35:52 · 333 阅读 · 0 评论 -
入门经典训练指南第三章例题1.UVa 11995 I Can Guess the Data Structure!
题目:http://7xjob4.com1.z0.glb.clouddn.com/5332b565f1539b27a3d913adc0a363ae本题只要熟悉栈,队列,优先队列,直接模拟就可以 过掉 下面是AC代码:#include<cstdio>#include<algorithm>#include<cstring>#include<cmath>#include<vector>#inc原创 2016-08-13 10:46:42 · 346 阅读 · 0 评论 -
指南 第三章 例题3 UVALive 3135 Argus(优先队列的应用)
题目链接:http://7xjob4.com1.z0.glb.clouddn.com/46a7c6bdfdd8392f6c8ba9188333d1d2题目思路:记录周期和开始的时间,优先队列的简单应用。下面是AC代码:#include<cstdio>#include<queue>using namespace std;struct Item{ int QNum,Period,Time;原创 2016-08-24 18:35:03 · 425 阅读 · 0 评论 -
经典第五章 习题 5-3 UVA 10935 Throwing cards away I(队列的简单应用)
题目:http://7xjob4.com1.z0.glb.clouddn.com/bc8f4a27cb57cafb184320d2484b0cda就是简单的队列模拟。 下面是AC代码:#include<cstdio>#include<cstring>#include<queue>#include<algorithm>using namespace std;int a[50];int ma原创 2016-08-16 19:42:46 · 417 阅读 · 0 评论 -
经典第六章 例题 6-12 UVA 572 Oil Deposits(用DFS求连通块)
题目链接:http://7xjob4.com1.z0.glb.clouddn.com/942a6cf8f96df414dd4497fea000097b 中文题意: 输入一个m行n列的字符矩阵,统计字符”@”组成多少个八连块。如果两个字符“@”所在的格子相邻(横、竖或者对角线方向),就说它们属于同一个八连块。很简单的题目,BFS也可以过。 下面是AC代码:#include<cstdio>#in原创 2016-08-18 11:55:39 · 514 阅读 · 0 评论 -
UVA 10305 Ordering Tasks(拓扑排序入门)【刘汝佳算法入门经典例6-15】
John has n tasks to do. Unfortunately, the tasks are not independent and the execution of one task is only possible if other tasks have already been executed. Input The input will consist of several原创 2016-08-07 15:40:36 · 674 阅读 · 0 评论 -
HDU 1285 确定比赛名次(拓扑排序)
http://acm.hdu.edu.cn/showproblem.php?pid=1285 确定比赛名次Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 22460 Accepted Submission(s): 9110Prob原创 2016-08-07 15:49:50 · 276 阅读 · 0 评论 -
HDU 3342 Legal or Not(拓扑排序)
http://acm.hdu.edu.cn/showproblem.php?pid=3342 Legal or NotTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 7156 Accepted Submission(s): 340原创 2016-08-07 16:34:03 · 336 阅读 · 0 评论 -
哈理工OJ 2043 长长长长龙(线段树)
长长长长龙Time Limit: 3000 MSMemory Limit: 32768 KTotal Submit: 247(96 users)Total Accepted: 86(73 users)Rating: Special Judge: NoDescription时间:今天是20XX年,XX月,原创 2016-08-08 11:57:02 · 519 阅读 · 0 评论 -
HDU 5438 Ponds(BFS+拓扑排序)【2015亚洲区长春站网赛B】
PondsTime Limit: 1500/1000 MS (Java/Others) Memory Limit: 131072/131072 K (Java/Others) Total Submission(s): 3615 Accepted Submission(s): 1083Problem Description Betty owns a lot of ponds, some原创 2016-08-08 12:08:57 · 379 阅读 · 0 评论 -
哈理工OJ 1020 Robot Motion(模拟+队列【类似小搜索】)
题目链接:http://acm.hrbust.edu.cn/index.php?m=ProblemSet&a=showProblem&problem_id=1020Robot Motion Time Limit: 1000 MS Memory Limit: 65536 K Total Submit: 217(102 users) Total Accepted: 110(94 users)原创 2016-08-29 20:44:48 · 515 阅读 · 0 评论 -
指南 第三章 例题5 UVALive 3644 X-Plosives(并查集)
题目链接:http://7xjob4.com1.z0.glb.clouddn.com/eab170e979d9683005d958b058d6ce76思路:就是加入后成环的元素不可以被加入。下面是AC代码:#include<cstdio>const int maxn=100000+10;int pre[maxn];int findset(int x){ if(x==pre[x])原创 2016-08-24 20:56:46 · 286 阅读 · 0 评论 -
2016 ACM/ICPC Asia Regional Dalian Online Sparse Graph(BFS)
题目链接:http://acm.split.hdu.edu.cn/showproblem.php?pid=5876Sparse GraphTime Limit: 4000/2000 MS (Java/Others) Memory Limit: 262144/262144 K (Java/Others) Total Submission(s): 122 Accepted Submissi原创 2016-09-10 20:23:38 · 450 阅读 · 0 评论 -
指南 第三章 例题6 UVALive 3027 Corporative Network(并查集的应用)
题目链接:http://7xjob4.com1.z0.glb.clouddn.com/8709392d143986024ba5de491366d376下面写下中文题意: 有n个结点,初始时每个结点的父结点都不存在。你的任务是执行一次I操作和E操作,格式如下: (1)I u v:把结点u的父结点设为v,距离为|u-v|除以1000的余数。输入保证执行指令前u没有父结点。 (2)E u:询问u到根原创 2016-08-30 18:13:18 · 368 阅读 · 0 评论 -
指南第三章 例题八 UVA 11235 Frequent values(RMQ问题)
题目链接:http://7xjob4.com1.z0.glb.clouddn.com/31eeaedd10d813ea386928151f516e8a 中文题意: 给出一个非降序排列的整数数组a1,a2,…….,an。你的任务是对于一系列询问(i,j),回答ai,ai+1,…….aj中出现次数最多的值所出现的次数。 【输入格式】 输入包含多组数据。每组数据第一行原创 2016-08-31 13:13:03 · 347 阅读 · 0 评论 -
经典第六章 例题 6-2 UVA 514 Rails(栈的基础应用)
题目链接:http://7xjob4.com1.z0.glb.clouddn.com/21455e1d8d4a7b8170202987eb38b76f就是给你n个火车的出站顺序,问你是否可以实现。 下面是AC代码:#include<cstdio>#include<stack>using namespace std;const int N = 1005;int n, target[N], A原创 2016-08-23 07:34:31 · 471 阅读 · 0 评论 -
哈理工OJ 1351 欧拉路径(判断连通图+欧拉回路或者欧拉路径)
欧拉路径 Time Limit: 1000 MS Memory Limit: 32767 K Total Submit: 226(68 users) Total Accepted: 82(60 users) Rating: Special Judge: No Description 七桥问题Seven Bridges Problem 18世纪著名古典数学问题之一。在哥尼斯堡的原创 2016-08-23 12:26:31 · 1177 阅读 · 0 评论 -
指南 第三章例题2 UVA 11991 Easy Problem from Rujia Liu?(STL)
本题是一道STL的应用的题目,map+vecrot实现了快速查询的功能。中文题意:给出一个包含n个整数的数组,你需要回答若干询问。每次询问两个整数k和v,输出从左到右第k个v的下标(数组下标从左到右编号为1-n)。如果是一般的排序的话基本会超时,然后使用map大大缩短了查询的时间。 下面是AC代码:#include<cstdio>#include<vector>#include<map>us原创 2016-08-23 19:41:46 · 296 阅读 · 0 评论 -
哈理工OJ 1352 中间的球 (floyed求传递闭包)
中间的球 Time Limit: 1000 MS Memory Limit: 32767 K Total Submit: 106(42 users) Total Accepted: 54(40 users) Rating: Special Judge: No Description 有N个外形一样但重量不同的球,N是一个奇数,每个球被标号为1、2、…、N,你的任务是 找到重量原创 2016-08-24 14:10:50 · 340 阅读 · 0 评论 -
UVA 11922 Permutation Transformer(Splay【伸展树】的一些操作)
题目链接:https://cn.vjudge.net/problem/UVA-11922Write a program to transform the permutation 1, 2, 3, … , n according to m instructions. Each instruction (a, b) means to take out the subsequence from the原创 2017-08-09 19:45:39 · 317 阅读 · 0 评论