Codeforces Global Round 21

Original link: https://www.shuizilong.com/house/archives/codeforces-global-round-21/

blank.jpg

portal

Problem D. Permutation Graph

Given a permutation A, each position of the permutation corresponds to a node in the graph. If the number on the endpoint of an interval is exactly equal to the two sets of maximum values ​​of the interval, then we will connect a no-value between the two endpoint positions. to the side.

Ask the shortest path from position 1 to position n.

The last time I encountered a Cartesian tree question seemed to be the F of #759. . .

This article is reprinted from: https://www.shuizilong.com/house/archives/codeforces-global-round-21/
This site is for inclusion only, and the copyright belongs to the original author.

Leave a Comment