CT56108

Nils's Indigo Ledger

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

Nils inherited the timber yard at the saffron fields of Marigold Row along with its curious bookkeeping system for registers. Time to make sense of it. 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: 1981 994342418 68561199 455238104 989125320 -370929333 -258851792 -89816682 -278909535 -496726717 547284725 78522185 -583707419 -112415747 -512370659 516241276 -668785704 19664207 215183260 784880769 277738190 899368475 546292575 792333948 489940198 472491499 -824893622 -206938087 -711776558 -403812645 -187396103 -734834506 849145729 -721204282 -410885702 -768028350 -990248853 235127665 -249913088 936783037 391158380 -17234505 306615230 -657331619 -665550861 -922789426 251172049 451705645 -130763585 802967244 -23587254 853008839 -931480440 -362079077 -15442164 129752358 -196178771 633612628 -447845133 195016492 -131042768 -379659277 -8862439 843486899 -773816594 -181103871 -264942506 -183980199 454908416 -885397305 601207337 814416110 802919974 -942825864 384886606 828539012 -762030899 247…
Output: 994727129 455238104 989125320 994727129 -258851792 -89816682 547284725 547284725 547284725 784880769 516241276 -112415747 516241276 516241276 784880769 19664207 215183260 784880769 899368475 899368475 936783037 792333948 849145729 849145729 849145729 -206938087 -187396103 -403812645 -187396103 849145729 849145729 936783037 -410885702 235127665 235127665 235127665 936783037 936783037 941396749 451705645 306615230 451705645 251172049 251172049 251172049 451705645 802967244 802967244 853008839 853008839 914024834 -362079077 -15442164 129752358 633612628 633612628 843486899 195016492 843486899 -8862439 -8862439 843486899 914024834 -181103871 454908416 -183980199 454908416 601207337 601207337 814416110 828539012 828539012 384886606 828539012 914024834 247364653 914024834 181303123 914024834 -77…

Example 2:

Input: 1515 -803715413 -20270079 668025075 -961489350 107410307 828685917 -321482951 446188672 -64287008 -685826333 538160100 -633873112 -646748911 922458576 -550863778 887668199 -675738532 -215822947 -888900103 -548015643 308606076 913141465 -407641297 -51072574 -223337751 468339626 40298756 903874369 -11598130 -903115323 541316733 752615246 -249963877 86277266 -893793660 -66542567 -390686249 97486717 -547966741 529217580 -327410348 -942514886 284943504 76609083 -460517209 -140119477 19549911 30738971 500095635 523043598 737691624 597035090 -713157967 -747045871 -777689276 625716868 -592324693 432732617 -207105218 771405168 -52011030 246167923 83628470 -746908047 -856257118 -536263174 -306847204 205282267 694295995 461314362 -820196991 -766775856 -955236409 -695068871 234942347 -473883407 973265…
Output: -20270079 668025075 828685917 107410307 828685917 922458576 446188672 538160100 538160100 538160100 922458576 922458576 922458576 973265262 887668199 913141465 -215822947 308606076 -548015643 308606076 913141465 973265262 -51072574 468339626 468339626 903874369 903874369 973265262 541316733 541316733 752615246 771405168 86277266 97486717 -66542567 97486717 97486717 529217580 529217580 737691624 284943504 284943504 500095635 500095635 -140119477 19549911 30738971 500095635 523043598 737691624 771405168 625716868 625716868 625716868 625716868 771405168 432732617 771405168 771405168 973265262 246167923 694295995 205282267 -536263174 -536263174 -306847204 205282267 694295995 973265262 973265262 -766775856 -695068871 -695068871 234942347 973265262 973265262 981389922 182902517 182902517 -874927…

Example 3:

Input: 665 185358665 -279461365 23808549 945579038 -701897553 -828668370 30106870 -917460278 -894329443 -788459571 -742116960 -179751080 784405019 268787548 -520554372 761592017 289690211 -463639393 60408839 566070705 -823176552 887465946 7452921 -74278577 -199313700 42481054 941857589 634221236 731161141 568415973 617761301 -580804006 675638779 -652187969 742854390 -354641271 573984276 153243 627723033 -194581613 267857298 -885619854 466540325 -879219876 -606828415 762206009 909479971 570838465 660760832 -2004754 824149296 -402927015 -132459136 -993754589 963580034 -516492840 557366566 429791960 912075477 -258588263 -728505176 -61580554 187924601 955191749 -164332676 586331892 797366458 760919027 -953817344 -339603647 -55549635 900218834 -387514545 872470601 -902259438 341973580 -868132534 -8253…
Output: 945579038 23808549 945579038 963580034 30106870 30106870 784405019 -894329443 -788459571 -742116960 -179751080 784405019 887465946 761592017 761592017 887465946 566070705 60408839 566070705 887465946 887465946 941857589 42481054 42481054 42481054 941857589 963580034 731161141 742854390 617761301 675638779 675638779 742854390 742854390 762206009 573984276 627723033 627723033 762206009 267857298 466540325 466540325 762206009 -606828415 762206009 909479971 963580034 660760832 824149296 824149296 963580034 -132459136 963580034 963580034 973245346 557366566 912075477 912075477 955191749 -61580554 -61580554 187924601 955191749 973245346 586331892 797366458 900218834 900218834 -339603647 -55549635 900218834 936518251 872470601 877718665 341973580 877718665 -825309256 -585456560 -63836329 87771866…

Constraints:

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

Loading...
Test Cases:No test cases
No test cases available.
Nils's Indigo Ledger - MEDIUM Coding Problem | CodeTikki