Problem 3169 --15_C : Activity Selection Problem

3169: 15_C : Activity Selection Problem

"
Time Limit $1$ 秒/Second(s) Memory Limit $512$ 兆字节/Megabyte(s)
提交总数 $0$ 正确数量 $0$
裁判形式 标准裁判/Standard Judge 我的状态 尚未尝试
难度 分类标签 STL

Activity Selection Problem

There are $n$ acitivities with start times $\{s_i\}$ and finish times $\{t_i\}$. Assuming that a person can only work on a single activity at a time, find the maximum number of activities that can be performed by a single person.

nn s1s1 t1t1 s2s2 t2t2 : snsn tntn

The first line consists of the integer nn. In the following nn lines, the start time sisi and the finish time titi of the activity ii are given.

Print the maximum number of activities in a line.
5
1 2
3 9
3 5
5 9
6 8
3

Constraints

  • 1n1051≤n≤105
  • 1si<ti109(1in)1≤si<ti≤109(1≤i≤n)


推荐代码 查看3169 所有题解 上传题解视频得图灵币

本题记录 用 户(点击查看用户) 运行号(点击购买题解) 时 间
算法最快[$ $ms]
内存最少[$ $KB]
第一AC
第一挑战

赛题来源/所属竞赛 会津大学《挑战数据结构与算法》 挑战数据结构与算法

竞赛编号 竞赛名称 竞赛时间 访问比赛