
尺取法
xuanweiace
一个热爱算法竞赛的弱校ACMer路过。青大本,浙大硕,方向后端开发,菜鸡一枚,奋斗ing...
展开
-
【CodeForces - 514D】R2D2 and Droid Army(二分+滑动窗口ST表,或 尺取+单调队列或STLmultiset)
题干:An army ofndroids is lined up in one row. Each droid is described bymintegersa1, a2, ..., am, whereaiis the number of details of thei-th type in this droid's mechanism. R2-D2 wants to des...原创 2019-10-14 19:16:44 · 337 阅读 · 0 评论 -
【HihoCoder - 1831】80 Days(尺取 或 线段树)
题干:80 Days is an interesting game based on Jules Verne's science fiction "Around the World in Eighty Days".In this game, you have to manage the limited money and time.Now we simplified the game a...原创 2019-09-03 18:52:18 · 314 阅读 · 1 评论 -
【HihoCoder - 1502】最大子矩阵(二维前缀和,尺取)
题干:给定一个NxM的矩阵A和一个整数K,小Hi希望你能求出其中最大(元素数目最多)的子矩阵,并且该子矩阵中所有元素的和不超过K。Input第一行包含三个整数N、M和K。以下N行每行包含M个整数,表示A。对于40%的数据,1 <= N, M <= 10 对于100%的数据,1 <= N, M <= 250 1 <= K <= 21474...原创 2019-07-07 10:53:09 · 644 阅读 · 0 评论 -
【HDU - 6119】小小粉丝度度熊 (区间合并,尺取,思维)
题干:度度熊喜欢着喵哈哈村的大明星——星星小姐。为什么度度熊会喜欢星星小姐呢?首先星星小姐笑起来非常动人,其次星星小姐唱歌也非常好听。但这都不是最重要的,最重要的是,星星小姐拍的一手好代码!于是度度熊关注了星星小姐的贴吧。一开始度度熊决定每天都在星星小姐的贴吧里面签到。但是度度熊是一个非常健忘的孩子,总有那么几天,度度熊忘记签到,于是就断掉了他的连续签到。...原创 2019-04-08 20:21:05 · 280 阅读 · 0 评论 -
【牛客OI周赛7-普及组ABCD 非官方题解】暴力,二分,KMP,尺取(STL或Hash)
A:链接:https://ac.nowcoder.com/acm/contest/372/A来源:牛客网某天,一只可爱的肥橘喵在路上走,突然遇到了一个怪人,那怪人自称PM6,“小肥喵,这里有一道水题,答对了我就请你吃狗肉,答错了你就请我吃猫肉!”喵咪瑟瑟发抖:“QAQ什么题?”PM6道:“给你坐标轴上的N个点,求出对于每个点,有多少个点的 X 坐标和 Y 坐标都大于它。”...原创 2019-02-24 09:41:29 · 643 阅读 · 0 评论 -
【POJ - 3320 】Jessica's Reading Problem (尺取,哈希)
题干:Jessica's a very lovely girl wooed by lots of boys. Recently she has a problem. The final exam is coming, yet she has spent little time on it. If she wants to pass it, she has to master all ideas...原创 2018-11-07 22:38:28 · 233 阅读 · 0 评论 -
【CodeForces - 616D 】Longest k-Good Segment (twopointer,尺取)
题干:The array a with n integers is given. Let's call the sequence of one or more consecutive elements in a segment. Also let's call the segment k-good if it contains no more than k different values....原创 2018-10-19 01:07:45 · 274 阅读 · 0 评论 -
【CodeForces - 660C】Hard Process (尺取 或 二分+滑窗,前缀和预处理)
题干:You are given an array a with n elements. Each element of a is either 0 or 1.Let's denote the length of the longest subsegment of consecutive elements in a, consisting of only numbers one, as f...原创 2018-10-19 01:03:51 · 562 阅读 · 0 评论 -
【CodeForces - 144C】Anagram Search(尺取,滑窗问题,处理字符串计数)
题干:A string t is called an anagram of the string s, if it is possible to rearrange letters in t so that it is identical to the string s. For example, the string "aab" is an anagram of the string "ab...原创 2018-10-14 23:08:25 · 347 阅读 · 0 评论 -
【HDU - 5672】String(尺取法)
题干:There is a string SS.SS only contain lower case English character.(10≤length(S)≤1,000,000)(10≤length(S)≤1,000,000) How many substrings there are that contain at least k(1≤k≤26)k(1≤k≤26) distinct...原创 2018-10-05 23:43:46 · 551 阅读 · 0 评论 -
【牛客161 - A】字符串(尺取法,桶标记法)
题干:时间限制:C/C++ 1秒,其他语言2秒空间限制:C/C++ 32768K,其他语言65536K64bit IO Format: %lld题目描述小N现在有一个字符串S。他把这这个字符串的所有子串都挑了出来。一个S的子串T是合法的,当且仅当T中包含了所有的小写字母。小N希望知道所有的合法的S的子串中,长度最短是多少。输入描述:一行一个字符串S。只包含小写字母。S的长...原创 2018-09-13 11:41:20 · 950 阅读 · 0 评论 -
【HDU - 5056】Boring count (尺取法)
题干:You are given a string S consisting of lowercase letters, and your task is counting the number of substring that the number of each lowercase letter in the substring is no more than K.InputIn...原创 2018-09-12 16:46:45 · 230 阅读 · 0 评论 -
【HDU - 1937 】Finding Seats(二维前缀和+尺取法)
题干:A group of K friends is going to see a movie. However, they are too late to get good tickets, so they are looking for a good way to sit all nearby. Since they are all science students, they decid...原创 2020-12-17 01:29:53 · 238 阅读 · 0 评论 -
【51Nod - 1001 】 数组中和等于K的数对 (排序+ 尺取)
题干:给出一个整数K和一个无序数组A,A的元素为N个互不相同的整数,找出数组A中所有和等于K的数对。例如K = 8,数组A:{-1,6,5,3,4,2,9,0,8},所有和等于8的数对包括(-1,9),(0,8),(2,6),(3,5)。Input第1行:用空格隔开的2个数,K N,N为A数组的长度。(2 <= N <= 50000,-10^9 <= K <= ...原创 2018-08-05 13:52:33 · 411 阅读 · 0 评论 -
*【POJ - 3061】 Subsequence (尺取或二分)
题干:A sequence of N positive integers (10 < N < 100 000), each of them less than or equal 10000, and a positive integer S (S < 100 000 000) are given. Write a program to find the minimal len...原创 2018-07-26 00:50:11 · 227 阅读 · 0 评论