CT37317

Xara and the Lesser Followers

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

Xara found an old ledger of shelves in the kiln attic at the gull cliffs of Screech Point. The margin notes pose a precise question. 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 <= 1862; -1000000 <= a[i],x <= 1000000.

Example 1:

Input: 45 796163 -9488 171884 665880 -867162 724275 156766 620046 711375 -946043 -899712 256997 634370 -980856 -979201 780416 911679 -891285 345803 993299 -930581 -314644 -465368 -738309 299267 140298 278203 301067 -582369 835512 190654 607245 -206122 -661883 408675 696831 -539915 83185 -950714 -841845 567400 570354 908229 -463283 -335665
Output: 40 18 21 33 7 34 19 29 31 3 4 18 26 0 0 25 27 2 18 25 1 9 6 2 12 9 10 10 3 14 8 11 6 2 6 8 2 4 0 0 2 2 2 0 0

Example 2:

Input: 490 -942540 -49909 -833834 -760935 22922 538677 437132 964524 827390 710999 716671 210898 78689 -666623 -675431 -896380 416787 385289 452426 -579385 382195 -66238 876566 -870017 -341321 -628153 -41797 88290 -941292 -459909 877071 236679 944129 536127 -48320 754041 -864043 -593525 586286 807834 -98925 -287333 379957 193568 -80136 412084 -450039 685243 -380084 -57428 475026 135163 -285919 -345792 468995 -554547 -352169 -123858 446728 -656937 -894896 913697 492096 -432989 -692087 -735916 666009 390052 139671 927608 -942808 529282 -134250 -69993 -891853 -684127 -442715 754221 743067 -763369 -400967 337096 -106605 779461 379000 71889 865126 923595 356466 659912 590535 242455 -381774 -530176 -615921 316240 889489 756285 -826172 -568805 -745641 849219 -393017 -815676 668995 -72576 244879 75142 -5…
Output: 16 239 46 60 252 375 351 477 444 412 414 296 266 85 81 27 342 332 347 107 330 229 444 37 165 93 233 259 16 130 437 287 451 354 229 399 38 98 364 408 214 173 315 276 215 320 132 377 151 219 329 260 171 157 324 110 153 203 316 82 26 412 321 135 73 62 354 300 250 409 15 322 194 204 26 70 125 361 359 50 133 277 193 360 287 222 383 390 279 334 324 255 137 107 87 264 377 346 39 96 56 364 129 39 326 188 246 216 103 269 235 312 25 97 270 41 365 201 56 31 56 350 211 310 141 219 301 80 361 260 349 64 220 214 335 317 226 205 3 238 313 83 51 290 309 125 226 118 167 206 248 43 134 89 80 120 89 222 140 263 25 84 30 21 23 23 222 193 23 19 87 73 30 110 167 30 223 288 299 217 86 251 156 212 184 17 210 120 241 226 57 252 30 292 42 95 192 42 88 16 99 172 70 69 141 200 280 85 19 261 187 90 150 164 18 126 154 …

Example 3:

Input: 103 989732 746159 751136 -288676 689860 851603 981683 -164450 -70416 -785220 -146904 189177 -297993 320465 -212694 134961 -443299 -456359 47279 -425698 -58373 -47045 596971 -695611 863936 -738833 -608023 -1597 566638 -527909 897425 -99298 -11114 -139649 971093 908020 347138 -159941 -244388 784445 757146 -971654 670453 915597 -95963 70236 668284 -671900 -802597 -593468 -459810 -118913 69981 -103966 -712801 156098 -145314 576862 802627 -77191 -140781 471215 506224 838028 -427262 869679 311541 836104 -496001 288578 998520 -152205 -659498 440365 177520 -417544 146444 -790086 96092 -33805 -865244 156614 320314 868787 -8707 756594 725025 531593 -985328 -33161 -742087 142486 584350 -664171 -476969 -590470 -976379 -89741 -738118 141536 525953 169973 957144
Output: 101 83 83 28 80 87 95 30 42 6 31 59 26 61 27 49 22 21 43 22 35 35 62 10 70 7 12 36 55 14 67 27 32 24 67 64 45 20 19 55 54 2 50 57 23 29 47 8 3 9 12 17 23 17 6 25 14 35 38 16 14 29 29 35 11 35 25 32 9 23 32 11 7 22 20 9 16 3 12 9 2 12 13 18 9 16 15 13 0 7 1 7 9 2 3 2 0 1 0 0 1 0 0

Constraints:

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

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