CT40107

Tomas's Beryl Ledger

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

Tomas runs the bakery at the poppy fields of Scarlet Plain. Today the books show a list of vials, and the numbers must be worked out before sundown. 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 <= 1195; 0 <= a[i],x <= 1000000.

Example 1:

Input: 65 114034 178968 490589 270073 545202 296872 283322 291276 206606 331986 283548 317310 76654 498569 894740 469655 445792 201754 614912 242851 791379 866042 278680 341547 593240 426256 323370 26728 284395 299685 906952 624354 846674 169126 120524 981399 886302 309176 383610 446559 761023 111565 906245 294127 472527 684603 836834 735390 506111 635550 863939 354734 142857 113847 78618 955717 380558 105709 124287 456702 115614 896507 666141 817136 401172
Output: 6 11 38 14 39 20 15 17 12 21 14 18 1 29 45 27 24 10 28 10 33 37 10 15 24 19 14 0 9 10 32 19 26 8 5 29 25 8 10 11 18 2 21 6 10 13 15 13 10 10 12 6 5 2 0 9 3 0 1 2 0 3 1 1 0

Example 2:

Input: 930 649297 181986 820175 147399 772901 96709 751472 615507 703768 122957 662589 550413 505145 767455 311242 233269 839310 318701 514701 997548 828879 231928 332473 160643 907037 35421 339250 944069 672303 192723 688020 573733 36654 9125 332288 124895 42780 495217 138472 379300 637701 563141 441037 924696 826928 204255 296271 501623 832380 698453 875820 58304 129627 204352 323163 829650 531270 184077 287274 359469 652729 792474 752034 921161 443790 169447 108969 294050 337225 748371 104774 52492 63872 236592 116976 58020 684683 551638 324045 783052 802537 727387 109129 60128 181602 163323 561593 651871 457172 230342 6067 184736 509815 815785 708763 951794 947030 138008 565962 648858 29884 48540 536280 486209 498140 668006 847015 858842 622257 305011 598849 232431 197726 107629 798221 560208…
Output: 613 202 764 166 719 113 701 575 660 144 618 521 470 708 303 242 772 306 481 907 759 240 325 173 824 38 328 860 614 205 623 535 39 5 318 141 45 443 149 345 574 515 398 827 736 210 281 443 738 623 777 66 140 208 296 731 478 190 269 329 574 689 658 802 392 177 126 272 307 649 118 57 69 228 131 62 585 481 286 664 685 622 122 66 179 161 485 555 387 213 3 179 428 681 597 798 794 137 482 547 28 49 455 397 411 553 698 706 515 263 495 210 183 115 650 467 508 812 462 799 735 483 545 684 298 494 348 693 662 294 404 272 374 660 12 388 70 401 527 772 164 493 516 441 225 311 452 527 190 216 14 178 170 711 277 116 179 767 748 297 414 567 89 58 334 97 338 717 207 421 303 481 394 383 694 424 14 620 167 506 224 562 288 522 387 188 596 297 51 211 52 66 564 295 545 130 535 352 53 503 122 518 716 241 370 45 61…

Example 3:

Input: 49 637050 718816 482417 101079 59384 463396 372512 396106 239745 531116 132704 159045 457890 811732 425847 942551 496131 273763 414953 845271 622721 300790 599842 720493 618906 820523 576802 232854 854126 782852 279974 683133 150827 843386 666861 685790 300025 295078 691455 971050 774228 455598 85888 894492 750528 748963 406851 626536 867956
Output: 29 33 21 2 0 18 11 11 5 16 1 2 12 27 10 32 11 3 8 25 12 6 9 15 9 18 8 2 17 15 2 8 1 12 6 6 2 1 4 9 6 2 0 5 3 2 0 0 0

Constraints:

1 <= n <= 1195; 0 <= a[i],x <= 1000000.

Loading...
Test Cases:No test cases
No test cases available.
Tomas's Beryl Ledger - MEDIUM Coding Problem | CodeTikki