摘要: 优先队列是单向队列的一种,可以按照默认或自定义的一种方式来对队列中的数据进行动态排序 用法: 1、默认用<运算符进行排序 大的先输出 2、priority_queue<type, vector<type>, fun<type>>pq; vector<type>为容器类型 fun<type>为比较函数 阅读全文
posted @ 2016-10-16 23:24 KennyRom 阅读(170) 评论(0) 推荐(0) 编辑
摘要: //双端队列 //deque的成员函数 c.assign(beg, end); //将[beg, end]区间中的数据赋值给c c.assign(n, elem); //将n个elem的拷贝赋值给c c.at(idx); //传回索引idx所指的数据,如果idx越界,抛出out_of_range c.back(); ... 阅读全文
posted @ 2016-10-16 21:57 KennyRom 阅读(173) 评论(0) 推荐(0) 编辑
摘要: //deque /* what is a deque? In Chinese, it's called "双端队列". It's different from a queue. Its elements can be added to or removed from either the front(head) or back(tail) ,called a head-tail linked l... 阅读全文
posted @ 2016-10-16 20:17 KennyRom 阅读(282) 评论(0) 推荐(0) 编辑
摘要: 本题我暂时没有好的解法,自想到把他们枚举,然后一个一个试就可以了 输入受限的双端队列不可以得到:4213、4231 输出受限的双端队列不可以得到:4132、4231 阅读全文
posted @ 2016-10-16 18:59 KennyRom 阅读(3903) 评论(0) 推荐(0) 编辑