分析:大于等于m的变成1,否则变成0,预处理前缀和,枚举起点,找到第一个点前缀和大于m即可 找第一个点可以二分可以尺取 #include <cstdio> #include <cstring> #include <cmath> #include <algorithm> using namespace std; typedef long long LL; ; int T,n,m,k,a[N],sum[N]; int main(){ scanf("%d…
分析:维护空隙的差,然后预处理前缀最大,后缀最大,扫一遍 #include <cstdio> #include <cstring> #include <cmath> #include <algorithm> using namespace std; typedef long long LL; ; int a[N],T,n,b[N],l[N],r[N]; int main(){ scanf("%d",&T); while(T--){…
NanoApe Loves Sequence Ⅱ Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 262144/131072 K (Java/Others)Total Submission(s): 517    Accepted Submission(s): 250 Problem Description NanoApe, the Retired Dog, has returned back to prepare for for t…
题目链接: NanoApe Loves Sequence Ⅱ Time Limit: 4000/2000 MS (Java/Others)     Memory Limit: 262144/131072 K (Java/Others) Problem Description NanoApe, the Retired Dog, has returned back to prepare for for the National Higher Education Entrance Examinatio…
题目大意:给一个整数序列,统计<k,m>子序列的数目.<k,m>序列是满足第k大的数字不比m小的连续子序列. 题目分析:维护一个不小于m的数的个数的后缀和数组,可以枚举序列起点,二分查找右端点序列最近的一个<k,m>序列.因为最近右端点是不减的,所以也可以用two-pointer在O(n)的时间复杂度内得到结果. 代码如下: 使用二分查找: # include<iostream> # include<cstdio> # include<st…
NanoApe Loves Sequence Accepts: 531 Submissions: 2481 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 262144/131072 K (Java/Others) Problem Description NanoApe, the Retired Dog, has returned back to prepare for the National Higher Education Entr…
传送门 NanoApe Loves Sequence Ⅱ Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 262144/131072 K (Java/Others)Total Submission(s): 1585    Accepted Submission(s): 688 Description NanoApe, the Retired Dog, has returned back to prepare for for the…
传送门 NanoApe Loves Sequence Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 262144/131072 K (Java/Others) Total Submission(s): 1323    Accepted Submission(s): 521 Description NanoApe, the Retired Dog, has returned back to prepare for the Natio…
A题 Price List 巨水..........水的不敢相信. #include <cstdio> typedef long long LL; int main() { int T; scanf("%d",&T); while(T--) { int n,m,x; scanf("%d%d",&n,&m); LL sum = ; ; i < n; i++) { int x; scanf("%d",&…
A.Price List Sol 求和查询 Code #include<cstdio> #include<algorithm> #include<iostream> using namespace std; typedef long long LL; const int N = 100005; //LL v[N]; inline LL in(LL x=0,char ch=getchar()){ while(ch>'9'||ch<'0') ch=getchar…