CT42147

Lothar Counts the ledgers

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

It is audit day at the floating docks of Skyharbor. Lothar spreads the ledgers records across the table and picks up a sharp pencil. 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: 234 -274163981 -829307048 93876404 328751125 591490350 375444093 490164954 607358142 -65918988 544199727 -867472088 -51520048 -129740174 746352086 466588874 -167233551 986108102 358891330 -685000966 -139823318 922303191 -482072734 797027720 939665201 68810412 -881525263 20194371 -955365794 -853479776 -881457312 124177231 297378903 432888848 -822449067 18337897 533856385 -847302796 607195197 -887554782 -274030381 257737078 -784566482 204427326 -208799023 249100177 -13294521 -556402401 627524495 985101691 520123165 -723994333 786008336 -323923261 -372233954 -218217735 49316535 594245105 400959633 -918226429 104936418 -213979676 756905267 387990379 -192038430 -859504943 825519180 788787350 478850106 835341639 62185101 -764445842 403279994 192022804 377629071 766921362 -56051827 -757696120 -94…
Output: 93876404 93876404 328751125 591490350 607358142 490164954 607358142 746352086 544199727 746352086 -51520048 746352086 746352086 986108102 986108102 986108102 986481670 922303191 -139823318 922303191 939665201 797027720 939665201 985101691 124177231 20194371 124177231 -853479776 124177231 124177231 297378903 432888848 533856385 18337897 533856385 607195197 607195197 627524495 -274030381 257737078 627524495 204427326 249100177 249100177 627524495 627524495 627524495 985101691 986481670 786008336 786008336 825519180 -218217735 -218217735 49316535 594245105 756905267 756905267 104936418 756905267 756905267 825519180 825519180 825519180 825519180 835341639 835341639 835341639 912702832 403279994 403279994 766921362 377629071 766921362 912702832 912702832 912702832 912702832 925032113 887175761 …

Example 2:

Input: 384 -500812647 -435376791 -439355800 -392811898 -684435308 38558516 -168330300 -901625945 788146306 35088495 576114196 -435960800 745108672 838495006 -879402507 -357799449 540395647 167118578 -243558806 -254280310 -534986626 -595251645 -218564468 912843072 232386397 -687136252 -309858565 -373649872 -392296988 -181019322 202967980 -87373682 975040292 407773828 538512418 -983962862 789826436 613606797 -172999655 -574801843 411359308 -42991638 -917309465 984185900 -296423236 -350730294 49389580 -328487796 -652501593 952819137 599994510 786128896 -968104364 -609115605 622876247 547734258 -411543412 124302471 571972461 649283760 -528461882 641225219 31048579 6674788 845426239 -640188134 -164882571 488041898 -816705023 -344908944 -928797632 -266923213 571617710 -717009043 171181082 920361898 -61…
Output: -435376791 -392811898 -392811898 38558516 38558516 788146306 788146306 788146306 838495006 576114196 745108672 745108672 838495006 912843072 -357799449 540395647 912843072 912843072 -218564468 -218564468 -218564468 -218564468 912843072 975040292 975040292 -309858565 -181019322 -181019322 -181019322 202967980 975040292 975040292 984185900 538512418 789826436 789826436 984185900 984185900 411359308 411359308 984185900 984185900 984185900 996205271 49389580 49389580 952819137 952819137 952819137 975564548 786128896 845426239 -609115605 622876247 649283760 571972461 124302471 571972461 649283760 845426239 641225219 845426239 845426239 845426239 920361898 -164882571 488041898 571617710 -344908944 -266923213 -266923213 571617710 920361898 171181082 920361898 975564548 155254877 302140526 8165966…

Example 3:

Input: 1312 709043633 -59376973 -865556323 -23692476 -459039699 -821631546 717353761 -10494707 -207222452 545201735 -290537058 -614678909 -153853956 854766482 906767769 144807665 273151899 449663556 -501855500 648378522 115619368 -173651127 293503358 -830356042 -710994010 964025249 -746083911 488122188 -447341023 -398481950 117235289 -562840426 266113976 -676656741 903182747 460924239 -182829753 -830684335 594616102 -852813266 -765704665 -168304243 -336311267 497807058 -907714425 -21204564 130637622 786995528 -309418052 -101424661 228907029 32032963 -207270575 764109784 -310269621 349271228 -224247605 -766632303 850194268 478548732 390528834 -539009275 -892384056 -366931579 -646601691 651729089 -886878693 490598919 767520096 739943565 -109721601 857867272 -787759760 950999823 -370745007 206800015…
Output: 717353761 -23692476 -23692476 717353761 717353761 717353761 854766482 545201735 545201735 854766482 -153853956 -153853956 854766482 906767769 964025249 273151899 449663556 648378522 648378522 964025249 293503358 293503358 964025249 -710994010 964025249 980476267 488122188 903182747 -398481950 117235289 266113976 266113976 903182747 903182747 950999823 594616102 594616102 594616102 786995528 -765704665 -168304243 497807058 497807058 786995528 -21204564 130637622 786995528 850194268 -101424661 228907029 764109784 764109784 764109784 850194268 349271228 850194268 850194268 850194268 857867272 651729089 651729089 -366931579 -366931579 651729089 651729089 767520096 490598919 767520096 857867272 857867272 857867272 950999823 950999823 980476267 206800015 417344780 770761640 770761640 770761640 7…

Constraints:

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

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