
队列
文章平均质量分 61
bao___zi
ACM 弱鸡一枚
What this era lacks is not the person who is perfect but the person who is with virtue, justice, courage and compassion.
展开
-
tokitsukaze and Soldier【优先队列】
题目链接题目描述 在一个游戏中,tokitsukaze需要在n个士兵中选出一些士兵组成一个团去打副本。 第i个士兵的战力为v[i],团的战力是团内所有士兵的战力之和。 但是这些士兵有特殊的要求:如果选了第i个士兵,这个士兵希望团的人数不超过s[i]。(如果不选第i个士兵,就没有这个限制。) tokitsukaze想知道,团的战力最大为多少。输入描述:第一行包含一个正整数n(1≤n≤10^5)。接下来n行,每行包括2个正整数v,s(1≤v≤10^9,1≤s≤n)。输出描述:输出一个正整数,原创 2022-05-14 09:52:09 · 231 阅读 · 0 评论 -
第k小【优先队列】
题目链接题目描述 有一个长度为n的数组,值为 a[i], 牛牛想找到数组中第 k 小的数。比如 1 2 2 3 4 6 中,第 3 小的数就是2. 牛牛觉得这个游戏太简单了,想加一点难度,现在牛牛有 m 个操作,每个操作有两种类型。 1 x 1 代表操作一,给数组中加一个元素 x 。(0 ≤ x ≤ 1e9) 2 2 代表操作二,查询第 k 小的数。如果没有 k 个数就输出−1输入描述:第一行有三个整数,n m k,(1≤n,m,k≤2e5)第二行包含 n 个整数 a[i] (原创 2022-05-13 19:41:49 · 528 阅读 · 0 评论 -
Codeforces 950C Zebras
Oleg writes down the history of the days he lived. For each day he decides if it was good or bad. Oleg calls a non-empty sequence of days a zebra, if it starts with a bad day, ends with a bad day, and...原创 2018-03-10 02:10:37 · 348 阅读 · 0 评论 -
Codeforces 948C Producing Snow
Alice likes snow a lot! Unfortunately, this year's winter is already over, and she can't expect to have any more of it. Bob has thus bought her a gift — a large snow maker. He plans to make some amoun...原创 2018-03-11 17:28:11 · 571 阅读 · 0 评论 -
Codeforces 960B Minimize the error
You are given two arrays A and B, each of size n. The error, E, between these two arrays is defined . You have to perform exactly k1 operations on array A and exactly k2 operations on array B. In one ...原创 2018-04-08 18:53:27 · 307 阅读 · 1 评论 -
Codeforces 962D Merge Equals
You are given an array of positive integers. While there are at least two equal elements, we will perform the following operation. We choose the smallest value x that occurs in the array 2 or more tim...原创 2018-04-11 19:40:31 · 1018 阅读 · 1 评论 -
2018年东北农业大学春季校赛 H why的吃鸡
链接:点击打开链接题目描述 最近吃鸡游戏非常火,你们wyh学长也在玩这款游戏,这款游戏有一个非常重要的过程,就是要跑到安全区内,否则就会中毒持续消耗血量,我们这个问题简化如下 假设地图为n*n的一个图,图中有且仅有一块X的联通快代表安全区域,有一个起点S代表缩圈的时候的起点,图中C代表的是车(保证车的数量小于等于100),标记为.的代表空地,可以任意通过,O代表障碍物不能通过。每次没有车...原创 2018-04-05 23:56:15 · 875 阅读 · 0 评论 -
HDU 6375 度度熊学队列
danshlem Description度度熊正在学习双端队列,他对其翻转和合并产生了很大的兴趣。初始时有 N 个空的双端队列(编号为 1 到 N ),你要支持度度熊的 Q 次操作。①1 u w val 在编号为 u 的队列里加入一个权值为 val 的元素。(w=0 表示加在最前面,w=1 表示加在最后面)。②2 u w 询问编号为 u 的队列里的某个元素并删除它。( w=0 表示询问并...原创 2018-08-11 21:11:06 · 721 阅读 · 0 评论 -
Codeforces 1064D Labyrinth(双向队列,BFS)
You are playing some computer game. One of its levels puts you in a maze consisting of n lines, each of which contains m cells. Each cell either is free or is occupied by an obstacle. The starting cel...原创 2018-10-15 17:23:09 · 614 阅读 · 0 评论