CT45897

Curator Counts the marks

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

Deep in the crystal caves of Luminar, Curator studies rows of marks entries. One clean number will settle the guild's oldest argument. 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: 2650 -490737503 -20713797 336263900 865961639 -788775165 181100134 -272331799 162606589 966802750 978042467 -656072192 -242475283 -847620241 -460380799 394744560 -895901918 -351434946 873535136 -829973067 955011134 -850395947 -944756367 -393714679 -965044739 921037097 -778762234 -664543460 279425873 -89918547 -781123053 -85252175 -793922572 -508957971 -332406122 495869319 -610935862 837997240 -162083150 -929390359 -479059662 -334325943 541294660 -190263639 -860790320 -218028733 -277294078 -979308828 537107257 -731150697 -342133224 63538718 -655486241 394300838 -175805286 -860861299 390500094 966166317 -266216018 254886663 412742942 -536111471 -91876436 558465833 -32295403 17299818 250199799 765196633 -463902044 74507118 -971956574 -632397583 -550842844 -266447778 68001161 -886317647 744938…
Output: -20713797 336263900 865961639 966802750 181100134 966802750 162606589 966802750 978042467 983394447 -242475283 394744560 -460380799 394744560 873535136 -351434946 873535136 955011134 955011134 966166317 -393714679 -393714679 921037097 921037097 966166317 -664543460 279425873 495869319 -85252175 -85252175 495869319 -508957971 -332406122 495869319 837997240 837997240 966166317 541294660 -479059662 -334325943 541294660 966166317 537107257 -218028733 537107257 537107257 537107257 966166317 -342133224 63538718 394300838 394300838 966166317 390500094 390500094 966166317 983394447 254886663 412742942 558465833 -91876436 558465833 765196633 17299818 250199799 765196633 951182456 74507118 744938982 -632397583 -550842844 -266447778 68001161 744938982 744938982 951182456 951182456 951182456 -15158738…

Example 2:

Input: 2314 -168704656 -243309364 57011836 -179195835 350517459 890781730 -901774939 110144307 -209972382 247991075 -540633000 -10430011 832465509 -177377415 189055617 -760844403 163913966 -85904490 567251559 -263392067 726966527 -294431975 238871244 -168917028 100452846 -330567408 185789169 972193534 158791124 -815108895 894498333 -841415416 -42028575 -958776210 501000943 163994720 -73708992 -833842113 -21533821 732196571 -200632742 624249874 50174672 -558730937 -644877218 -644175247 -187810407 958175985 -693132409 -250579758 -464440505 -41913891 881496680 816053698 -956430642 167499552 -936278543 730861439 941343630 748154555 27536012 -172034937 676550763 -372254657 883817417 -432276540 799004700 809588163 325052247 807915771 -959778783 552762387 553988152 -422460343 10825072 -80444111 -9616699…
Output: 57011836 57011836 350517459 350517459 890781730 972193534 110144307 247991075 247991075 832465509 -10430011 832465509 972193534 189055617 567251559 163913966 567251559 567251559 726966527 726966527 972193534 238871244 972193534 100452846 185789169 185789169 972193534 987354481 894498333 894498333 958175985 -42028575 501000943 501000943 732196571 732196571 -21533821 -21533821 732196571 958175985 624249874 958175985 958175985 -187810407 -644175247 -187810407 958175985 987354481 -250579758 -41913891 -41913891 881496680 941343630 941343630 167499552 730861439 730861439 941343630 957458386 883817417 676550763 676550763 883817417 883817417 923149060 799004700 809588163 835222677 807915771 835222677 552762387 553988152 620324817 10825072 620324817 620324817 620324817 835222677 185862941 498154139…

Example 3:

Input: 99 -468388657 365861046 807058674 -829686040 69395539 795264410 -214328994 -634019292 581275511 260195402 764385889 141900770 -377713281 -709702686 -351582543 61751888 474350362 230901806 -758364754 -7065047 356782692 -864659178 -187547995 595073522 410537668 -532478437 287157006 283638434 123707412 -821452335 -213656978 -413392087 -216300462 -212736576 966014695 -358405843 14818050 866151101 87668437 -935664142 277324631 615152525 544298802 -101261513 767773153 76707762 -527170888 -841322207 -176307087 532801494 722617243 -374030133 -701473588 -685452516 -615595591 -906772183 -82461189 609952132 739045820 676728717 627565750 799761185 169805278 -213093656 -6644891 597649026 -776202268 55217371 981629646 221400527 737769824 217606935 181209348 132508234 -551814657 533911061 -499581167 -691…
Output: 365861046 807058674 966014695 69395539 795264410 966014695 581275511 581275511 764385889 764385889 966014695 474350362 -351582543 -351582543 61751888 474350362 595073522 356782692 -7065047 356782692 595073522 -187547995 595073522 966014695 966014695 287157006 966014695 966014695 966014695 -213656978 -212736576 -216300462 -212736576 966014695 981629646 14818050 866151101 981629646 277324631 277324631 615152525 767773153 767773153 767773153 799761185 532801494 -176307087 -176307087 532801494 722617243 739045820 -82461189 -685452516 -615595591 -82461189 -82461189 609952132 739045820 799761185 799761185 799761185 981629646 597649026 -6644891 597649026 981629646 55217371 981629646 -1 737769824 903714861 533911061 533911061 533911061 533911061 661040845 661040845 661040845 903714861 348049868 63…

Constraints:

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

Loading...
Test Cases:No test cases
No test cases available.
Curator Counts the marks - MEDIUM Coding Problem | CodeTikki