CT40385

Ivan's Ledger of signals

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

Morning light hits the pine barrens of Needlepoint as Ivan unrolls the day's manifest of signals. The tally will decide the next shipment. 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: 1401 -447960339 920253019 617653880 561664813 -188258983 994083377 -216480356 -268080207 -436662369 -336851908 -109651667 870079733 118729601 -104441415 -903424857 -927878678 -685581015 -208076508 274060094 -703659243 -570976307 203008109 -893984586 -829536524 365270859 -8609900 387567502 488010803 62341663 -998112024 886198531 772588916 357084867 -568867652 48798011 902714442 152306615 78177765 680979548 919962959 -433322999 469258050 -885958311 760176386 334788464 -384587187 154776478 301561582 -403227800 308377141 994923665 958278454 446551358 624155208 -707176307 791006065 846579805 -561172157 610180575 -887123195 -755604916 438317992 -374675992 -70561616 -331016539 -413293993 610982911 -171663243 -521414976 768085653 676120106 758085819 -415868747 152865011 -737190543 -196433187 72657…
Output: 920253019 994083377 994083377 994083377 994083377 994923665 -109651667 -109651667 -336851908 -109651667 870079733 886198531 274060094 274060094 -685581015 -685581015 -208076508 274060094 365270859 -570976307 203008109 365270859 -829536524 365270859 387567502 387567502 488010803 886198531 886198531 886198531 902714442 902714442 902714442 48798011 902714442 919962959 680979548 680979548 919962959 994923665 469258050 760176386 760176386 994923665 994923665 154776478 301561582 308377141 308377141 994923665 996479402 996479402 624155208 791006065 791006065 846579805 932209463 610180575 610982911 -755604916 438317992 610982911 -70561616 610982911 610982911 610982911 768085653 768085653 768085653 932209463 758085819 932209463 152865011 726570365 -196433187 726570365 932209463 -87370625 608551672 …

Example 2:

Input: 1093 -888681455 -456108598 -679425183 590411080 -778408343 101593045 -711762672 -978103175 909256996 573467601 886894342 520427981 662062441 694104975 664433101 -369635296 -309526926 706105778 -801369890 -14611348 482423753 -947336157 -516442996 -806363563 -379966407 976350742 -266459086 234566853 345822379 -914621070 -749844938 -644929509 -43684212 761794141 -299449541 156612347 77954381 17372757 -230464737 -243432532 -365055048 -674949636 932413710 -13276693 -365006614 398433304 162501204 -212946469 316124715 16919737 -931724612 -781569867 -634379286 713443058 645119234 -219306351 316668137 518313759 850709311 -118786935 -308763388 799060663 -105858665 -88920347 274162378 -751282810 528377506 999698157 33827043 -804519372 187580758 398945238 -597964105 -301139622 301543244 -657762262 900…
Output: -456108598 590411080 590411080 909256996 101593045 909256996 909256996 909256996 976350742 886894342 976350742 662062441 694104975 706105778 706105778 -309526926 706105778 976350742 -14611348 482423753 976350742 -516442996 -379966407 -379966407 976350742 999698157 234566853 345822379 761794141 -749844938 -644929509 -43684212 761794141 932413710 156612347 932413710 932413710 932413710 932413710 932413710 932413710 932413710 999698157 398433304 398433304 713443058 316124715 316124715 713443058 713443058 -781569867 -634379286 713443058 850709311 850709311 316668137 518313759 850709311 999698157 799060663 799060663 999698157 -88920347 274162378 528377506 528377506 999698157 -1 187580758 187580758 398945238 900337780 -301139622 301543244 900337780 900337780 964375788 55045295 528035354 -5017941…

Example 3:

Input: 572 435374525 37916345 -973182629 33464177 212318256 564113231 960048235 67974851 -597026977 -404461443 479946424 739986707 -184669628 434499376 912392597 808855383 497112449 6318279 -742216491 473651976 -83191509 238391021 197194194 -584902434 -644354582 -652041361 223870842 761299592 -105069123 -834488368 -787554131 18898864 -969673554 752154973 257702399 272184390 244165847 -627548611 -26600191 -773355796 -297115494 -182706941 -584748908 -393590661 -961790758 -431184714 32215699 -733998634 463422576 -659130068 3416832 772077911 676994512 838566895 -477936324 -799911969 -354773925 -406104974 847427804 -501874358 475910172 863382897 870703222 183628761 -184805323 -148130558 255271415 658430577 -964664716 114112212 899094494 72985762 -905538317 -523971209 582758022 -814761637 -441586396 -3…
Output: 564113231 212318256 33464177 212318256 564113231 960048235 975925622 479946424 -404461443 479946424 739986707 912392597 434499376 912392597 948222209 838566895 761299592 473651976 473651976 761299592 238391021 761299592 223870842 223870842 223870842 223870842 761299592 772077911 18898864 -787554131 18898864 752154973 752154973 772077911 272184390 463422576 463422576 -26600191 32215699 -297115494 -182706941 32215699 -393590661 32215699 -431184714 32215699 463422576 463422576 772077911 3416832 772077911 838566895 838566895 847427804 -354773925 -354773925 847427804 847427804 863382897 475910172 863382897 870703222 899094494 255271415 -148130558 255271415 658430577 899094494 114112212 899094494 948222209 582758022 -523971209 582758022 855646854 -441586396 -369875109 245396502 855646854 5806968…

Constraints:

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

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