SOLVE

LATER

Signal Range

Problem

Editorial

Analytics

Various signal towers are present in a city.Towers are aligned in a straight horizontal line(from left to right) and each tower transmits a signal in the right to left direction.Tower A shall block the signal of Tower B if Tower A is present to the left of Tower B and Tower A is taller than Tower B. So,the range of a signal of a given tower can be defined as :

{(the number of contiguous towers just to the left of the given tower whose height is less than or equal to the height of the given tower) + 1}.

You need to find the range of each tower.

INPUT

First line contains an integer T specifying the number of test cases.

Second line contains an integer n specifying the number of towers.

Third line contains n space separated integers(H[i]) denoting the height of each tower.

OUTPUT

Print the range of each tower (separated by a space).

Constraints

1 <= T <= 10

2 <= n <= 10^6

1 <= H[i] <= 10^8

Explanation

6th tower has a range 4 because there are 3 contiguous towers(3rd 4th and 5th towers) just to the left of the 6th tower whose height is less than height of 6th tower.

Time Limit:
1.5 sec(s)
for each input file.

Memory Limit:
256 MB

Source Limit:
1024 KB

Marking Scheme:
Marks are awarded when all the testcases pass.

Allowed Languages:
C,
C++,
C++14,
Clojure,
C#,
D,
Erlang,
F#,
Go,
Groovy,
Haskell,
Java,
Java 8,
JavaScript(Rhino),
JavaScript(Node.js),
Julia,
Lisp,
Lisp (SBCL),
Lua,
Objective-C,
OCaml,
Octave,
Pascal,
Perl,
PHP,
Python,
Python 3,
R(RScript),
Racket,
Ruby,
Rust,
Scala,
Swift,
Visual Basic,
Kotlin

Initializing Code Editor...

OTHER PROBLEMS OF THIS CHALLENGE

{"e811a98": "/pagelets/recommended-problems/algorithm/signal-range/", "e811a83": "/pagelets/problems-hint/algorithm/signal-range/", "e811a57": "/pagelets/suggested-problems/algorithm/signal-range/", "e811a6f": "/pagelets/problem-author-tester/algorithm/signal-range/", "e811a33": "/pagelets/show-submission/algorithm/signal-range/"}

{}

realtime.hackerearth.com

80

cd50bbbc7c4f95021b58142ceeb7f42fbb1b8671

58a29e5cae2309f04b28

/realtime/pusher/auth/