随笔分类 -  数据结构—STL

摘要:Ivan is playing yet another roguelike computer game. He controls a single hero in the game. The hero has 𝑛n equipment slots. There is a list of 𝑐𝑖c 阅读全文
posted @ 2021-09-22 10:53 脂环 阅读(54) 评论(0) 推荐(0) 编辑
摘要:非常典型的csp之用stl数据结构xjb乱搞的题。要执行的操作是增加删除和查询,考虑到输入规模,每次操作的复杂度必须是log的(当然可m可以看作比较小的常数)。优先队列可以很好地实现插入和查询,但是删除的话最坏复杂度是O(n)的,pass。因此只剩下一个选择,就是set。因为这个题的输入保证商品两两 阅读全文
posted @ 2021-09-11 14:49 脂环 阅读(76) 评论(0) 推荐(0) 编辑
摘要:Problem Description You are required to put n straight lines on a plane, guaranteeing no three lines share a common point and no lines are coincident. 阅读全文
posted @ 2021-08-20 01:43 脂环 阅读(322) 评论(1) 推荐(1) 编辑
摘要:链接:https://ac.nowcoder.com/acm/contest/11261/F 来源:牛客网 题目描述 You are now the coordinator for the Nonexistent Old Railway Station! The Nonexistent Old Ra 阅读全文
posted @ 2021-08-17 12:02 脂环 阅读(67) 评论(0) 推荐(1) 编辑
摘要:Phoenix has n blocks of height h1,h2,…,hn, and all hi don't exceed some value x. He plans to stack all 𝑛n blocks into m separate towers. The height o 阅读全文
posted @ 2021-05-03 22:12 脂环 阅读(174) 评论(0) 推荐(0) 编辑
摘要:如果使用vector作为离散化的容器,一般情况下会先对vector进行排序然后再unique。但这样的话unique后实际上是把剩余重复的元素移到了容器最后面而非删除,因此直接对此时的容器进行二分查找会出现错误。 可行的写法是将erase和unique结合起来: sort(v.begin(), v. 阅读全文
posted @ 2021-05-02 21:39 脂环 阅读(189) 评论(0) 推荐(0) 编辑
摘要:给定一个循环数组(最后一个元素的下一个元素是数组的第一个元素),输出每个元素的下一个更大元素。数字 x 的下一个更大的元素是按数组遍历顺序,这个数字之后的第一个比它更大的数,这意味着你应该循环地搜索它的下一个更大的数。如果不存在,则输出 -1。 示例 1: 输入: [1,2,1] 输出: [2,-1 阅读全文
posted @ 2021-03-06 08:31 脂环 阅读(70) 评论(0) 推荐(0) 编辑
摘要:You are given a binary string s consisting of n zeros and ones. Your task is to divide the given string into the minimum number of subsequences in suc 阅读全文
posted @ 2020-08-07 15:26 脂环 阅读(314) 评论(0) 推荐(0) 编辑
摘要:You are given an array aa of length nn consisting of zeros. You perform nn actions with this array: during the ii -th action, the following sequence o 阅读全文
posted @ 2020-05-15 14:35 脂环 阅读(231) 评论(0) 推荐(0) 编辑
摘要:This is a harder version of the problem. In this version n≤500000n≤500000 The outskirts of the capital are being actively built up in Berland. The com 阅读全文
posted @ 2020-02-25 16:19 脂环 阅读(314) 评论(0) 推荐(0) 编辑
摘要:There is a robot on a coordinate plane. Initially, the robot is located at the point (0,0)(0,0) . Its path is described as a string ss of length nn co 阅读全文
posted @ 2020-02-06 15:14 脂环 阅读(402) 评论(7) 推荐(0) 编辑
摘要:题目描述 现在请求你维护一个数列,要求提供以下两种操作: 1、 查询操作。 语法:Q L 功能:查询当前数列中末尾L个数中的最大的数,并输出这个数的值。 限制:LLL不超过当前数列的长度。(L>0)(L > 0)(L>0) 2、 插入操作。 语法:A n 功能:将nnn加上ttt,其中ttt是最近一 阅读全文
posted @ 2020-02-01 20:36 脂环 阅读(183) 评论(0) 推荐(0) 编辑
摘要:题目描述 猫猫TOM和小老鼠JERRY最近又较量上了,但是毕竟都是成年人,他们已经不喜欢再玩那种你追我赶的游戏,现在他们喜欢玩统计。最近,TOM老猫查阅到一个人类称之为“逆序对”的东西,这东西是这样定义的:对于给定的一段正整数序列,逆序对就是序列中ai>aj且i<j的有序对。知道这概念后,他们就比赛 阅读全文
posted @ 2020-01-31 01:33 脂环 阅读(396) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示
主题色彩