Type: RemoteJudge 1000ms 128MiB

[CCC 2015 S3] Gates

You cannot submit for this problem because the contest is ended. You can click "Open in Problem Set" to view this problem in normal mode.

题目描述

机场有 nn 个登机口,你需要按顺序安排 mm 架飞机,第 ii 架飞机只能使用 1gi1 \sim g_{i} 号登机口,一个登机口永久只能被一架飞机使用。当没有登机口可以供某架飞机使用时机场便会关闭,之后的飞机都不能登机。

请确定一种方案,使得有登机口的飞机数量最多。

输入格式

第一行一个整数 nn

第二行一个整数 mm

接下来 mm 行,每行一个整数 gig_{i}

输出格式

一行一个整数,表示最多能安排的飞机数量。

4
3
4
1
1
2
4
6
2
2
3
3
4
4
3

提示

【数据范围】:

对于 40%40\% 的数据,1n,m2×1031 \leq n,m \leq 2 \times 10^{3}

对于 100%100\% 的数据,1n,m1051 \leq n,m \leq 10^{5}1gin1 \leq g_{i} \leq n

本题中 Subtask 0 为原题数据,Subtask 1 为 Hack 数据,Hack 数据不计分。

练习

Not Attended
Status
Done
Rule
IOI
Problem
9
Start at
2023-11-15 7:00
End at
2023-11-15 17:00
Duration
10 hour(s)
Host
Partic.
12