CT56495

The Lesser Followers Beneath Mirrormere

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

Legend says the vault under the lakeside town of Mirrormere opens only for a perfect tally of vials. Darian means to find out. 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 <= 3398; 0 <= a[i],x <= 1000000000.

Example 1:

Input: 1796 561407304 929998104 274987817 111302896 294109705 966413130 303072984 375035318 931795628 124548937 597720891 82980697 486782847 773932382 431381354 387446502 751554087 728716322 412399873 534394441 362457950 742452202 4549256 794388689 686337309 821957226 942111979 833244194 233707309 336463396 971232456 296670765 112098545 780381650 474678178 104957667 708272987 879235928 883400179 774570971 946808466 862488750 423238965 179945987 254586550 664869061 536861094 681999238 293342245 474235021 823451809 758401443 351833160 424061671 115591534 256815838 868029745 156853160 453044480 146881314 635071526 728473534 50320251 523965508 913307797 533396350 622082789 868026881 41171273 989164952 416935192 490574174 615182586 844027216 848706698 93960781 708819741 177959674 349173477 664294861 6…
Output: 1015 1672 502 207 524 1732 538 677 1670 235 1072 148 858 1393 769 689 1346 1303 738 954 654 1324 5 1412 1227 1464 1673 1482 430 594 1716 526 205 1389 828 193 1258 1560 1565 1376 1667 1527 746 327 457 1171 945 1208 515 822 1448 1334 626 745 214 456 1522 290 780 266 1116 1274 83 914 1586 927 1087 1512 63 1709 724 841 1074 1471 1478 170 1234 319 612 1147 102 1548 4 1443 1372 571 674 1469 505 1492 394 1146 224 1372 933 1667 1133 1014 839 1311 1024 683 1610 1582 316 1178 72 1615 949 1203 1064 1626 674 549 1041 337 994 55 1649 1145 553 1018 600 529 1649 846 1560 1346 145 381 645 269 729 377 200 1027 744 730 1522 1615 126 89 1133 347 1189 1503 464 570 1268 106 587 1045 268 857 656 1204 516 1115 1465 1042 941 235 1400 1244 846 455 936 593 401 888 927 1522 795 1545 625 1052 390 829 621 1247 1511 62…

Example 2:

Input: 976 810296947 14362931 117830808 815153234 797847143 947614448 969263417 915886154 934249887 906768873 920369102 607664065 196306409 756191013 546471232 981947913 768771610 825430407 753441893 376164119 825482248 884197187 704907742 588137416 417904600 106132988 493861348 261407110 912682490 710706694 881224249 696467222 584721185 556506917 992342074 292651006 53679804 929561267 938787688 18734198 76317739 564605835 363360218 596009766 527945736 619285099 279722822 215479648 372148239 536799693 279312045 426093967 631930151 408578113 252945800 966561152 450844376 345039719 490376062 281193558 483985113 61959820 349376812 252614622 330210081 552615240 138427418 45484530 192009148 866086478 368423723 631590533 184007905 490917325 485827887 497905644 8161497 771519759 856101532 58839130 60461…
Output: 789 12 122 790 775 926 941 887 906 875 890 605 199 733 536 940 745 793 730 372 791 849 692 577 402 109 477 269 864 689 838 679 566 537 935 296 53 872 885 17 81 540 352 577 502 598 278 210 358 508 276 400 601 383 258 893 425 328 457 277 446 68 330 255 309 511 134 40 190 784 344 584 185 446 441 453 6 698 770 60 61 276 862 550 801 670 413 732 534 210 200 229 657 200 644 787 774 866 361 395 521 356 328 182 620 174 390 328 300 65 77 126 381 251 818 229 792 719 417 263 658 198 581 379 446 476 47 579 754 54 336 802 596 434 456 448 604 787 283 604 790 237 547 249 578 92 664 455 82 67 503 768 774 434 241 37 529 74 609 797 265 123 710 577 684 412 506 130 460 78 178 242 198 229 783 640 515 42 106 278 39 496 609 286 87 288 339 454 724 468 328 378 382 618 334 575 34 539 645 549 607 476 738 319 49 123 4…

Example 3:

Input: 69 474202251 979449477 724011284 245746730 929868306 51535350 577116986 292809482 412418861 232501125 698340325 203253455 549567648 135661221 112872188 880700321 224335864 713967490 623001323 371451187 283369060 596538831 440756837 46864253 666351480 201566157 656838815 66115085 353648809 61806942 953034932 473517323 632976074 667221834 982222934 204111370 353172485 940364742 550277675 610935035 261879116 209254400 997490511 583787593 551586136 294512907 985023728 19585731 778575939 323403137 696309597 449006914 40065626 916221993 530206814 123331784 96932318 208231531 512287300 780053194 356625676 461153048 614069030 996003 746613321 289775655 614971677 637146286 160508539
Output: 35 64 55 19 59 4 38 21 27 17 47 12 31 9 7 47 13 42 35 21 14 29 20 3 33 8 31 4 15 3 35 17 25 26 32 6 12 29 17 19 8 7 26 16 15 8 22 1 18 7 15 8 1 15 9 2 1 2 5 9 3 3 3 0 4 1 1 1 0

Constraints:

1 <= n <= 3398; 0 <= a[i],x <= 1000000000.

Loading...
Test Cases:No test cases
No test cases available.
The Lesser Followers Beneath Mirrormere - MEDIUM Coding Problem | CodeTikki