单调栈+单调队列
creator平
期望破茧成蝶时的飞翔,向往突破蝉蛹后的鸣叫。
展开
-
HDU - 3706——Second My Problem First (单调队列)
Give you three integers n, A and B. Then we define S i = A i mod B and T i = Min{ S k | i-A <= k <= i, k >= 1} Your task is to calculate the product of T i (1 <= i <= n) mod B. ...原创 2018-05-18 10:03:12 · 275 阅读 · 0 评论 -
HDU - 4122——Alice's mooncake shop (单调队列之制作月饼)
The Mid-Autumn Festival, also known as the Moon Festival or Zhongqiu Festival is a popular harvest festival celebrated by Chinese people, dating back over 3,000 years to moon worship in China's Shang ...原创 2018-05-21 17:46:08 · 484 阅读 · 0 评论 -
POJ - 2559——Largest Rectangle in a Histogram (单调队列之火车厢)
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 heights. For example, the figure on the left shows ...原创 2018-05-22 09:13:35 · 105 阅读 · 0 评论 -
CodeForces - 91B——Queue (单调队列之海象比年龄)
There are n walruses standing in a queue in an airport. They are numbered starting from the queue's tail: the 1-st walrus stands at the end of the queue and the n-th walrus stands at the beginning of ...原创 2018-05-22 12:35:49 · 1192 阅读 · 0 评论 -
ZOJ - 1610 - Count the Colors
Painting some colored segments on a line, some previously painted segments may be covered by some the subsequent ones. Your task is counting the segments of different colors you can see at las...原创 2018-07-14 09:48:37 · 130 阅读 · 0 评论 -
HDU - 2795 - Billboard
At the entrance to the university, there is a huge rectangular billboard of size h*w (h is its height and w is its width). The board is the place where all possible announcements are posted: nearest p...原创 2018-07-14 11:03:14 · 163 阅读 · 0 评论