随笔分类 -  数据结构 线段树

摘要:XKC's basketball team XKC , the captain of the basketball team , is directing a train of nn team members. He makes all members stand in a row , and nu 阅读全文
posted @ 2019-09-08 10:51 ZERO- 阅读(338) 评论(0) 推荐(0) 编辑
摘要:好久没写过博客了,这学期不是很有热情去写博客,写过的题也懒得写题解。现在来水一水博客,写一下若干年前的题目的题解。 Atlantis Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Tot 阅读全文
posted @ 2019-06-05 22:26 ZERO- 阅读(258) 评论(1) 推荐(0) 编辑
摘要:水博客,水一水。 Horizontally Visible Segments Time Limit: 5000MS Memory Limit: 65536K Total Submissions: 6290 Accepted: 2287 Description There is a number of 阅读全文
posted @ 2019-05-30 19:32 ZERO- 阅读(308) 评论(0) 推荐(0) 编辑
摘要:P3380 【模板】二逼平衡树(树套树) 题目描述 您需要写一种数据结构(可参考题目标题),来维护一个有序数列,其中需要提供以下操作: 查询k在区间内的排名 查询区间内排名为k的值 修改某一位值上的数值 查询k在区间内的前驱(前驱定义为严格小于x,且最大的数,若不存在输出-2147483647) 查 阅读全文
posted @ 2019-05-17 20:36 ZERO- 阅读(325) 评论(0) 推荐(0) 编辑
摘要:P2894 [USACO08FEB]酒店Hotel 题目描述 The cows are journeying north to Thunder Bay in Canada to gain cultural enrichment and enjoy a vacation on the sunny sh 阅读全文
posted @ 2019-04-18 23:53 ZERO- 阅读(379) 评论(0) 推荐(0) 编辑
摘要:P3071 [USACO13JAN]座位Seating 题目描述 To earn some extra money, the cows have opened a restaurant in their barn specializing in milkshakes. The restaurant 阅读全文
posted @ 2019-04-18 23:50 ZERO- 阅读(308) 评论(0) 推荐(0) 编辑
摘要:"Ray, Pass me the dishes!" UVA - 1400 题意就是线段树区间子段最大和,线段树区间合并,但是这道题还要求输出最大和的子段的左右端点。要求字典序最小,要求左右端点尽量靠左。 比如: 3 3 3 -9 3 3 3 输出的是1 3,而不是1 7 3 3 3 -9 3 3 阅读全文
posted @ 2019-04-09 21:35 ZERO- 阅读(248) 评论(0) 推荐(0) 编辑
摘要:Can you answer these queries III SPOJ - GSS3 这道题和洛谷的小白逛公园一样的题目。 传送门: 洛谷 P4513 小白逛公园-区间最大子段和-分治+线段树区间合并(单点更新、区间查询) 代码: 阅读全文
posted @ 2019-04-09 21:27 ZERO- 阅读(155) 评论(0) 推荐(0) 编辑
摘要:P4513 小白逛公园 题目背景 小新经常陪小白去公园玩,也就是所谓的遛狗啦… 题目描述 在小新家附近有一条“公园路”,路的一边从南到北依次排着nn个公园,小白早就看花了眼,自己也不清楚该去哪些公园玩了。 一开始,小白就根据公园的风景给每个公园打了分-.-。小新为了省事,每次遛狗的时候都会事先规定一 阅读全文
posted @ 2019-04-09 21:22 ZERO- 阅读(578) 评论(0) 推荐(0) 编辑
摘要:Multiply game Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 3224 Accepted Submission(s): 1173 P 阅读全文
posted @ 2019-04-09 21:15 ZERO- 阅读(328) 评论(0) 推荐(0) 编辑
摘要:Cleaning Shifts Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 4721 Accepted: 1593 Description Farmer John's cows, pampered since birth, h 阅读全文
posted @ 2019-04-02 21:29 ZERO- 阅读(405) 评论(0) 推荐(0) 编辑
摘要:ZOJ Problem Set - 1610 Count the ColorsTime Limit: 2 Seconds Memory Limit: 65536 KBPainting some colored segments on a line, some previously painted s 阅读全文
posted @ 2019-04-01 21:15 ZERO- 阅读(184) 评论(0) 推荐(0) 编辑
摘要:Count Color Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 53312 Accepted: 16050 Description Chosen Problem Solving and Program design as 阅读全文
posted @ 2019-02-25 16:59 ZERO- 阅读(361) 评论(0) 推荐(0) 编辑
摘要:G. Lpl and Energy-saving Lamps 42.07% 1000ms 65536K During tea-drinking, princess, amongst other things, asked why has such a good-natured and cute Dr 阅读全文
posted @ 2018-09-13 17:06 ZERO- 阅读(299) 评论(0) 推荐(0) 编辑
摘要:H.Ryuji doesn't want to study 27.34% 1000ms 262144K Ryuji is not a good student, and he doesn't want to study. But there are n books he should learn, 阅读全文
posted @ 2018-09-12 01:22 ZERO- 阅读(292) 评论(0) 推荐(0) 编辑
摘要:6356.Glad You Came 题意就是给你一个随机生成函数,然后从随机函数里确定查询的左右区间以及要更新的val值。然后最后求一下异或和就可以了。 线段树,区间最大值和最小值维护一下,因为数据有点大,不剪枝就会超时。(默默吐槽,剪了枝照样超时) 因为太菜,交了24遍也是没过,TLE,WA,R 阅读全文
posted @ 2018-08-16 19:53 ZERO- 阅读(315) 评论(2) 推荐(1) 编辑
摘要:6318.Swaps and Inversions 这个题就是找逆序对,然后逆序对数*min(x,y)就可以了。 官方题解:注意到逆序对=交换相邻需要交换的次数,那么输出 逆序对个数 即可。 求逆序对有4种操作,线段树 、BIT、归并排序、树状数组。 我敲了线段树、归并排序和树状数组版的。 关于这几 阅读全文
posted @ 2018-08-01 10:49 ZERO- 阅读(259) 评论(0) 推荐(0) 编辑
摘要:6315.Naive Operations 题意很好理解,但是因为区间求和求的是向下取整的a[i]/b[i],所以直接分数更新区间是不对的,所以反过来直接当a[i]==b[i]的时候,线段树对应的位置更新+1操作是可取的,但是怎样才能在合适的时候+1操作呢?一开始智障想的是只要单点是b[i]的倍数就 阅读全文
posted @ 2018-08-01 10:36 ZERO- 阅读(248) 评论(0) 推荐(0) 编辑
摘要:牛客小白月赛5 I.区间 (interval) 休闲的时候写的,但是写的心情有点挫,都是完全版线段树,我的一个队友直接就水过去了,为啥我的就超内存呢??? 试了一晚上,找出来了,多初始化了add标记数组或者将add标记数组定义为long long型就会超内存,并不是自己的线段树写的有问题,而是出题人 阅读全文
posted @ 2018-07-24 20:13 ZERO- 阅读(366) 评论(0) 推荐(0) 编辑
摘要:POJ3225.Help with Intervals 这个题就是对区间的各种操作,感觉这道题写的一点意思都没有,写到后面都不想写了,而且更神奇的是,自己的编译器连结果都输不出来,但是交上就过了,也是令人头大的操作,这题没意思,不要写了。我写到后面就写不下去了,直接去看了别人的代码。。。 代码: 5 阅读全文
posted @ 2018-07-18 10:09 ZERO- 阅读(390) 评论(1) 推荐(0) 编辑

点击右上角即可分享
微信分享提示