(https://atcoder.jp/contests/abc134/tasks/abc134_e)

题意:找出最小个数的最长上升子序列

思路:找出最长上升子序列的最小个数,只需要找出每个最小上升子序列的最后一个元素,然后元素个数之和就是最长上升子序列的最小个数

#include <iostream>
#include<set>
#include<cstdio>
#include<algorithm>
using namespace std;
const int maxn =1e5+;
int a[maxn];
multiset<int> q;
int main()
{
ios::sync_with_stdio(false);
cin.tie();
int n;
cin >> n;
for(int i=;i<=n;i++)
cin >> a[i];
for(int i=;i<=n;i++)
{
multiset<int>:: iterator it =q.lower_bound(a[i]);
if(it==q.begin())
q.insert(a[i]);
else
{
it--;
q.erase(it);
q.insert(a[i]);
}
}
cout << q.size();
return ;
}

AtCoder Beginner Contest 134-E - Sequence Decomposing的更多相关文章

  1. AtCoder Beginner Contest 179 E - Sequence Sum (模拟)

    题意:\(f(x,m)\)表示\(x\ mod\ m\),\(A_{1}=1\),而\(A_{n+1}=f(A^{2}_{n},M)\),求\(\sum^{n}_{i=1}A_{i}\). 题解:多算 ...

  2. AtCoder Beginner Contest 100 2018/06/16

    A - Happy Birthday! Time limit : 2sec / Memory limit : 1000MB Score: 100 points Problem Statement E8 ...

  3. AtCoder Beginner Contest 064 D - Insertion

    AtCoder Beginner Contest 064 D - Insertion Problem Statement You are given a string S of length N co ...

  4. AtCoder Beginner Contest 068 ABCD题

    A - ABCxxx Time limit : 2sec / Memory limit : 256MB Score : 100 points Problem Statement This contes ...

  5. AtCoder Beginner Contest 154 题解

    人生第一场 AtCoder,纪念一下 话说年后的 AtCoder 比赛怎么这么少啊(大雾 AtCoder Beginner Contest 154 题解 A - Remaining Balls We ...

  6. AtCoder Beginner Contest 052

    没看到Beginner,然后就做啊做,发现A,B太简单了...然后想想做完算了..没想到C卡了一下,然后还是做出来了.D的话瞎想了一下,然后感觉也没问题.假装all kill.2333 AtCoder ...

  7. AtCoder Beginner Contest 053 ABCD题

    A - ABC/ARC Time limit : 2sec / Memory limit : 256MB Score : 100 points Problem Statement Smeke has ...

  8. AtCoder Beginner Contest 136

    AtCoder Beginner Contest 136 题目链接 A - +-x 直接取\(max\)即可. Code #include <bits/stdc++.h> using na ...

  9. AtCoder Beginner Contest 137 F

    AtCoder Beginner Contest 137 F 数论鬼题(虽然不算特别数论) 希望你在浏览这篇题解前已经知道了费马小定理 利用用费马小定理构造函数\(g(x)=(x-i)^{P-1}\) ...

  10. AtCoder Beginner Contest 076

    A - Rating Goal Time limit : 2sec / Memory limit : 256MB Score : 100 points Problem Statement Takaha ...

随机推荐

  1. 用idea搭建SSM框架maven项目

    打开idea,点击New - Project 找到Maven一栏,因为要搭建的SpringMvc项目,所以选择webapp模板 填写好GroupId和ArtifactId后,一步步next,最后fin ...

  2. springboot + 注解 + 拦截器 + JWT 实现角色权限控制

    1.关于JWT,参考: (1)10分钟了解JSON Web令牌(JWT) (2)认识JWT (3)基于jwt的token验证 2.JWT的JAVA实现 Java中对JWT的支持可以考虑使用JJWT开源 ...

  3. #431 Div2 Problem B Tell Your World (鸽巢原理 && 思维)

    链接 : http://codeforces.com/contest/849/problem/B 题意 : 给出 n 个在直角坐标系上的点,每个点的横坐标的值对应给出的顺序序数,比如 1 2 4 3 ...

  4. AC自动机及其模板

    模板 #include<queue> #include<stdio.h> #include<string.h> using namespace std; ; ; ; ...

  5. python 指定画图分辨率

    from IPython.core.pylabtools import figsize # import figsize figsize(12.5, 4) # 设置 figsize plt.rcPar ...

  6. OpenCV Mat&Operations

    /*M/////////////////////////////////////////////////////////////////////////////////////////// IMPOR ...

  7. npm install 成功安装依赖后,运行跑不起来怎么办?

    最近接手公司的项目,由于代码历史悠久,据说已经最少经历过了6个人的手,查看gitee提交的年限,竟然是1-2年前的代码,好吧.这个锅总得有人接,既然是架构师,就要勇于面对挑战,今天把我解决的方法记录起 ...

  8. zabbix自定义模板监控oracle

    zabbix服务器端安装:zabbix-3.2.6.tar.gzzabbix client端安装:zabbix-agent-3.2.6-1.x86_64.rpm 1.首先必须在目标机器安装zabbix ...

  9. springBoot项目常用maven依赖以及依赖说明

    springBoot项目常用maven依赖以及依赖说明 1:maven-compiler-plugin <build> <plugins> <!-- 指定maven编译的 ...

  10. AOF — Redis 设计与实现

    w AOF — Redis 设计与实现http://redisbook.readthedocs.io/en/latest/internal/aof.html