题目大意:不知,根据样例猜测为最长上升子序列(竟然还对了)

题解:$O(n log_2 n)$,求二维偏序,(q为存答案的序列,a存原序列,len为答案)

for(int i = 1; i <= n; i++) {
    if(a[i] > q[len]) {q[++len]=a[i];continue;}
    *upper_bound(q, q + len, a[i]) = a[i];
}

卡点:

C++ Code:

#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
int T, n ,a;
int f[40010], cnt;
int main() {
scanf("%d", &T);
while (T--) {
scanf("%d", &n);
memset(f, 0x3f, sizeof f);
for (int i = 0 ; i < n; i++) {
scanf("%d", &a);
*lower_bound(f, f + n, a) = a;
}
printf("%d\n",lower_bound(f, f + n, 0x3f3f3f3f) - f);
}
return 0;
}

  

[POJ1631]Bridging signals的更多相关文章

  1. [POJ1631]Bridging signals (DP,二分优化)

    题目链接:http://poj.org/problem?id=1631 就是求一个LIS,但是范围太大(n≤40000),无法用常规O(n²)的朴素DP算法,这时需要优化. 新加一个数组s[]来维护长 ...

  2. POJ 1631 Bridging signals

    Bridging signals Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 9441   Accepted: 5166 ...

  3. hdu----(1950)Bridging signals(最长递增子序列 (LIS) )

    Bridging signals Time Limit: 5000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) ...

  4. poj 1631 Bridging signals (二分||DP||最长递增子序列)

    Bridging signals Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 9234   Accepted: 5037 ...

  5. OpenJudge/Poj 1631 Bridging signals

    1.链接地址: http://poj.org/problem?id=1631 http://bailian.openjudge.cn/practice/1631 2.题目: Bridging sign ...

  6. POJ 1631 Bridging signals(LIS O(nlogn)算法)

    Bridging signals Description 'Oh no, they've done it again', cries the chief designer at the Waferla ...

  7. hdoj 1950 Bridging signals【二分求最大上升子序列长度】【LIS】

    Bridging signals Time Limit: 5000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) ...

  8. Bridging signals(二分 二分+stl dp)

    欢迎参加——每周六晚的BestCoder(有米!) Bridging signals Time Limit: 5000/1000 MS (Java/Others)    Memory Limit: 6 ...

  9. POJ 1631 Bridging signals(LIS 二分法 高速方法)

    Language: Default Bridging signals Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 1076 ...

随机推荐

  1. 【bind服务简单发布及优化部署】

    主DNS 1:安装bind服务包 2:vim  /etc/named.conf区域解析控制文件 3:vim /etc/named.rfc1912.zones解析方向文件 4:vim var/named ...

  2. MIP组件开发 自定义js组件开发步骤

    什么是百度MIP? MIP(Mobile Instant Pages - 移动网页加速器)主要用于移动端页面加速 官网参考:https://www.mipengine.org/doc/00-mip-1 ...

  3. Leecode刷题之旅-C语言/python-101对称二叉树

    /* * @lc app=leetcode.cn id=101 lang=c * * [101] 对称二叉树 * * https://leetcode-cn.com/problems/symmetri ...

  4. Vijos 纸牌

    题目网址 https://vijos.org/d/Randle/p/5a0011e1d3d8a10a532d6d71 题目描述 在桌面上放着n张纸牌,每张纸牌有两面,每面都写着一个非负整数.你的邪王真 ...

  5. Infinite Maze CodeForces - 196B

    We've got a rectangular n × m-cell maze. Each cell is either passable, or is a wall (impassable). A ...

  6. stm32+lwip(一):使用STM32CubeMX生成项目

    我是卓波,很高兴你来看我的博客. 系列文章: stm32+lwip(一):使用STM32CubeMX生成项目 stm32+lwip(二):UDP测试 stm32+lwip(三):TCP测试 stm32 ...

  7. POJ2739 Sum of Consecutive Prime Numbers 确定某个数以内的所有素数

    参考:https://www.cnblogs.com/baozou/articles/4481191.html #include <iostream> #include <cstdi ...

  8. python学习之函数基础

    第一个python函数: >>> def func_1(): ... print 'hello python' ... >>> func_1() hello pyt ...

  9. responsive grid

    http://csswizardry.com/csswizardry-grids/ http://unsemantic.com/demo-responsive http://getbootstrap. ...

  10. JS 实现AJAX封装(只限于异步)

    1.AJAX 分为异步 和 同步 请求 比如你去买一个食品,但是商店暂时没有这个食品 异步:等到商品有了再来买,这个期间我可以去做别的事: 同步:一直在这里等,什么时候商品来了,买到手了,再去做别的事 ...