摘要: ST表类似树状数组,线段树这两种算法,是一种用于解决区间最值查询问题的离线算法。与线段树相比,预处理复杂度同为O(nlogn),但查询复杂度ST表为O(1),比线段树查询O(lgN)小,但就不涉及修改的区间查询而言,ST表无疑是更好的选择。 ST表主体,即st[i][j],表示数据数组a[ ]从下标 阅读全文
posted @ 2019-08-22 22:23 _HonEy 阅读(152) 评论(0) 推荐(0)
摘要: Balanced Lineup(POJ - 3264) For the daily milking, Farmer John's N cows (1 ≤ N ≤ 50,000) always line up in the same order. One day Farmer John decides 阅读全文
posted @ 2019-08-22 22:23 _HonEy 阅读(118) 评论(0) 推荐(0)
摘要: Strip Alexandra has a paper strip with n numbers on it. Let's call them ai from left to right. Now Alexandra wants to split it into some pieces (possi 阅读全文
posted @ 2019-08-22 22:23 _HonEy 阅读(318) 评论(0) 推荐(0)
摘要: Frequent values You are given a sequence of n integers a 1 , a 2 , ... , a n in non-decreasing order. In addition to that, you are given several queri 阅读全文
posted @ 2019-08-22 22:23 _HonEy 阅读(158) 评论(0) 推荐(0)