CT53484

Nico and the Granite ledgers

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

The harbor bell rings at the crane marshes of Stillwater; Nico weighs the day's ledgers 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: 348 -321626021 -579708850 -336757101 -600974151 457194161 -105719063 -100104264 794101712 -550123139 220690890 -44445554 -63146783 -453897549 -611831872 -495840193 662348025 486217491 97902152 -20537317 -674353243 89511724 -961949832 533904382 453130675 67551984 60606023 -128621750 -764790684 436882513 -693858600 -770814577 -585069206 -992494551 -524416424 -425008209 -910968739 865615904 567946455 -283726209 837168299 -757565879 484194793 -158981453 808077382 540826614 -744038187 131769363 -708108417 734633936 55598082 73567951 -924782684 300934628 -415309205 928175066 865460196 857227969 -757951323 49135806 -835197872 -255623647 250009113 -49954309 -45004122 -585650367 -884319317 648082865 324249545 397597290 -10799883 -118058856 848867302 277113907 901550738 -297841110 -825138278 2240194…
Output: 457194161 -336757101 457194161 457194161 794101712 -100104264 794101712 865615904 220690890 662348025 662348025 662348025 662348025 -495840193 662348025 865615904 533904382 533904382 89511724 89511724 533904382 533904382 865615904 865615904 436882513 436882513 436882513 436882513 865615904 -585069206 -585069206 -524416424 -524416424 -425008209 865615904 865615904 928175066 837168299 837168299 928175066 484194793 808077382 808077382 928175066 734633936 131769363 734633936 734633936 928175066 73567951 300934628 300934628 928175066 928175066 999594193 901550738 901550738 49135806 250009113 -255623647 250009113 648082865 -45004122 648082865 648082865 648082865 848867302 397597290 848867302 848867302 848867302 901550738 901550738 999594193 224019493 224019493 999594193 -1 546177775 926486296 92…

Example 2:

Input: 2195 -678152118 -928548744 619101454 -366770543 -812841431 621665851 559945244 797760673 -655109303 345000227 272420324 -246656924 -889089679 172072023 -492946540 -927339834 -927087977 325129896 206686205 -208554788 682510899 20792878 187414218 329188524 -974606988 -863172138 802639794 -494547863 761528247 999192495 -729837056 -113516690 674264210 992736794 58658085 -286209940 509468513 417981049 54599745 -879660381 113599439 812716041 -36584515 257969569 520252216 -156461194 -137715096 727023051 -10107723 -557634110 -387800565 406769735 881773504 445956815 311717983 546962884 -305673140 203985664 -207214378 347264230 -59533771 -814708905 -817911758 -655600957 212990497 -249167564 267692638 -247830447 -972987082 185906045 203034080 493507054 -482684893 -897894126 628090256 -264523945 -9375…
Output: 619101454 619101454 621665851 621665851 621665851 797760673 797760673 802639794 345000227 682510899 325129896 172072023 172072023 325129896 325129896 -927087977 325129896 682510899 682510899 682510899 802639794 187414218 329188524 802639794 -863172138 802639794 999192495 761528247 999192495 999558771 -113516690 674264210 992736794 997160311 509468513 509468513 812716041 812716041 113599439 113599439 812716041 881773504 257969569 520252216 727023051 -137715096 727023051 881773504 406769735 -387800565 406769735 881773504 951776701 546962884 546962884 628090256 203985664 347264230 347264230 493507054 212990497 -655600957 -655600957 212990497 267692638 267692638 493507054 185906045 185906045 203034080 493507054 628090256 628090256 628090256 866434102 524748211 524748211 580679918 467481386 580…

Example 3:

Input: 2236 -552353718 664047116 -533722227 651346472 608859070 940612212 -833635442 852666932 23312090 -319549773 267396105 870215254 353485262 445722731 -762130751 -23005119 -137728301 85961532 843081469 -598162680 -19087828 -829239021 552425383 -964532767 -264914682 -439761541 -322525622 897197575 -944474943 98306682 338395494 -645117401 -477395962 743900180 -134982247 385456863 299551264 -267131686 -615158847 -585852390 391547931 936097851 -324964824 154482657 -762226222 497675288 -539150243 482426172 -615073811 805383545 -450071284 -362205782 -302324884 858506460 183617966 879578709 994627122 248404292 33752622 -533104171 -232469018 -695891006 -94366814 701721536 248721851 -839139848 -39944437 181661292 -54089142 -151589578 668979899 -476324306 596151951 683939595 -528078931 -406560483 -2424…
Output: 664047116 940612212 651346472 940612212 940612212 994627122 852666932 870215254 267396105 267396105 870215254 897197575 445722731 843081469 -23005119 85961532 85961532 843081469 897197575 -19087828 552425383 552425383 897197575 -264914682 897197575 -322525622 897197575 936097851 98306682 338395494 743900180 -477395962 743900180 936097851 385456863 391547931 391547931 391547931 -585852390 391547931 936097851 994627122 154482657 497675288 497675288 805383545 482426172 805383545 805383545 858506460 -362205782 -302324884 858506460 879578709 879578709 994627122 996012416 701721536 701721536 -232469018 -94366814 -94366814 701721536 844768973 668979899 -39944437 181661292 668979899 668979899 668979899 683939595 596151951 683939595 844768973 -406560483 -242447223 306700504 306700504 306700504 8447…

Constraints:

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

Loading...
Test Cases:No test cases
No test cases available.
Nico and the Granite ledgers - MEDIUM Coding Problem | CodeTikki