随笔分类 -  单调栈/单调队列

摘要:[Codeforces Round #669 (Div. 2)] D. Discrete Centrifugal Jumps (单调栈,DP) 题面: 题意: 给定一个含有$\mathit n$个整数的数组$\mathit h$,对于每一个$i\in[1,n]\(,可以跳到\)\mathit j,i 阅读全文
posted @ 2020-09-09 20:15 茄子Min 阅读(199) 评论(0) 推荐(0)
摘要:牛客小白月赛27 I -名作之壁 (单调队列,双指针) 题面: 思路: 我们很容易知道,当确定一个区间的左端点$\mathit l$ 后,区间最小值和最大值是关于区间右端点$\mathit r $ 的一个单峰函数。 那么对于一个左端点$\mathit l$,我们只需要找到一个最小的$\mathit 阅读全文
posted @ 2020-08-24 17:27 茄子Min 阅读(260) 评论(0) 推荐(0)
摘要:P3400 仓鼠窝 题目描述 萌萌哒的Created equal是一只小仓鼠,小仓鼠自然有仓鼠窝啦。 仓鼠窝是一个由nm个格子组成的行数为n、列数为m的矩阵。小仓鼠现在想要知道,这个矩阵中有多少个子矩阵!(实际上就是有多少个子长方形嘛。)比如说有一个23的矩阵,那么11的子矩阵有6个,12的子矩阵有 阅读全文
posted @ 2020-06-19 18:09 茄子Min 阅读(250) 评论(0) 推荐(0)
摘要:[Codeforces Round 622 (Div. 2)] C2. Skyscrapers (hard version) (单调栈) C2. Skyscrapers (hard version) time limit per test 3 seconds memory limit per tes 阅读全文
posted @ 2020-02-24 18:03 茄子Min 阅读(334) 评论(0) 推荐(0)
摘要:Psychos in a Line "CodeForces 319B " There are n psychos standing in a line. Each psycho is assigned a unique integer from 1 to n . At each step every 阅读全文
posted @ 2019-09-03 14:34 茄子Min 阅读(300) 评论(0) 推荐(0)
摘要:Mike is the president of country What The Fatherland. There are n bears living in this country besides Mike. All of them are standing in a line and th 阅读全文
posted @ 2019-09-02 22:16 茄子Min 阅读(274) 评论(0) 推荐(0)
摘要:Bike loves looking for the second maximum element in the sequence. The second maximum element in the sequence of distinct numbers x1, x2, ..., xk (k 1 阅读全文
posted @ 2019-08-30 14:22 茄子Min 阅读(319) 评论(0) 推荐(0)
摘要:C. Report time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard output Each month Blake gets the report c 阅读全文
posted @ 2019-08-11 19:53 茄子Min 阅读(204) 评论(0) 推荐(0)
摘要:链接:https://ac.nowcoder.com/acm/contest/984/A 来源:牛客网 题目描述 Some of Farmer John's N cows (1 ≤ N ≤ 80,000) are having a bad hair day! Since each cow is se 阅读全文
posted @ 2019-07-11 12:40 茄子Min 阅读(177) 评论(0) 推荐(0)
摘要:VIPKID 是在线少儿英语教育平台,网络稳定是在线教育课程质量的红线,VIPKID 为此推出了全球最稳定的教育网络系统 —— “星云系统”。星云系统目前建立了覆盖全球 3535 个国家的 55 条核心跨海专线,在 1616 个国家的 5555 个城市建立了中心传输节点,具备一分钟内自由切换路由的能 阅读全文
posted @ 2019-06-17 12:53 茄子Min 阅读(386) 评论(0) 推荐(0)
摘要:Let's suppose you have an array a, a stack s (initially empty) and an array b (also initially empty). You may perform the following operations until b 阅读全文
posted @ 2019-04-12 20:18 茄子Min 阅读(328) 评论(0) 推荐(0)
摘要:You are given an array a consisting of n elements. The imbalance value of some subsegment of this array is the difference between the maximum and mini 阅读全文
posted @ 2019-01-28 22:15 茄子Min 阅读(518) 评论(0) 推荐(0)
摘要:Some of Farmer John's N cows (1 ≤ N ≤ 80,000) are having a bad hair day! Since each cow is self-conscious about her messy hairstyle, FJ wants to count 阅读全文
posted @ 2019-01-28 20:49 茄子Min 阅读(312) 评论(0) 推荐(0)
摘要:Bill is developing a new mathematical theory for human emotions. His recent investigations are dedicated to studying how good or bad days influent peo 阅读全文
posted @ 2019-01-28 16:09 茄子Min 阅读(385) 评论(0) 推荐(0)
摘要:A histogram is a polygon composed of a sequence of rectangles aligned at a common base line. The rectangles have equal widths but may have different h 阅读全文
posted @ 2019-01-28 11:35 茄子Min 阅读(279) 评论(0) 推荐(0)