CT58396

Bhavi and the Rustic registers

MediumL6 · Pointer PhantomAcceptance: 0.0%XP: 100

Every season at the canyon post of Redrock, someone must reconcile two mismatched ledgers. This year the task falls to Bhavi, armed only with the registers register. Task: For each position i, print how many elements to its right are strictly smaller than a[i]. Input format: First line: n. Second line: n integers. Output format: Print n counts space-separated. Constraints: 1 <= n <= 1066; -1000000 <= a[i],x <= 1000000.

Example 1:

Input: 1034 465173 111462 381750 910579 154828 465104 -21767 471837 65714 658540 -526818 890406 -914909 -762675 -494874 -176097 223445 421229 165697 -994251 -3952 457161 -737620 -562957 -907902 869690 -941851 102346 -30964 -888890 308669 -379232 -555674 -371556 157552 -160252 -789542 744812 -196425 -417841 924282 967132 -535332 721362 -435465 850302 197951 -732956 -900604 202011 673005 745261 -322867 127765 -872600 497981 691200 -34131 759720 -165634 663062 16405 -633734 288844 358279 870243 -8478 -443246 -702385 -796141 625536 -439015 -746474 967799 -138675 -708672 514970 504571 -535288 -87572 -352188 115315 -173147 -520367 -480057 873964 -845309 381092 35050 -109545 -64390 -761646 -788863 828863 319425 352921 893268 -970758 -891301 666614 33311 282255 990610 -616957 328690 -283647 906170 -18062…
Output: 772 589 720 999 611 768 514 771 558 851 226 982 31 112 243 417 628 734 608 0 516 752 123 205 33 960 15 572 498 40 662 307 206 309 593 416 91 869 396 283 968 980 212 850 270 933 601 125 33 600 825 859 331 568 43 744 828 482 863 406 815 506 163 630 663 924 491 261 135 84 791 261 109 950 408 130 739 732 204 438 304 545 392 209 234 906 57 660 500 419 442 103 88 873 623 638 902 7 37 783 491 605 927 160 619 328 898 379 670 404 608 157 154 866 30 596 207 457 898 109 374 693 11 339 551 788 706 900 139 828 43 4 859 581 404 763 624 281 767 397 257 162 75 375 562 792 106 318 853 201 826 125 753 543 860 621 333 31 812 819 121 748 44 391 738 506 578 786 603 34 112 425 611 325 596 214 763 155 550 617 798 96 75 258 249 703 388 568 814 469 414 131 128 749 645 828 126 147 36 56 787 125 3 175 722 363 408 39…

Example 2:

Input: 60 853095 -963174 -286942 31171 952928 972307 -823240 -969656 288982 -405737 766279 -259631 -838958 -344678 -395219 -665323 -40633 429381 -474120 794727 43678 228776 815720 -558656 -901645 -324347 879819 -94687 -795800 207430 -956794 -111894 -723120 36829 -426338 -64986 -32974 -293219 239901 122587 -615546 -935914 -559784 -784911 370883 479413 759300 -979632 921997 84636 364884 -512587 -146592 -593704 849761 953762 646826 -858498 -155808 -671580
Output: 54 2 25 33 53 54 7 1 38 18 43 22 5 18 17 9 23 33 14 35 24 27 33 12 3 13 31 17 4 21 1 14 4 15 9 12 12 9 13 12 5 1 5 2 9 9 10 0 10 6 6 3 4 2 4 4 3 0 1 0

Example 3:

Input: 185 766029 568394 687247 -895141 -307511 -83944 -13785 740166 838240 -88037 -973679 265924 47293 -136142 339547 122487 357446 -281615 583212 564161 686031 366808 315111 220382 825220 -537425 33495 -56246 -654729 -69768 925765 423963 537607 -706918 -479605 683787 -633440 845228 852037 70313 -229896 -744051 -15711 163239 -772801 -703235 297041 -75606 75754 973882 -795707 -833727 779637 -643958 424494 -3065 511262 391632 129130 75221 -315981 379073 -737849 -450544 896723 47535 274740 411735 643347 173061 -359039 -373613 -608510 -7210 -198239 -445255 -461246 -957913 918316 81388 845938 249650 741858 -889972 -670437 -51831 -345883 -216527 517898 -520471 -589216 -754949 825936 727787 -300519 -708914 983647 -154754 882931 -855825 -892116 802088 657480 411616 923751 530450 606515 200914 -621701 96…
Output: 160 141 150 8 60 76 84 151 161 75 2 108 88 70 110 97 109 61 128 127 134 108 106 101 144 39 84 74 30 72 150 109 117 24 41 121 30 134 135 79 58 19 70 86 15 22 89 64 74 134 14 12 115 24 93 65 96 85 76 69 47 81 16 35 113 65 76 80 91 72 41 39 24 58 48 34 33 2 101 58 96 65 87 7 20 49 36 41 70 25 21 12 84 76 33 15 88 36 80 8 6 76 66 55 78 61 61 50 16 75 31 42 12 34 1 18 0 48 63 14 45 36 9 49 26 55 1 52 38 35 54 26 38 50 38 36 18 46 25 14 16 29 20 4 2 21 15 6 31 20 24 14 10 10 2 10 3 24 13 22 20 8 9 16 8 12 16 0 15 14 8 1 4 5 0 9 5 5 5 4 4 3 1 0 0

Constraints:

1 <= n <= 1066; -1000000 <= a[i],x <= 1000000.

Loading...
Test Cases:No test cases
No test cases available.
Bhavi and the Rustic registers - MEDIUM Coding Problem | CodeTikki