CT44515

Lila and the Secret marks

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

It is audit day at the foggy moor of Greyfen. Lila spreads the marks 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: 2297 -709208819 -173716482 -108134818 -919442599 324133196 971509121 -959779003 -779295520 -594209019 564265229 -99050293 563368480 -221822009 -177376564 606067739 -86153775 565280930 639975475 234633222 -445038309 917125156 -248753201 606463052 -772370889 185226964 -743355529 -278272005 997358642 -861308970 106085844 511966935 -763399805 -894508425 -843795672 -82820004 -547416845 -271566066 984662417 362743977 596295075 -640196087 -475784002 217884051 -90674061 314311668 -763516318 596666403 454429301 -267495706 -120492600 -766539799 -142776579 504421470 476102542 572259465 752523885 885867882 288806145 -431219649 -522047493 475838681 745744350 441098235 -362313461 -777875382 -592161505 -570418659 -356812916 682898184 508041809 -718609478 -177622200 -354253713 -496668619 -296797285 -10111…
Output: -173716482 -108134818 324133196 324133196 971509121 997358642 -779295520 -594209019 564265229 606067739 563368480 606067739 -177376564 606067739 639975475 565280930 639975475 917125156 917125156 917125156 997358642 606463052 997358642 185226964 997358642 -278272005 997358642 998789005 106085844 511966935 984662417 -82820004 -843795672 -82820004 984662417 -271566066 984662417 998789005 596295075 596666403 -475784002 217884051 314311668 314311668 596666403 596666403 752523885 504421470 -120492600 504421470 -142776579 504421470 572259465 572259465 752523885 885867882 998789005 475838681 475838681 475838681 745744350 998789005 682898184 -356812916 -592161505 -570418659 -356812916 682898184 998789005 554269460 -177622200 -101113147 -296797285 -296797285 -101113147 412274868 554269460 -249319320…

Example 2:

Input: 2072 437543506 -556475061 755109210 552663038 996182067 -995584 548649569 425968995 -365088669 -783539923 523310717 -305932943 440422836 756858817 -746553701 -639301048 762846788 -107801492 696085581 79792256 -55370936 -734931309 177532804 -962697696 -524958332 -360048869 -807100762 -920314374 446454431 892846398 -608161632 -193577182 370899807 -243112562 789858029 -995857616 861663735 675194526 -809334562 -190102264 -92630747 -140155221 427702303 580959110 41453691 117816609 -256128039 915236240 -579359293 720726594 827561579 -818007423 206203326 523667416 457055261 236852423 96997629 -650391263 -587496645 35205580 -448831614 -160376408 990754820 -521195407 422955153 890037642 729436523 694407234 355258011 -841759516 686329983 880606594 -172408265 -67778979 839751236 417718205 631545685 8…
Output: 755109210 755109210 996182067 996182067 997968470 548649569 756858817 523310717 523310717 523310717 756858817 440422836 756858817 762846788 -639301048 762846788 892846398 696085581 892846398 177532804 177532804 177532804 446454431 -524958332 -360048869 446454431 446454431 446454431 892846398 915236240 -193577182 370899807 789858029 789858029 861663735 861663735 915236240 915236240 -190102264 -92630747 427702303 427702303 580959110 915236240 117816609 915236240 915236240 990754820 720726594 827561579 990754820 206203326 523667416 990754820 990754820 990754820 990754820 -587496645 35205580 990754820 -160376408 990754820 997968470 422955153 890037642 985996104 880606594 880606594 686329983 686329983 880606594 985996104 -67778979 839751236 849755804 631545685 849755804 985996104 997968470 8451…

Example 3:

Input: 49 -840058804 -238377728 673590135 -340105916 679927113 -546971600 -499106471 -333943423 -153601892 -756332699 472231357 463826181 -778187274 -639097651 835111806 -784893119 235142927 258365084 935580374 -622871648 653989500 738571527 -692026885 675800759 798240088 144130555 -322220544 -933279881 -867004172 -276614142 -768665077 -815929375 613754474 680939171 -326448940 39739551 -259520624 -313884728 221033906 -47967065 728898910 387105547 497171792 -596180366 89034952 920295995 2409064 989600524 -926602992
Output: -238377728 673590135 679927113 679927113 835111806 -499106471 -333943423 -153601892 472231357 472231357 835111806 835111806 -639097651 835111806 935580374 235142927 258365084 935580374 989600524 653989500 738571527 798240088 675800759 798240088 920295995 613754474 -276614142 -867004172 -276614142 613754474 613754474 613754474 680939171 728898910 39739551 221033906 221033906 221033906 728898910 728898910 920295995 497171792 920295995 89034952 920295995 989600524 989600524 -1 -1

Constraints:

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

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