#P5788. 【模板】单调栈
【模板】单调栈
Background
This is a template problem, with no background.
Testdata was updated on 2019.12.12. The time limit was relaxed, and it no longer relies on constant-factor optimizations.
Problem Description
Given an integer sequence with terms.
Define a function as the index of the first element after the -th element in the sequence that is greater than , that is, . If it does not exist, then .
Find .
Input Format
The first line contains a positive integer .
The second line contains positive integers .
Output Format
Output one line with integers representing the values of .
5
1 4 2 3 5
2 5 4 5 0
Hint
Constraints
For of the testdata, .
For of the testdata, .
For of the testdata, , .
Translated by ChatGPT 5
相关
在以下作业中: