• [1175] Dress, Left Dress!

  • 时间限制: 3000 ms 内存限制: 65535 K
  • 问题描述
  • Maybe you think this problem is about girls and ladies.
    But you're wrong. 'Left dress' means 'Eyes left'. It's used in armed forces. It will make a square more orderly.
    Now several soldiers stand in a line. They are in diffient height or the same. When each of them eyes left, the first man he will see is the nearest man higher than him.
    For each soldier, you should tell me the height of the first man he will see when his eyes left.
  • 输入
  • This problem has several cases.
    The first line of each case is an integer N (1 < N <= 1 000 000).
    Then follows a line with N integers. Indicates the height of each man. (1 <= height <= 1 000 000).
  • 输出
  • For each case, you should output everyone's first man's position. If one has no first man, then output -1.
  • 样例输入
  • 5
    1 3 2 5 8
    4
    5 4 3 2
    
  • 样例输出
  • -1 -1 1 -1 -1
    -1 0 1 2
    
  • 提示
  • 来源
  • XadillaX
  • 操作

显示春菜