CT53403

The Taller Ahead of the Rustic beacons

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

The harbor bell rings at the ember mines of Cindercrag; Viktor weighs the day's beacons 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: 823 233824898 -941581104 708122011 -81711946 563089152 -944607628 216485501 -469425816 204852275 30546847 -769878145 244657211 -396514510 429403099 467248227 -930449563 -660802799 -383749311 -596202768 370082627 643329655 66759501 718348933 16364001 560985290 126283872 -633439059 -205080094 615128287 143551319 356331492 283657560 226992163 -278210217 143654259 -966629745 890240326 461400023 -748583543 -236296550 762152057 255827191 -427803488 -332077170 876530103 213992192 653247879 -4839551 -341438979 536142975 -429048344 -227863342 97055276 117890540 -980550607 101334622 -814664744 -775132593 -982857452 926140020 369803707 -344847012 -446680421 588883166 -166773820 667228419 -201249627 -915343857 -586086436 -611668737 -351509404 186301939 -576525380 380452503 -968248756 -877188432 -72475…
Output: 708122011 708122011 718348933 563089152 643329655 216485501 244657211 204852275 244657211 244657211 244657211 429403099 429403099 467248227 643329655 -660802799 -383749311 370082627 370082627 643329655 718348933 718348933 890240326 560985290 615128287 615128287 -205080094 615128287 890240326 356331492 890240326 890240326 890240326 143654259 890240326 890240326 926140020 762152057 -236296550 762152057 876530103 876530103 -332077170 876530103 926140020 653247879 926140020 536142975 536142975 926140020 -227863342 97055276 117890540 926140020 101334622 926140020 -775132593 926140020 926140020 999775725 588883166 588883166 588883166 667228419 667228419 999775725 186301939 -586086436 -351509404 -351509404 186301939 380452503 380452503 416790750 -877188432 -724756302 416790750 558758761 558758761…

Example 2:

Input: 230 -468713947 344564564 156913233 -595450399 -110911423 217719400 307152350 -550042933 439034717 701814058 -417773659 -701577428 -854185342 554291567 105765752 -770079863 -227832 -46413290 806475250 -159912868 368771416 -206868761 7844682 -308490167 -501975322 -759568817 -947536788 -212204859 -198706308 -206189890 -479551970 281271219 -384555837 580032458 -496181475 -352362388 -742994022 -825427420 461512811 -444107287 -103383674 -274759899 -229725753 214840341 868757268 854441436 -253440345 576216695 -34743186 450547244 -197168120 -481117316 611166634 620707485 -797910397 -212063879 682848263 887016452 526948700 18295621 -141421226 607591208 273597181 620432805 407513738 -805378354 401708556 791160072 -321649210 837951352 640277480 514211317 482131352 868986468 -809481492 794751026 90063…
Output: 344564564 439034717 217719400 -110911423 217719400 307152350 439034717 439034717 701814058 806475250 554291567 554291567 554291567 806475250 806475250 -227832 806475250 806475250 868757268 368771416 580032458 7844682 281271219 -212204859 -212204859 -212204859 -212204859 -198706308 281271219 281271219 281271219 580032458 580032458 868757268 -352362388 461512811 461512811 461512811 868757268 -103383674 214840341 -229725753 214840341 868757268 887016452 887016452 576216695 611166634 450547244 611166634 611166634 611166634 620707485 682848263 -212063879 682848263 887016452 900633748 607591208 607591208 607591208 620432805 620432805 791160072 791160072 401708556 791160072 837951352 837951352 868986468 868986468 868986468 868986468 900633748 794751026 900633748 996542757 831561267 831561267 8613…

Example 3:

Input: 3294 305890416 -74239784 -976943172 452803063 491394701 556576191 155164933 -108354429 -292629185 765793697 -159891199 30858963 311565055 222515328 657539080 -417304077 -354526423 456734169 -299892873 -65575310 -925709945 814221644 695327699 -657575535 -829739524 -544436346 -727544034 544715250 -603509940 -870717041 171198650 366604749 -801954915 -705525842 141376046 44229320 198010804 940367325 203525093 -67592016 158036039 634010096 634273785 -832634731 -292984607 -198564298 -937929480 -876102807 -708014491 -59646808 776919035 -394977572 750595526 -774037238 34379851 665442796 237944337 -825396324 861726700 549364851 -201488573 -99662146 -814187901 835427690 -31407506 837213908 -974658147 287789865 461769947 941976255 -412133058 -890599003 928045653 -50293778 266307403 -989529649 -999311…
Output: 452803063 452803063 452803063 491394701 556576191 765793697 765793697 765793697 765793697 814221644 30858963 311565055 657539080 657539080 814221644 -354526423 456734169 814221644 -65575310 814221644 814221644 940367325 940367325 -544436346 -544436346 544715250 544715250 940367325 171198650 171198650 366604749 940367325 -705525842 141376046 198010804 198010804 940367325 941976255 634010096 158036039 634010096 634273785 776919035 -292984607 -198564298 -59646808 -876102807 -708014491 -59646808 776919035 861726700 750595526 861726700 34379851 665442796 861726700 861726700 861726700 941976255 835427690 -99662146 835427690 835427690 837213908 837213908 941976255 287789865 461769947 941976255 961858867 928045653 928045653 930131618 266307403 915398921 -901164786 -901164786 915398921 915398921 93…

Constraints:

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

Loading...
Test Cases:No test cases
No test cases available.