CT44993

Yash's ledgers Lesser Followers

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

Deep in the cotton rows of Whitewick, Yash studies rows of ledgers entries. One clean number will settle the guild's oldest argument. 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 <= 1489; -1000000 <= a[i],x <= 1000000.

Example 1:

Input: 1148 -682427 -163829 -573011 306689 699867 -952551 -763467 -278505 -814582 -873494 -469930 835815 998214 777032 -682509 674076 448929 322479 178069 617101 -639980 -66562 -31066 115531 416052 -911457 -270379 -981699 -548300 483173 -288009 34920 -989689 32222 182809 564880 -295534 188194 238 592825 -530128 833614 810739 -67311 -846542 335834 -446516 237769 -198651 -644201 167597 -109476 -864761 665641 986969 401853 189974 245568 239398 -719615 -109109 755893 -410165 365782 661441 -853025 202955 -116930 428108 488427 782318 254762 160082 -158873 350928 -853084 -285915 148063 414819 -428688 -394484 146306 -465335 591986 -926536 -749962 808971 -162105 -469191 -861477 846817 600648 504191 662347 799430 -641989 -385279 -923039 724401 447225 506643 -747420 -461797 -453057 -828434 264203 -96259 556…
Output: 194 501 256 740 950 35 139 424 112 64 308 1024 1133 984 189 932 811 742 671 900 213 551 567 629 788 53 424 19 261 814 410 590 8 585 660 858 401 661 576 863 269 993 977 542 84 729 315 678 455 204 644 512 73 892 1083 757 652 674 672 162 511 929 334 731 878 79 654 502 760 787 933 674 633 479 716 78 401 620 745 325 338 617 299 826 41 135 932 470 294 74 955 823 781 853 921 200 334 44 877 748 779 134 293 299 90 657 495 563 379 151 888 330 872 204 381 553 193 198 242 219 250 248 537 985 140 450 567 110 299 547 636 374 26 382 874 818 401 218 927 72 636 308 787 972 799 465 416 784 254 670 960 670 968 51 415 807 904 983 719 436 110 271 726 630 381 161 499 227 391 542 855 123 808 182 178 250 857 241 49 374 28 805 956 299 156 63 609 509 829 641 416 687 570 618 265 785 604 859 392 258 153 668 197 850 4…

Example 2:

Input: 27 -259422 -940736 -546299 613045 -192354 -495037 -11299 524366 -284491 982234 526694 819809 277143 -426316 776528 -599127 -884518 437335 -299174 -617792 -820171 -513952 -729397 500204 -75963 -339551 -229068
Output: 13 0 5 20 12 6 12 15 9 17 14 15 11 6 12 4 0 8 5 2 0 1 0 3 2 0 0

Example 3:

Input: 464 -815708 -680436 -478383 598650 -666762 450805 -29884 756210 715385 666580 -991861 -5279 631393 208670 914837 -319931 -761097 156893 -836243 -766099 -350151 -662090 -828422 235274 483278 -427998 -838310 254754 -879776 154303 -851560 672796 460324 925201 238052 -135642 149925 491301 -240925 300076 556549 886313 685689 -755156 -421545 929577 -551381 289843 -717482 -938019 -935558 975477 821341 11374 -257232 807268 468450 -690777 -606263 382887 620313 -438131 -393150 -96799 -204802 -32974 -965077 593270 345610 429037 92148 382354 799881 560597 60027 379598 569481 468063 -504578 -190900 -973210 959603 322298 146002 -690064 29226 811398 -892176 145063 -349458 -434127 787929 -829187 -55340 926113 756781 -84769 891014 52391 121661 723704 -265151 -720164 -562138 309508 -657104 -131470 914974 -7…
Output: 33 69 122 370 72 325 209 395 389 382 0 213 370 260 421 149 43 247 27 40 136 70 29 260 318 124 26 263 19 237 24 362 306 407 256 176 233 312 156 265 327 389 354 37 121 398 98 260 51 8 8 404 370 200 145 365 294 52 78 272 329 109 115 170 152 180 3 319 257 278 205 263 348 306 200 261 306 278 100 152 1 369 245 209 50 189 337 13 205 115 104 329 20 168 351 320 161 338 187 195 312 132 44 85 228 55 150 334 33 156 130 159 50 26 86 343 49 251 70 153 19 172 218 248 264 262 103 88 226 182 223 140 111 36 242 14 21 290 87 129 122 51 211 217 275 100 141 86 147 102 170 275 33 202 286 80 78 234 75 189 66 186 20 280 145 157 143 189 19 132 48 251 70 89 162 71 2 251 80 277 133 21 112 223 217 198 4 181 107 68 79 3 121 175 119 118 253 238 149 124 29 97 89 170 132 182 17 221 84 212 75 104 182 91 21 216 67 137 73 2…

Constraints:

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

Loading...
Test Cases:No test cases
No test cases available.
Yash's ledgers Lesser Followers - MEDIUM Coding Problem | CodeTikki