CT39205

The Bloomhaven Taller Ahead

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

The harbor bell rings at the tulip beds of Bloomhaven; Admiral weighs the day's signals manifests and starts the calculations. 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: 3034 -526744868 807727052 210382671 735045517 766979613 755719920 -295937100 -268266685 269302070 -454356576 910687777 222520097 -308793713 273722950 580417607 -414355780 -687998414 651328251 -761582682 463574095 -195404822 -584110631 -800649909 42967932 -831195599 -240690785 952744725 978818849 16520393 -672688411 860404122 197890357 -20910515 558598260 942229933 664581239 -209898919 -888568510 403450386 -562319911 825764249 -439504779 -476402362 613587894 -428814732 -807132611 245185874 845773095 -858077323 -637359109 -70376289 -12335936 -979129658 -390828621 247872395 232329350 -952292967 -605635488 164583481 -839748332 479297559 -605692070 -587986453 622033879 489659057 -610889777 -364128360 799582832 61003782 -127513161 901749231 -653749266 937592768 142592856 330475050 -393052278 -92…
Output: 807727052 910687777 735045517 766979613 910687777 910687777 -268266685 269302070 910687777 910687777 952744725 273722950 273722950 580417607 651328251 651328251 651328251 952744725 463574095 952744725 42967932 42967932 42967932 952744725 -240690785 952744725 978818849 981691766 860404122 860404122 942229933 558598260 558598260 942229933 981691766 825764249 403450386 403450386 825764249 825764249 845773095 613587894 613587894 845773095 245185874 245185874 845773095 901749231 -637359109 -70376289 -12335936 247872395 -390828621 247872395 479297559 479297559 -605635488 164583481 479297559 479297559 622033879 -587986453 622033879 799582832 799582832 -364128360 799582832 901749231 901749231 901749231 937592768 937592768 981691766 330475050 713658918 -86565960 -587616208 -86565960 -80885968 26902…

Example 2:

Input: 1324 -106524109 447637669 -807078420 144624195 298412669 404475214 697838049 662585259 249854757 -536090600 -416410124 -370041769 529499502 890156816 385997441 -470688258 -736612447 340163758 588342159 -75609628 -750337455 -738104500 -899375188 88588613 -460484787 -45147575 -45486110 817674222 905625923 865744141 -378507260 261631176 985760102 980122574 183724479 66405970 -735834870 -708291657 896533986 -7717860 -685240608 -401364272 -520159345 328984548 -278716636 -355991494 -301945803 89192737 100632622 -548273037 414236229 -755057598 -441773889 209908198 115936 407843958 -370434569 375488118 175673902 552793073 -320422372 -895033966 -464902392 -768712342 367528652 474751784 -920257779 -433083267 477481567 517619696 846501591 -329767638 -65792785 -313604987 -863034919 -829173599 16370512…
Output: 447637669 697838049 144624195 298412669 404475214 697838049 890156816 890156816 529499502 -416410124 -370041769 529499502 890156816 905625923 588342159 340163758 340163758 588342159 817674222 88588613 -738104500 88588613 88588613 817674222 -45147575 817674222 817674222 905625923 985760102 985760102 261631176 985760102 994345500 994345500 896533986 896533986 -708291657 896533986 994345500 328984548 -401364272 328984548 328984548 414236229 89192737 -301945803 89192737 100632622 414236229 414236229 552793073 -441773889 209908198 407843958 407843958 552793073 375488118 552793073 552793073 846501591 367528652 -464902392 367528652 367528652 474751784 477481567 -433083267 477481567 517619696 846501591 994345500 -65792785 163705128 163705128 -829173599 163705128 577718557 994345500 239763547 99434…

Example 3:

Input: 3581 -346625950 266056238 780174875 -729859825 -565099723 866371350 906109864 144702343 401313940 475350097 -835150421 -915143422 368829284 146534602 -13369082 510233103 607342287 -567743630 -594518737 260739707 -293531217 -566216936 -996527103 -41287342 513133589 653898967 -120748802 362184468 110952621 -713839006 -142968498 519314429 -755039785 644253977 805974688 536227958 -112709448 -291105571 772376463 128881925 -367822345 119199600 837749419 -555888906 -502267029 -172019971 716383314 604243225 275712343 -950062731 -516131791 880814111 -826937922 652259243 -615968193 -443746163 -682916601 -506184748 530114280 -966453377 -560603614 637673516 379155887 -515717552 -166804417 -349352204 -930502275 113620527 220288236 903455014 694601850 181459565 -568351075 -852277700 -678011212 289622195…
Output: 266056238 780174875 866371350 -565099723 866371350 906109864 920280836 401313940 475350097 510233103 368829284 368829284 510233103 510233103 510233103 607342287 653898967 260739707 260739707 513133589 -41287342 -41287342 -41287342 513133589 653898967 805974688 362184468 519314429 519314429 -142968498 519314429 644253977 644253977 805974688 837749419 772376463 772376463 772376463 837749419 837749419 119199600 837749419 880814111 -502267029 -172019971 716383314 880814111 880814111 880814111 -516131791 880814111 903455014 652259243 903455014 -443746163 530114280 -506184748 530114280 637673516 -560603614 637673516 903455014 903455014 -166804417 113620527 113620527 113620527 220288236 903455014 920280836 805303452 289622195 289622195 -678011212 289622195 805303452 805303452 -438117742 -22157952…

Constraints:

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

Loading...
Test Cases:No test cases
No test cases available.
The Bloomhaven Taller Ahead - MEDIUM Coding Problem | CodeTikki