Fork me on GitHub
摘要: 优先队列。做法:维护两个优先队列:quesell 和 quebuy, 一个是小值优先,一个是大值优先。每次push的时候,都取各自的Top元素,比较价格,如果卖的比卖的出价低,则成交,各自的要买和要卖的股票数量减少能够减少的最大值,此时的DP(DealPrice)被记录下来。具体见代码:#include #include #include #include #include #include #include using namespace std;#define N 100003struct SELL{ int price,num; bool operator a.price; ... 阅读全文
posted @ 2014-03-01 10:28 whatbeg 阅读(515) 评论(0) 推荐(0)