会场安排问题
摘要:
题目链接:http://acm.nyist.net/JudgeOnline/problem.php?pid=14经典问题。此题的最佳解法是用贪心算法:1) 将所有输入活动按照结束时间从早到晚排序2) 顺序遍历列表,将可以加入日程的活动加入,并维护活动计数3) 遍历完毕后,输出活动计数整个过程需要1) 将活动列表排序O(nlogn) 2) 遍历列表O(n),因此复杂度为O(nlogn)#include <iostream>#include <vector>#include <utility>#include <algorithm>using nam 阅读全文
posted @ 2011-04-30 20:58 mdyang 阅读(2841) 评论(0) 推荐(0)
浙公网安备 33010602011771号