HDU1003 HDU1231 题意自明.可能是真的进步了点,记得刚开始研究这个问题时还想了好长时间,hdu 1231还手推了很长时间,今天重新写干净利落就AC了. #include<iostream> #include<cstring> #include<cstdio> #include<algorithm> using namespace std; ; int a[MAXN]; int main() { int T,N; scanf("%d&q…
题意: T个测试数据 n个数 q个查询 n个数 ( 下标从0开始) Q u v 查询 [u, v ] 区间最长连续上升子序列 U u v 把u位置改成v #include<iostream> #include<stdio.h> #include<string.h> #include<algorithm> using namespace std; #define N 101010 #define L(x) (x<<1) #define R(x) (…
题意:两种操作,Q L R查询L - R 的最长连续上升子序列长度,U pos val 单点修改值 #include <bits/stdc++.h> #define N 100005 using namespace std; ],pre[N<<],suf[N<<],arr[N];维护区间lcs长度,以左端点为起点的lcs长度,以右端点为终点的lcs长度,这么做是为了处理区间合并后区间总lcs值的更新 void pushup(int l,int r,int rt) { ;…
题目描述与背景介绍 背景题目: [674. 最长连续递增序列]https://leetcode-cn.com/problems/longest-continuous-increasing-subsequence/ [300. 最长递增子序列]https://leetcode-cn.com/problems/longest-increasing-subsequence/ 这两个都是DP的经典题目,674比较简单. 代码: class Solution { public int findLength…
HDU 1074 Doing Homework (动态规划,位运算) Description Ignatius has just come back school from the 30th ACM/ICPC. Now he has a lot of homework to do. Every teacher gives him a deadline of handing in the homework. If Ignatius hands in the homework after the d…
http://acm.hdu.edu.cn/showproblem.php?pid=1231 最大连续子序列 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 23789 Accepted Submission(s): 10638 Problem Description 给定K个整数的序列{ N1, N2, ..., NK },其任意…
pid=1231">最大连续子序列 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 18461 Accepted Submission(s): 8202 Problem Description 给定K个整数的序列{ N1, N2, ..., NK },其随意连续子序列可表示为{ Ni, Ni+1, ..., Nj },当中…
Max Sum Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 154155 Accepted Submission(s): 35958 Problem Description Given a sequence a[1],a[2],a[3]......a[n], your job is to calculate the max su…
最大连续子序列 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 18603 Accepted Submission(s): 8268 Problem Description 给定K个整数的序列{ N1, N2, ..., NK }.其随意连续子序列可表示为{ Ni, Ni+1, ..., Nj }.当中 1 <= i <= j…
和前面两道题一样 不过这题要求输出子序列首尾的元素的值,而且如果所有元素都小于0的话,规定子序列的和为0,并输出整个序列的首尾元素. //#define LOCAL #include <iostream> #include <cstdio> #include <cstring> using namespace std; + ; int a[maxn]; struct Node { int w; int l, r; }node[maxn]; int main(void)…
题目(1231) #include<stdio.h> #include<iostream> using namespace std; int main() { int K,num[10010],cnt; int end,start,thisMax,Max,temp; while(cin>>K&&K) { cnt=0; for( int i=0; i<K; i++) { scanf("%d",&num[i]); if(nu…
Max Sum Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 250714 Accepted Submission(s): 59365 Problem Description Given a sequence a[1],a[2],a[3]......a[n], your job is to calculate the max su…