摘要:
本题求最大上升子序列,这个很容易看出来。数据大小是50万,所以不能用O(n^2)的方法来求。因为1000万以上次循环就可能超时。若用二分来解决,时间复杂度为O(nlogn)。代码使用了我认为的最经典的二分形式。#include <iostream>using namespace std;const int MAXCITYNUM = 500005;int poorCity[MAXCITYNUM],ans[MAXCITYNUM];int main (){int caseNum = 1,cityNum; while (scanf("%d",&cityNum) 阅读全文
posted @ 2012-08-06 22:07
peaceful
阅读(177)
评论(0)
推荐(0)

浙公网安备 33010602011771号