CT48727

The Celestial beacons of Nico

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

In the crane marshes of Stillwater, Nico the archivist keeps careful count of the beacons. balance the workshop's books, every figure matters. 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: 1275 146446454 -721663391 246818123 -609614890 945383419 976256721 -493224493 -630820003 584971374 117526555 -28483056 878735544 -68450090 -621682915 111902472 240735761 444074722 561857812 591722860 -794775702 714655296 -660996688 -980694506 531564055 266704171 -625432700 713818823 848819085 -156971061 -41803756 633831085 393090674 247377326 543207665 266937531 -721878681 -59868700 682689162 -305742666 -709321594 62769854 36320273 476680671 -411994493 -26679529 928591768 -816667016 -660528773 -145782483 422275923 -338173713 -186205717 742953548 -594411080 -172270668 972294088 27753673 305459551 -106591845 -40918141 -202386516 -308652243 -561785878 998884982 590891049 972215312 139927568 291917413 879159157 665349142 -87342196 -314509973 -575565115 -503248086 -879558992 81894546 281227243 …
Output: 246818123 246818123 945383419 945383419 976256721 998884982 584971374 584971374 878735544 878735544 878735544 928591768 111902472 111902472 240735761 444074722 561857812 591722860 714655296 714655296 848819085 531564055 531564055 713818823 713818823 713818823 848819085 928591768 -41803756 633831085 682689162 543207665 543207665 682689162 682689162 -59868700 682689162 928591768 62769854 62769854 476680671 476680671 928591768 -26679529 928591768 972294088 -660528773 -145782483 422275923 742953548 -186205717 742953548 972294088 -172270668 972294088 998884982 305459551 998884982 -40918141 998884982 998884982 998884982 998884982 -1 972215312 997526050 291917413 879159157 939500597 939500597 81894546 81894546 -503248086 81894546 81894546 281227243 939500597 953784918 609619369 724985577 -8319602…

Example 2:

Input: 742 769455803 691406755 338126986 595973292 145197128 -472823186 130949408 406770150 -911548074 -277585992 -638896537 77495336 495619321 -423141138 251910872 -844737865 941428693 164129262 -411798120 823126512 410025350 374795582 -787873071 791370168 45577034 143865607 457558341 -906115797 360778338 -169768990 -502165703 -94366105 -33928420 955090522 363837904 531507062 -674615201 -301128192 458019859 -488294307 104861475 256885412 253896384 618932860 411960890 146073849 -98799522 371347514 820619856 -492980920 968587125 469556683 -539200863 930324743 26381580 -546534387 395641150 -117802339 -782492831 71840314 50395358 235671170 -691340876 708066337 464053915 -429853040 268960577 -747911030 -993333671 821543225 267481053 -509547828 -797523983 769901601 874786166 -618119149 -671757713 4288…
Output: 941428693 941428693 595973292 941428693 406770150 130949408 406770150 495619321 -277585992 77495336 77495336 495619321 941428693 251910872 941428693 941428693 955090522 823126512 823126512 955090522 791370168 791370168 791370168 955090522 143865607 457558341 955090522 360778338 955090522 -94366105 -94366105 -33928420 955090522 968587125 531507062 618932860 -301128192 458019859 618932860 104861475 256885412 618932860 618932860 820619856 820619856 371347514 371347514 820619856 968587125 968587125 971245270 930324743 930324743 971245270 395641150 395641150 708066337 71840314 71840314 235671170 235671170 708066337 708066337 821543225 821543225 268960577 821543225 821543225 821543225 874786166 769901601 769901601 769901601 874786166 881163149 428848633 428848633 441657723 -197823565 441657723 5…

Example 3:

Input: 2833 259941254 74227664 -469909133 -524569042 -189446454 -452914871 343316253 -828010610 -329210997 -624980510 978554549 -578540321 381186883 -384016475 175859049 719996037 217086119 156787773 -416773052 699284709 284136546 521308926 -198547453 444019870 -121128267 -535375221 730288062 -913266591 -9882758 -486161547 624979298 81590887 -807305783 979132024 159254172 311081806 53702050 879163323 915636492 891083753 464700377 -598459647 -927604013 444854854 315942040 409809393 -944742834 40881140 688508042 -107963349 412677093 912951952 959711162 -227253612 476989157 914670614 903286541 221074285 225072616 669133811 -631266450 291327628 785519112 -635666133 -409920503 540417462 198350328 984660064 64317457 927915841 -950141021 885980801 -149458602 91097763 285317007 793062226 -986700518 55850…
Output: 343316253 343316253 -189446454 -189446454 343316253 343316253 978554549 -329210997 978554549 978554549 979132024 381186883 719996037 175859049 719996037 730288062 699284709 699284709 699284709 730288062 521308926 730288062 444019870 730288062 730288062 730288062 979132024 -9882758 624979298 624979298 979132024 979132024 979132024 984660064 311081806 879163323 879163323 915636492 959711162 912951952 688508042 444854854 444854854 688508042 409809393 688508042 40881140 688508042 912951952 412677093 912951952 959711162 984660064 476989157 914670614 984660064 984660064 225072616 669133811 785519112 291327628 785519112 984660064 -409920503 540417462 984660064 984660064 990398039 927915841 934445028 885980801 934445028 91097763 285317007 793062226 880642797 55850097 58885669 58885669 58885669 880…

Constraints:

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

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