uva 10534 Wavio Sequence LIS】的更多相关文章

// uva 10534 Wavio Sequence // // 能够将题目转化为经典的LIS. // 从左往右LIS记作d[i],从右往左LIS记作p[i]; // 则最后当中的min(d[i],p[i])就是这个波动序列的一半 // 在这最后的min(d[i],p[i]) * 2 + 1 的最大值就是我们所要求的答案 // // 这题開始想的最后的答案是d[i]==p[i]的时候求最大. // 可是这样是不正确的,比如n=4, // 1,3,1,0 // 最长的应该是3,可是我的答案是1,…
题意:给定一个序列,求一个最长子序列,使得序列长度为奇数,并且前一半严格递增,后一半严格递减. 析:先正向和逆向分别求一次LIS,然后再枚举中间的那个数,找得最长的那个序列. 代码如下: #pragma comment(linker, "/STACK:1024000000,1024000000") #include <cstdio> #include <string> #include <cstdlib> #include <cmath>…
题目传送门 题意:找对称的,形如:123454321 子序列的最长长度 分析:LIS的nlogn的做法,首先从前扫到尾,记录每个位置的最长上升子序列,从后扫到头同理.因为是对称的,所以取较小值*2-1再取最大值 代码: /************************************************ * Author :Running_Time * Created Time :2015-8-5 21:38:32 * File Name :UVA_10534.cpp ******…
Wavio Sequence  Wavio is a sequence of integers. It has some interesting properties. ·  Wavio is of odd length i.e. L = 2*n + 1. ·  The first (n+1) integers of Wavio sequence makes a strictly increasing sequence. ·  The last (n+1) integers of Wavio s…
题目链接:https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=17&page=show_problem&problem=1475 Dynamic Programming. 最长增长子序列.推荐一个链接:http://www.cnblogs.com/liyukuneed/archive/2013/05/26/3090402.html.按照链接里的方法三(其他的会有TLE…
http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=1475 正反一次lis然后去min{左,右}*2-1即可 #include <cstdio> #include <cstring> #include <cmath> #include <string> #include <iostream&…
题目大意 给定一个长度为n的整数序列,求个最长子序列(不一定连续),使得该序列的长度为奇数2k+1,前k+1个数严格递增,后k+1个数严格递减.注意,严格递增意味着该序列中的两个相邻数不能相同.n<=10000 题解 这个题目和POJ1836有点相似,都是从左往右搞一遍LIS,然后从右到左也搞一遍LIS,然后枚举中间点,然后选取两者的较小者*2-1就是答案了 代码: #include <iostream> #include <algorithm> #include <c…
Wavio Sequence Time Limit:3000MS     Memory Limit:0KB     64bit IO Format:%lld & %llu Submit Status Practice UVA 10534 #include <stdio.h> #include <string.h> #include <algorithm> using namespace std; const int inf=0x3f3f3f3f; int mai…
Wavio Sequence Time Limit: 3000ms Memory Limit: 131072KB This problem will be judged on UVA. Original ID: 1053464-bit integer IO format: %lld      Java class name: Main   Wavio is a sequence of integers. It has some interesting properties. Wavio is o…
Wavio Sequence My Tags (Edit) Source : UVA Time limit : 1 sec Memory limit : 32 M Submitted : 296, Accepted : 123 Wavio is a sequence of integers. It has some interesting properties. Wavio is of odd length i.e. L = 2 * n + 1. The first (n+1) integers…