题目链接:http://acm.csu.edu.cn/csuoj/problemset/problem?pid=1553 Description Give you a sequence of n numbers, and a number k you should find the max length of Good subsequence. Good subsequence is a continuous subsequence of the given sequence and its m…
Good subsequence Problem's Link:   http://acm.csu.edu.cn/OnlineJudge/problem.php?id=1553 Mean: 给你一个长度为n的序列和一个值k,让你找出一个子序列,满足在这个子序列中max-min的值<=k,求这个子序列最长的长度. analyse: 这题做法很多,直接暴力枚举每一个数为起点. Time complexity: O(n) Source code:  方法一(暴力): // Memory Time //…
1553: Good subsequence Time Limit: 2 Sec  Memory Limit: 256 MBSubmit: 794  Solved: 287[Submit][Status][Web Board] Description Give you a sequence of n numbers, and a number k you should find the max length of Good subsequence. Good subsequence is a c…
1553: Good subsequence Submit Page    Summary    Time Limit: 2 Sec     Memory Limit: 256 Mb     Submitted: 895     Solved: 335 Description Give you a sequence of n numbers, and a number k you should find the max length of Good subsequence. Good subse…
Description Give you a sequence of n numbers, and a number k you should find the max length of Good subsequence. Good subsequence is a continuous subsequence of the given sequence and its maximum value - minimum value<=k. For example n=5, k=2, the se…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5726 题意:给定数列,求区间[L,R]的GCD的值,并求出有多少个子区间满足和[L,R]的GCD相等. RMQ预处理所有区间的GCD,枚举所有区间的左边界i,起初固定右边界j,二分枚举右边界j的最大值,使得[i,j]区间内的GCD不变,更新对应GCD的值,大小为j-i. #include <bits/stdc++.h> using namespace std; typedef long long…
Subsequence Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 9236   Accepted: 3701 Description 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…
Subsequence Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 10875   Accepted: 4493 Description 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) ar…
题意:N个高度为hi的果子,摘果子的个数是从位置1开始从左到右的严格递增子序列的个数.有M次操作,每次操作对初始序列修改位置p的果子高度为q.每次操作后输出修改后能摘到得数目. 分析:将序列分为左.右两部分,每次修改之后的结果是p左部到p递增的子序列长度,加上右部第一个高度大于max(q,p位置之前最大的高度)位置开始的递增子序列长度. 左部的查询可以线性递推预处理得到,右部的查询需借助ST表预处理出区间最大值,并二分求得位置. #include<bits/stdc++.h> using na…
Description 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 length of the subsequence of consecutive elements o…