CT47904

The registers at Padmore

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

Before the gates of the lily shoals of Padmore close for winter, Bhavi must finish the registers ledger - one figure at a time. 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: 3855 374294899 457493162 -612585588 486310027 -20237141 -495186692 -431144991 49179529 345664643 903618842 574135150 -724266042 73920854 878175527 900907191 494853681 974844162 771736705 484936071 317867284 41301443 -337216126 720249293 906974211 -573850005 811761238 484326340 -308210953 -745078368 587316018 253463555 438436284 -539467766 -46255599 636867760 -965764883 -284635929 -67561517 -628983750 -492418492 483083386 198639718 -101622198 -899050365 -997443124 304073074 -704489277 58934334 -40189156 -758390584 -625286159 -158127853 -150025874 -252414419 -141784014 -942369729 372532700 -704940927 74643509 442037173 712469668 473449958 648806595 935950817 -754837079 -959117101 -569301665 -319898747 478863880 108216645 -70723997 840836459 -758047040 -743162036 734900856 -617331003 -1932907…
Output: 457493162 486310027 486310027 903618842 49179529 -431144991 49179529 345664643 903618842 974844162 878175527 73920854 878175527 900907191 974844162 974844162 980226292 906974211 720249293 720249293 720249293 720249293 906974211 935950817 811761238 935950817 587316018 587316018 587316018 636867760 438436284 636867760 -46255599 636867760 712469668 -284635929 -67561517 483083386 -492418492 483083386 712469668 304073074 304073074 304073074 304073074 372532700 58934334 372532700 372532700 -625286159 -158127853 -150025874 -141784014 -141784014 372532700 372532700 442037173 74643509 442037173 712469668 935950817 648806595 935950817 980226292 -569301665 -569301665 -319898747 478863880 840836459 840836459 840836459 980226292 -743162036 734900856 743913029 -193290795 416167096 -760316625 416167096 7…

Example 2:

Input: 2026 -815402189 800995679 503395734 -238054416 984884532 661104811 -496041526 -138394979 -424309825 -404327983 774887721 -941491486 535302052 -991743589 512209587 -95663158 18661887 542993395 -701532296 306027328 430054103 231032999 899246843 876050342 -341367015 -381542580 -168719944 -552118255 -712578279 88167503 242762556 721278576 -13803228 -803188971 115791027 -289735586 -660709400 315905498 834381120 258081624 355587343 473888934 -411560778 -753150122 -12198611 -664943367 58215887 -95158410 -72915176 736581550 -850120199 555134514 -955074424 65318990 -205378737 360551026 -545811968 819675060 -271773379 970580689 689796105 -742158945 887053110 927836569 235613268 -86706017 -522830452 452037571 621898267 -100852569 182710620 368551152 523656483 -472137200 -705763102 744534956 62511339 …
Output: 800995679 984884532 984884532 984884532 993691979 774887721 -138394979 774887721 -404327983 774887721 899246843 535302052 542993395 512209587 542993395 18661887 542993395 899246843 306027328 430054103 899246843 899246843 970580689 970580689 -168719944 -168719944 88167503 88167503 88167503 242762556 721278576 834381120 115791027 115791027 315905498 315905498 315905498 834381120 970580689 355587343 473888934 736581550 -12198611 -12198611 58215887 58215887 736581550 -72915176 736581550 819675060 555134514 819675060 65318990 360551026 360551026 819675060 819675060 970580689 970580689 993691979 887053110 887053110 927836569 959643510 452037571 452037571 452037571 621898267 744534956 182710620 368551152 523656483 744534956 744534956 744534956 959643510 959643510 993691979 901856833 993691979 704…

Example 3:

Input: 1745 226929932 379152125 -342667878 -215991314 -290119424 402167307 -57540318 132759572 -651050370 369551809 18966810 -167253980 -482293566 -2380991 101284943 381933653 -270550918 -343705110 687095837 531960731 -866551830 -351991654 -839899403 -558639577 -959126012 -54130339 -346922584 -363005280 398788635 -770856148 -828004375 -810462175 816620520 141594387 917845729 -768586271 547367111 815144899 -309665484 -314957922 -589054710 116938929 152074216 249506412 -173049377 917725242 847642577 -191162634 -8690099 417035188 713260369 692463385 728725716 436211676 48895665 -100859656 670202117 19426122 -513498618 505783714 586448625 277707652 -384683779 -239322241 -211481556 -323203948 -240185460 -75083086 466553618 623667764 -390475255 -585385501 -254900308 -158516280 10607765 -349228682 51356…
Output: 379152125 402167307 -215991314 402167307 402167307 687095837 132759572 369551809 369551809 381933653 101284943 -2380991 -2380991 101284943 381933653 687095837 687095837 687095837 816620520 816620520 -351991654 -54130339 -558639577 -54130339 -54130339 398788635 398788635 398788635 816620520 816620520 -810462175 816620520 917845729 917845729 938905398 547367111 815144899 917725242 116938929 116938929 116938929 152074216 249506412 917725242 917725242 938905398 938905398 -8690099 417035188 713260369 728725716 728725716 938905398 670202117 670202117 670202117 938905398 505783714 505783714 586448625 623667764 466553618 -239322241 -211481556 -75083086 -240185460 -75083086 466553618 623667764 938905398 -254900308 -254900308 -158516280 10607765 513567193 513567193 938905398 977955213 977955213 8348…

Constraints:

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

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