CT40638

Theo's marks Reckoning

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

At the sulphur springs of Brimstone, Theo records each marks in a worn leather ledger. The guild wants answers, not guesses. Task: For each element print the value of the nearest element to its right that is strictly greater, or -1. Input format: First line: n. Second line: n integers. Output format: Print n answers space-separated. Constraints: 1 <= n <= 4000; -10^9 <= a[i] <= 10^9.

Example 1:

Input: 1866 704628574 533588173 -791057744 91520311 -726458043 200933303 402385768 -172379882 -92480547 -906155940 797205749 -991216109 -47812145 678197117 -750913133 -173993690 -636098805 266090684 643591842 -346952977 716446279 281587407 948509337 152850650 -611007095 -558884532 936475467 743815699 676597356 547078889 -183580995 965661097 -408408748 883361632 -850950041 -220667044 362873613 42775998 -547646133 538529608 498823286 738733024 672866879 119409965 -214576815 -683876298 -891532998 14123903 578851372 19373609 -84629846 221414552 362911222 462117949 686162468 -615394826 -573863218 -71330635 -323308324 613126732 373211540 481039786 20645307 -248617557 -440772573 -435344670 -179101986 -108400157 398738172 256242182 608389230 -690569683 561078097 -564622673 943447368 -340554720 231113586 …
Output: 797205749 797205749 91520311 200933303 200933303 402385768 797205749 -92480547 797205749 797205749 948509337 -47812145 678197117 716446279 -173993690 266090684 266090684 643591842 716446279 716446279 948509337 948509337 965661097 936475467 -558884532 936475467 965661097 965661097 965661097 965661097 965661097 996385390 883361632 943447368 -220667044 362873613 538529608 538529608 538529608 738733024 738733024 943447368 686162468 578851372 14123903 14123903 14123903 578851372 686162468 221414552 221414552 362911222 462117949 686162468 943447368 -573863218 -71330635 613126732 613126732 943447368 481039786 608389230 398738172 -179101986 -435344670 -179101986 -108400157 398738172 608389230 608389230 943447368 561078097 943447368 943447368 996385390 231113586 784617476 784617476 784617476 996385…

Example 2:

Input: 368 -71474208 911979855 -125662072 369105310 -156014710 491416638 -95551704 -343099688 649072854 -359748007 755330296 357895574 -987215405 616622281 -634969242 724944694 839083441 -185835364 511227112 -937680109 251337789 -244707757 180976365 -227810138 -152338283 -207332504 544129138 112697011 710046606 -60912619 -752098567 248908448 447780281 46067631 -143550000 839376989 -500760353 -445061211 -222764615 -965518220 839371983 389951411 154502233 303887300 28084627 689605317 -18569528 -25477918 -50850847 718606682 -239368085 396995792 769341156 412559601 185225554 -530950619 -906508203 -292078135 962079425 -631529266 -744921289 -293449570 -11942463 503496807 39484338 992639236 -969442743 685188960 293352980 418231140 -12027096 340494358 500095371 -724661764 555100877 -200653570 -648020064 …
Output: 911979855 962079425 369105310 491416638 491416638 649072854 649072854 649072854 755330296 755330296 839083441 616622281 616622281 724944694 724944694 839083441 839376989 511227112 544129138 251337789 544129138 180976365 544129138 -152338283 544129138 544129138 710046606 710046606 839376989 248908448 248908448 447780281 839376989 839376989 839376989 962079425 -445061211 -222764615 839371983 839371983 962079425 689605317 303887300 689605317 689605317 718606682 718606682 718606682 718606682 769341156 396995792 769341156 962079425 962079425 962079425 -292078135 -292078135 962079425 992639236 -293449570 -293449570 -11942463 503496807 992639236 992639236 -1 685188960 808600945 418231140 500095371 340494358 500095371 555100877 555100877 808600945 110126155 110126155 155941833 155941833 808600945 …

Example 3:

Input: 3101 728676066 -345814737 53733775 819628644 -707515141 -278677758 556775057 504058236 95274232 -855017809 -20848689 252267534 443711008 -262719651 -470676248 -860263968 -202837271 -660173925 -609501041 597790896 -334876685 -677748666 927485895 881695457 -915322925 -619177609 467701428 -468873157 -796136552 -223340732 811698728 426843431 -137058333 -107041961 -7982979 -619911701 -566132336 -733367091 -168000575 369960881 -362525541 -61881088 -58177642 -285856825 -863442614 566336651 -195816599 -326114255 -647222430 -90676894 770296741 -506777755 680404244 -228321880 83875966 -532051535 706028665 388963913 -45772851 -254960179 -239894661 -997429201 251774315 -759783880 -307858039 -889036727 -18383465 724309856 531831964 777716557 -223486403 962277598 -157054790 579286150 160378041 930344552…
Output: 819628644 53733775 819628644 927485895 -278677758 556775057 597790896 597790896 252267534 -20848689 252267534 443711008 597790896 -202837271 -202837271 -202837271 597790896 -609501041 597790896 927485895 927485895 927485895 962277598 962277598 -619177609 467701428 811698728 -223340732 -223340732 811698728 962277598 566336651 -107041961 -7982979 369960881 -566132336 -168000575 -168000575 369960881 566336651 -61881088 -58177642 566336651 566336651 566336651 770296741 -90676894 -90676894 -90676894 770296741 777716557 680404244 706028665 83875966 706028665 706028665 724309856 724309856 251774315 -239894661 251774315 251774315 724309856 -307858039 -18383465 -18383465 724309856 777716557 777716557 962277598 962277598 965872985 579286150 930344552 930344552 956834024 871263283 956834024 496351092…

Constraints:

1 <= n <= 4000; -10^9 <= a[i] <= 10^9.

Loading...
Test Cases:No test cases
No test cases available.
Theo's marks Reckoning - MEDIUM Coding Problem | CodeTikki