Public Judge

pjudge

Time Limit: 1 s Memory Limit: 256 MB Total points: 7 Hackable ✓

#21631. 【PER #1】子序列

Statistics

给定一个长度为 $n$ 的序列,你需要找到一个最长的子序列,使得这个子序列的最长上升子序列长度小于原序列的最长上升子序列长度。

输入格式

第一行一个正整数 $n$ 。

第二行 $n$ 个正整数 $a_1,a_2,\cdots,a_n$ 。

输出格式

一行一个正整数,表示最长的合法子序列长度。

样例 $1$

input

6
4 6 5 2 1 3

output

4

样例 $2\sim 7$

见下发文件。

数据范围与提示

对于所有数据,$1\le n\le 5\times 10^5$,$1\le a_i\le 10^9$ 。

时间限制:$\texttt{1s}$

空间限制:$\texttt{512MB}$

Discussions

About Discussions

The discussion section is only for posting: Editorials, General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues. Submitting multiple issues may cause your account to be banned.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.