
数据结构
不楸
现在的自己对的起以后
展开
-
ALDS1_5_D The Number of Inversions(分而治之-归并排序)
The Number of Inversions For a given sequence A={a0,a1,...an−1}A={a0,a1,...an−1}, the number of pairs (i,j)(i,j) where ai>ajai>aj and i<ji<j, is called the number of inversions. The nu...原创 2018-10-23 10:12:19 · 374 阅读 · 0 评论 -
ALDS1_6_D Minimum Cost Sort (最小成本排序)
Minimum Cost SortTime Limit : 1 sec, Memory Limit : 131072 KB Japanese version is hereMinimum Cost SortYou are given nn integers wi(i=0,1,...,n−1)wi(i=0,1,...,n−1) to be sorted in ascending orde...原创 2018-10-23 22:16:41 · 430 阅读 · 0 评论 -
HDU 3642 —Get The Treasury(线段树+扫描线+离散化)
Get The Treasury Time Limit: 10000/5000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 3635 Accepted Submission(s): 1167 Problem Description ...原创 2018-10-27 14:56:23 · 374 阅读 · 0 评论 -
POJ3481-Double Queue(SplayTree模板)
Double QueueTime Limit: 1000MS Memory Limit: 65536K Total Submissions: 19029 Accepted: 8149 DescriptionThe new founded Balkan Investment Group Bank (BIG-Bank) opened a new offi...原创 2018-11-04 11:46:26 · 205 阅读 · 0 评论 -
HDU6446
Tree and PermutationTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 711 Accepted Submission(s): 248 Problem DescriptionThere are N ve...原创 2018-08-26 15:44:12 · 453 阅读 · 0 评论 -
HYSBZ1067(RMQ)
1067: [SCOI2007]降雨量Time Limit: 1 Sec Memory Limit: 162 MBSubmit: 6711 Solved: 1814[Submit][Status][Discuss]Description 我们常常会说这样的话:“X年是自Y年以来降雨量最多的”。它的含义是X年的降雨量不超过Y年,且对于任意Y<Z<X,Z年的降雨量严格小于X年。...原创 2018-12-05 21:53:36 · 161 阅读 · 0 评论 -
POJ3264(RMQ模板)
Balanced LineupTime Limit: 5000MS Memory Limit: 65536K Total Submissions: 66277 Accepted: 30847 Case Time Limit: 2000MS DescriptionFor the daily milking, Farmer John's N cows...原创 2018-12-05 22:23:58 · 270 阅读 · 0 评论 -
HDU2888(二维RMQ/二维线段树 模板)
Check CornersTime Limit: 2000/10000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 3572 Accepted Submission(s): 1282 Problem DescriptionPaul draw a big m*...原创 2018-12-06 18:31:11 · 318 阅读 · 0 评论 -
POJ3468(树状数组区间更新和区间查询-线段树)
A Simple Problem with IntegersTime Limit:5000MS Memory Limit:131072K Total Submissions:151635 Accepted:...原创 2019-03-16 10:51:15 · 652 阅读 · 4 评论 -
牛客网 间单排序(LIS算法)
链接:https://ac.nowcoder.com/acm/contest/547/F来源:牛客网题目描述LXK有一个序列,从N~1,但是他不小心把序列打乱了,现在他想找你把这串序列复原。他讨厌用传统的方式排序。所以他用他自己的方式进行复原。他有K个先进先出的队列对于某个数字,你可以选择将其放入任意队列之中(不能不放)。每个队列中队首的数字可以在任意时间出队列。...原创 2019-03-17 22:06:42 · 333 阅读 · 0 评论 -
POJ1984-Navigation Nightmare(带权并查集)
Navigation NightmareTime Limit: 2000MS Memory Limit: 30000K Total Submissions: 7829 Accepted: 2817 Case Time Limit: 1000MS DescriptionFarmer John's pastoral neighborhood has ...原创 2018-10-25 11:58:06 · 255 阅读 · 0 评论 -
HDU6447 数状数组+离散化
YJJ's SalesmanTime Limit: 4000/2000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 1021 Accepted Submission(s): 340 Problem DescriptionYJJ is a salesman w...原创 2018-08-26 17:17:50 · 265 阅读 · 0 评论 -
ACM-ICPC 2018 南京赛区网络预赛-G Lpl and Energy-saving Lamps(线段树+打表+单点更新)
During tea-drinking, princess, amongst other things, asked why has such a good-natured and cute Dragon imprisoned Lpl in the Castle? Dragon smiled enigmatically and answered that it is a big secret. A...原创 2018-09-02 21:13:15 · 288 阅读 · 0 评论 -
迷宫寻路三大算法(BFS,DFS,A*)
迷宫寻路这是我们的数据结构作业本加我们自己再网上找算法记录下来,不过本人比较执着画了几天时间还是把这些算法自己写出来了。总得来说网上所说的大体算法应该就有三种(BFS,DFS,A*) 这里是一个验证网址是南阳OJ的一道题这是网址 http://acm.nyist.me/problem/58 好了不说废话开始吧BFS宽度优先搜索算法(又称广度优先搜索)是最简便的图的搜...原创 2018-05-10 16:54:05 · 23706 阅读 · 4 评论 -
C++ 表达式求值(栈)
表达式求值第一次使用Markdown编辑器不太习惯,写了很多版本的表达式求值有并且有Java的。但是就觉得这一个还不错。 表达式求值主要就是主要考虑运算符的优先级,“+-”属于同一级别,”%/属于同一级别我自定义了一个函数判断static int precedence(char ch){ switch (ch) { case '+': return 1; ...原创 2018-05-04 18:03:10 · 1380 阅读 · 2 评论 -
时间复杂度计算
时间复杂度:时间复杂度是同一问题可用不同算法解决,而一个算法的质量优劣将影响到算法乃至程序的效率。算法分析的目的在于选择合适算法和改进算法。计算机科学中,算法的时间复杂度是一个函数,它定性描述了该算法的运行时间。这是一个关于代表算法输入值的字符串的长度的函数。时间复杂度常用大O符号表述,不包括这个函数的低阶项和首项系数。使用这种方式时,时间复杂度可被称为是渐近的,它考察当输入值大小趋近无穷时的...原创 2018-07-01 23:20:04 · 409 阅读 · 4 评论 -
ACM-ICPC 2018 徐州赛区网络预赛-G Trace
There's a beach in the first quadrant. And from time to time, there are sea waves. A wave ( xx , yy ) means the wave is a rectangle whose vertexes are ( 00 , 00 ), ( xx , 00 ), ( 00 , yy ), ( xx , yy ...原创 2018-09-09 22:01:09 · 227 阅读 · 0 评论 -
ACM-ICPC 2018 徐州赛区网络预赛-F Features Track
Morgana is learning computer vision, and he likes cats, too. One day he wants to find the cat movement from a cat video. To do this, he extracts cat features in each frame. A cat feature is a two-dime...原创 2018-09-09 22:05:13 · 280 阅读 · 0 评论 -
ACM-ICPC 2018 徐州赛区网络预赛-I Characters with Hash
Mur loves hash algorithm, and he sometimes encrypt another one's name, and call him with that encrypted value. For instance, he calls Kimura KMR, and calls Suzuki YJSNPI. One day he read a book about ...原创 2018-09-09 22:19:40 · 160 阅读 · 0 评论 -
c++有序链表归并
刚开始写就直接写成了了一个 有序的链表 最后在把两个链表归并是有写了一个冒泡排序来排序 可能有点杂 写的不好见谅#pragma once#include<cstdio>#include<stdio.h>#include<iostream>#include<algorithm>#include<string.h...原创 2017-12-16 17:24:41 · 779 阅读 · 0 评论 -
HDU4819 Mosaic(二维线段树模板)
MosaicTime Limit: 10000/5000 MS (Java/Others) Memory Limit: 102400/102400 K (Java/Others)Total Submission(s): 2696 Accepted Submission(s): 1187 Problem DescriptionThe God of sheep decide...原创 2018-10-18 10:15:35 · 317 阅读 · 0 评论 -
ACM-ICPC 2018 徐州赛区网络预赛 - H Ryuji doesn't want to study
Ryuji is not a good student, and he doesn't want to study. But there are n books he should learn, each book has its knowledge a[i]a[i].Unfortunately, the longer he learns, the fewer he gets.That m...原创 2018-09-09 22:16:40 · 145 阅读 · 0 评论 -
归并排序+快速排序
代码://归并排序void merger(int arry[],int l,int mid,int r){ int tL[100],tR[100];//一个存左边的数组一个存右边的数组 int lenl=mid-l; int lenr=r-mid; for(int i=0;i<lenl;++i){tL[i]=arry[l+i];} ...原创 2019-05-08 20:51:06 · 222 阅读 · 0 评论