STL queue
文章平均质量分 86
twh233
嘻嘻
展开
-
优先队列
C++优先队列的基本使用方法 #include#include#includeusing namespace std;struct node{ friend bool operator { return n1.priority "为从小打到排列 } int priority; int value转载 2017-02-13 19:09:17 · 167 阅读 · 0 评论 -
双向队列 HDU - 5929
Mr. Frog learned a basic data structure recently, which is called stack.There are some basic operations of stack: ∙∙ PUSH x: put x on the top of the stack, x must be 0 or 1. ∙∙ POP: throw th原创 2017-03-02 20:27:41 · 207 阅读 · 0 评论 -
Contest Score (优先队列)
题意:可以在短时间内(可忽略)看k个问题。然后选择一个问题回答,计算时间,(包括之前花的时间)。如果题没读完可以接着读。#includeusing namespace std;#define pi acos(-1)#define endl '\n'#define rand() srand(time(0));#define me(x) memset(x,0,sizeof(原创 2017-07-08 00:29:37 · 431 阅读 · 0 评论 -
Codeforces Round #433 (Div. 2 C. Planning(优先队列)
传送门C. Planningtime limit per test1 secondmemory limit per test512 megabytesinputstandard inputoutputstandard outputHelen works in Metropolis airport. She原创 2017-09-07 00:08:02 · 403 阅读 · 0 评论 -
codeforces 747C Servers
C. Serverstime limit per test 2 secondsmemory limit per test 256 megabytesinput standard inputoutput standard outputThere are n servers in a laboratory, each of原创 2016-12-20 22:52:36 · 320 阅读 · 0 评论 -
Educational Codeforces Round 31 D. Boxes And Balls
http://codeforces.com/problemset/problem/884/D题意:现在在1盒子中有N中颜色的求各ai个,要求操作若干次使得颜色i的球全部进入i盒子中,操作为:从某个盒子中取出所有的球,花费是取出球的总个数,然后把这些球分成k堆,放到k个空的盒子中去,k=2或者3.求最小花费。冷静分析,识破。这肯定每次分三堆更优秀呀。既然我每次都花了这么多原创 2017-11-09 18:40:51 · 186 阅读 · 0 评论 -
ZOJ - 3953 Intervals 线段区间重叠处理
https://vjudge.net/problem/ZOJ-3953题意:给了n个区间,要求你删去最少的区间,使任意三个区间 a,b,c 不存在 a与b相交,b与c相交,c与a相交 的情况做法:xgg太**猛了呀,刚开始就觉得这个是贪心,但我肯定写不出来(事实也如此,感觉现在想通好多了。 看到l[i] r[i]范围,离散化嘛,这个没得说,一分析一画图,如果在同等左端原创 2017-11-13 19:41:29 · 242 阅读 · 0 评论 -
牛客2017校招真题在线编程 回文序列(双向队列
题目链接 现在才知道双向队列是这么玩的,好菜啊鬼鬼。每次取头和尾,因为回文序列的头和尾一定是一样的,如果相等就把头和尾从队列中去除。如果不相等就从少的那一端取相邻的加起来扔进队列中相应的位置。SO easy #pragma comment(linker, "/STACK:1024000000,1024000000")#include <vector>#in...原创 2018-09-10 13:08:24 · 203 阅读 · 0 评论