(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. 【NOIP2016提高A组8.12】奇袭

    题目 由于各种原因,桐人现在被困在Under World(以下简称UW)中,而UW马上要迎来最终的压力测试--魔界入侵. 唯一一个神一般存在的Administrator被消灭了,靠原本的整合骑士的力量 ...

  2. asp.net mvc大文件上传、断点续传功能。

    文件夹数据库处理逻辑 publicclass DbFolder { JSONObject root; public DbFolder() { this.root = new JSONObject(); ...

  3. POJ 3764 The xor-longest Path ( 字典树求异或最值 && 异或自反性质 && 好题好思想)

    题意 : 给出一颗无向边构成的树,每一条边都有一个边权,叫你选出一条路,使得此路所有的边的异或值最大. 分析 : 暴力是不可能暴力的,这辈子不可能暴力,那么来冷静分析一下如何去做.假设现在答案的异或值 ...

  4. Leetcode 4. Median of Two Sorted Arrays(中位数+二分答案+递归)

    4. Median of Two Sorted Arrays Hard There are two sorted arrays nums1 and nums2 of size m and n resp ...

  5. 运行PHP出现No input file specified错误解决办法

    配置了一台新服务器,使用的是IIS + Fastcgi + PHP 5.3.X,访问php页面的时候就会报错“No input file specified” 在php.ini文件里面修改: 1.增加 ...

  6. ELK实时日志分析平台环境部署--完整记录(ElasticSearch+Logstash+Kibana )

    https://blog.csdn.net/oLevin/article/details/81020794

  7. 修改 video.js 默认 bufferTime

    1.自建rtmp推流.转发.播放,前端用video.js 发现总延时在2秒多,服务器已优化,看看video.js能否优化 2.引用:在RTMP播放器侧,很重要的一点是:在  NetStream.set ...

  8. mysql5.7多实例安装

    [root@vhost1]# cd /opt/source[root@vhost1]#ls mysql-5.7.21-linux-glibc2.12-x86_64.tar.gz[root@vhost1 ...

  9. p4841 城市规划

    分析 https://www.luogu.org/blog/DRA/solution-p4841 代码(似乎附赠了一个全家桶呢) #pragma GCC optimize(2) #pragma GCC ...

  10. 安装python是提示 0x80072f7d 错误的解决办法

    最简单的方法: Internet 选项-> 高级里面 勾选使用TLS1.1和使用TLS1.2即可.实际测试是ok的