CT42192

Tanya's Taller Ahead Ledger

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

Every season at the mulberry rows of Silkmead, someone must verify the safety inspections. This year the task falls to Tanya, armed only with the beacons register. 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: 3180 -310860265 326653188 583754447 605788582 506656 891622981 -623532353 174782060 568876377 273019593 -375461884 -1622233 449783010 911085082 -747979909 -693470458 53402628 482844926 -124314794 -383594358 881304225 -729191012 747328713 669633595 -426148000 -913634557 -513187158 189337025 210443723 697839756 -568132584 659511471 661556217 5898509 633555017 -919090812 -105796736 -508362612 -3691676 -582871846 273477178 -295416536 -275026884 -98650203 847384438 316190924 -484992014 939781604 494640106 -259421161 583589995 10638619 93525908 -995246252 975611954 587623327 -525203405 476035592 -113411296 286032527 -907870648 781985460 -554561968 401436735 -509802139 841150610 229541358 -72702753 -726519416 -807169031 -664930712 132358594 -692284380 -246303164 652906884 -376516551 -435254950 97…
Output: 326653188 583754447 605788582 891622981 891622981 911085082 174782060 568876377 911085082 449783010 -1622233 449783010 911085082 939781604 -693470458 53402628 482844926 881304225 881304225 881304225 939781604 747328713 847384438 697839756 189337025 -513187158 189337025 210443723 697839756 847384438 659511471 661556217 847384438 633555017 847384438 -105796736 -3691676 -3691676 273477178 273477178 847384438 -275026884 -98650203 847384438 939781604 939781604 939781604 975611954 583589995 583589995 975611954 93525908 975611954 975611954 989974343 781985460 476035592 781985460 286032527 781985460 781985460 841150610 401436735 841150610 841150610 972344451 652906884 132358594 -664930712 -664930712 132358594 652906884 -246303164 652906884 824270552 972278 972278 824270552 972344451 729831510 -852…

Example 2:

Input: 3056 773240258 -935686414 -977264805 -836360059 628192751 692382004 -795792263 586940876 813756699 -251134073 988496702 -68307840 546822789 206921346 -183751241 -640167288 -135257336 -637231978 297999516 442838705 721280697 -215720161 613988836 314707767 -577651493 -147075665 238164190 663815429 661310610 -697461752 851935159 -132970686 345713626 -832597904 -866415565 -345655962 158049054 -593392259 415268006 -58738749 -406323887 -625584816 -610203820 557686022 -15330959 196333881 -863040209 -653225094 801894571 -884811976 638967135 191344245 456417710 -167920663 873274276 -86308307 -844633213 136072289 -929383208 626215802 -726796058 261213320 -844149608 -631088538 -710800744 373410495 969014683 -124449501 -908621557 80452373 98720288 415767444 -541001887 894323771 -685168925 -253878984 5…
Output: 813756699 -836360059 -836360059 628192751 692382004 813756699 586940876 813756699 988496702 988496702 993941978 546822789 721280697 297999516 -135257336 -135257336 297999516 297999516 442838705 721280697 851935159 613988836 663815429 663815429 -147075665 238164190 663815429 851935159 851935159 851935159 873274276 345713626 415268006 -345655962 -345655962 158049054 415268006 415268006 557686022 557686022 557686022 -610203820 557686022 801894571 196333881 801894571 -653225094 801894571 873274276 638967135 873274276 456417710 873274276 873274276 969014683 136072289 136072289 626215802 626215802 969014683 261213320 373410495 -631088538 373410495 373410495 969014683 993941978 80452373 80452373 98720288 415767444 894323771 894323771 963691671 -253878984 584270679 963691671 993941978 958992734 44…

Example 3:

Input: 1413 710007273 831642503 -28811186 -129223911 69769075 889055988 -264724656 558178265 -622151623 686570138 34961287 850383447 32356264 77517651 812460560 -567754845 -607507600 -223553817 730220214 -210371986 170732618 -859739830 897188567 -212808514 169130420 -804244568 905187982 163356583 766311704 539992202 -631769528 937101554 -171399881 102108912 -952281624 158872788 328158839 102154590 534074888 938016876 -447851492 466665713 -688352859 -757825847 -726166255 18832867 236063213 653368697 -824363751 641246650 -971257554 -363154545 713192061 10603510 876269537 -241459718 461703970 228933204 416161378 468663642 -162685718 594302174 -712410414 -537146640 849716862 522222777 671764666 950037661 -670677723 -850957969 -606829350 690398762 -781543420 -153115296 795329860 514112936 520711827 -8…
Output: 831642503 889055988 69769075 69769075 889055988 897188567 558178265 686570138 686570138 850383447 850383447 897188567 77517651 812460560 897188567 -223553817 -223553817 730220214 897188567 170732618 897188567 897188567 905187982 169130420 905187982 905187982 937101554 766311704 937101554 937101554 937101554 938016876 102108912 158872788 158872788 328158839 534074888 534074888 938016876 950037661 466665713 653368697 18832867 -726166255 18832867 236063213 653368697 713192061 641246650 713192061 -363154545 713192061 876269537 876269537 950037661 461703970 468663642 416161378 468663642 594302174 594302174 849716862 -537146640 849716862 950037661 671764666 950037661 965815174 -606829350 -606829350 690398762 795329860 -153115296 795329860 930689053 520711827 930689053 -288822117 -22337623 232868…

Constraints:

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

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