DCP-419: Sanvi and Brightest Bulb Back to All Problems

Easy Data Structures > Basic Data Structures


**Sanvi** is a very cute girl.She is walking on the corridor from left to right. There are total **N** bulbs on the corridor which are separated with unit distance between them. Each bulb has certain brightness power in watt (**Wi**). For every bulb at position **i** , **Sanvi** wants to determine the minimum distance she needs to walk on the right side of the corridor so that she could get the brightest bulb in the range from position **i** to **N**. Input: ------ Input starts with an integer **T (1<=T<=20)**, denoting the number of test cases. Each case contains an integer **N (1 ≤ N ≤ 100000)** denoting the number of bulbs. Next line contain N space separated integer numbers **(1<=Wi<=10^9)** denoting brightness power of bulb at respective position. Output: ------- For each case of input, output a single line with **N** space separated integer numbers denoting the minimum walking distance as described in the problem statement. Sample Input ------------ 1 6 6 5 6 1 5 2 Sample Output ------------- 0 1 0 1 0 0


Problem Setter:

Bishal Gautam

Please login to submit solution to this problem.

Problem Limits

Language Time Limit (seconds)
C 1.00
C++ 1.00
C++14 1.00
C# 2.00
Go 2.00
Java 2.00
JavaScript 2.00
Objective-C 2.00
Perl 2.00
PHP 2.00
Python 2.00
Python3 2.00
Ruby 2.00
VB.Net 2.00

Problem Stats

108/282

Solve/Submission

Ranking

# User Language Timing
01 feodorv C 0.11s
02 FariD Cpp14 0.13s
03 Morass Cpp14 0.13s
04 emrul Cpp 0.15s
05 astinaam Cpp14 0.27s
06 Reayz Cpp 0.28s
07 fire_tornado Cpp 0.28s
08 prateepm Cpp14 0.29s
09 Zayed Cpp 0.29s
10 Mr_adnan Cpp 0.29s
11 Mahim007 Cpp14 0.30s
12 by_default Cpp 0.30s
13 saifkhan007420 Cpp 0.31s
14 Dragon_Curve Cpp 0.32s
15 pulak_ict_mbstu Cpp 0.32s
16 _dipu Cpp14 0.32s
17 DynamicOvi Cpp 0.32s
18 Richita Cpp 0.32s
19 Rajan_sust Cpp14 0.32s
20 bu_hridoy Cpp 0.33s
21 mir003 Cpp 0.34s
22 _zErO_ Cpp 0.35s
23 sifat_15 Cpp 0.35s
24 haasib Cpp 0.35s
25 bug_is_everywhere Cpp 0.35s
26 Frdhsn Cpp14 0.35s
27 rohijulislam Cpp 0.35s
28 Chayti_Saha98 Cpp14 0.35s
29 SakibAlamin Cpp 0.35s
30 Tanmoy Cpp14 0.36s
31 nasib_mbstu Cpp14 0.36s
32 Sarwar05 Cpp 0.36s
33 Ramprosad Cpp 0.36s
34 MRITuhin Cpp 0.36s
35 anik_JU Cpp 0.36s
36 shuvo_mbstu Cpp 0.36s
37 saiful130104 Cpp 0.36s
38 prodipdatta7 C 0.36s
39 ssavi Cpp 0.36s
40 rayhan50001 Cpp 0.36s
41 Sakhawat_CoU Cpp 0.36s
42 Jisancse Cpp14 0.37s
43 AlaminJust Cpp 0.37s
44 _GhOstMan_ Cpp 0.37s
45 ksohan Cpp 0.37s
46 astrolion7 Cpp14 0.37s
47 FalseTrueFalse Cpp 0.37s
48 shishir09 Cpp14 0.37s
49 tariqiitju Cpp 0.37s
50 Sagor Cpp 0.38s
Feedback

Your feedback is our precious!



Or call +88 02 9853138 for support