摘要: #include <iostream> #include <algorithm> #include<cstdio> using namespace std; int a[1005][1005],b[1005][1005]; int main() { int n; scanf("%d",&n); fo 阅读全文
posted @ 2022-05-22 11:53 半喜 阅读(37) 评论(0) 推荐(0)
摘要: #include <iostream> #include <algorithm> #include<queue> using namespace std; int main() { int n,i,j; int t1,t2,w,temp; int sum; priority_queue<int,ve 阅读全文
posted @ 2022-05-21 23:28 半喜 阅读(18) 评论(0) 推荐(0)
摘要: #include <iostream> #include<queue> #include<cstdio> #include<cstring> using namespace std; struct node { char s[20]; int x; friend bool operator < (n 阅读全文
posted @ 2022-05-21 23:16 半喜 阅读(91) 评论(0) 推荐(0)
摘要: 优先队列(priority queue) 普通的队列是一种先进先出的数据结构,元素在队列尾追加,而从队列头删除。 在优先队列中,元素被赋予优先级。当访问元素时,具有最高优先级的元素最先删除。 优先队列具有最高级先出的行为特征。通常采用堆数据结构来实现。 priority_queue常用方法 push 阅读全文
posted @ 2022-05-21 23:06 半喜 阅读(46) 评论(0) 推荐(0)
摘要: #include<iostream> #include<cstdio> #include<stack> #include<string> using namespace std; stack<int>p1; stack<char>p2; int n; string s; int main() { i 阅读全文
posted @ 2022-05-21 19:29 半喜 阅读(30) 评论(0) 推荐(0)
摘要: #include<cstdio> #include<map> using namespace std; map<int,int>mymap; map<int,int>::iterator it; int main(){ int n,i,k,x; scanf("%d",&n); for(i=1;i<= 阅读全文
posted @ 2022-05-20 23:27 半喜 阅读(13) 评论(0) 推荐(0)
摘要: map是STL的一个关联容器,它提供一对一(其中第一个可以称为关键字,每个关键字只能 在map中出现一次,第二个可能称为该关键字的值)的数据 处理能力,由于这个特性,它 完成有可能在我们处理一对一数据的时候,在编程上提供快速通道。map内部自建一颗红黑 树(一 种非严格意义上的平衡二叉树),这颗树具 阅读全文
posted @ 2022-05-16 16:36 半喜 阅读(33) 评论(0) 推荐(0)
摘要: #include<iostream> #include<list> using namespace std; bool vis[100002]; //用来判断x同学是否还在队列中 list<int> li; //存储学生序号 list<int>::iterator pos[100002]; //迭代 阅读全文
posted @ 2022-05-16 16:31 半喜 阅读(33) 评论(0) 推荐(0)
摘要: List是一个双链表模板,可以从 任何地方快速插入与删除元素。 它的每个结点之间通过指针链接, 不能随机访问元素。 主要成员函数如下: empty():判断链表容器是否为空 size():返回链表容器中实际元素个数 push_back():在链表尾部插入元素 pop_back():删除链表容器的最后 阅读全文
posted @ 2022-05-15 21:07 半喜 阅读(23) 评论(0) 推荐(0)
摘要: #include<iostream> #include<cstdio> #include<set> using namespace std; int main() { multiset<int> s; multiset<int>::iterator it; int n,t,o; s.clear(); 阅读全文
posted @ 2022-05-15 15:42 半喜 阅读(39) 评论(0) 推荐(0)