CT63268

Nico and the Misty weights

MediumL6 · Pointer PhantomAcceptance: 0.0%XP: 100

It is audit day at the wheat plains of Amberfield. Nico spreads the weights records across the table and picks up a sharp pencil. 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 <= 1417; -1000000 <= a[i],x <= 1000000.

Example 1:

Input: 576 -670946 -221437 -881712 -642169 -492649 220524 822368 -538216 813460 -376235 77303 -388982 622333 216797 -973160 -204813 301605 561149 -641964 -135777 932793 676161 464210 -334355 -669323 945559 -761571 -189251 964195 -450537 126777 416787 -964191 667183 -568346 -572867 -579029 -440090 914421 -584163 11607 -790931 -689008 500821 177220 930287 543330 -985843 -349880 901530 231111 -21685 -539684 -338596 864941 -556120 461736 -986095 349712 609392 -547566 -743750 -686590 938964 -142305 -559399 542957 103428 -348202 846748 182581 -963140 -140538 -610678 239185 -140096 -117258 744173 -444973 -125926 76880 230078 -339027 40469 97382 -858206 -419348 649284 -521396 957714 -244146 694635 -292503 213085 831514 884500 619426 55350 -508952 -972369 924351 -358689 -214898 563083 -337538 681613 15288…
Output: 96 235 30 105 152 352 512 139 506 181 312 174 454 345 8 231 364 429 104 250 532 461 406 191 94 533 69 231 538 155 315 383 10 449 125 121 119 155 508 116 281 57 85 392 316 508 400 4 170 495 330 261 126 175 481 120 380 3 351 412 121 68 84 494 222 116 384 287 164 463 303 10 219 104 314 219 226 430 139 223 272 308 164 261 274 34 146 397 121 475 187 406 175 292 436 448 385 259 122 7 454 153 193 365 158 393 248 308 234 352 19 100 43 75 1 122 341 336 71 325 170 83 294 373 260 327 393 442 395 208 376 234 329 186 371 425 382 32 247 312 393 212 62 149 213 234 205 27 113 187 73 10 162 34 283 391 122 304 22 128 141 351 303 124 199 166 30 325 265 62 27 68 131 131 117 199 237 383 261 302 78 171 392 267 148 279 42 312 156 262 104 2 146 196 217 107 299 179 333 312 256 56 130 303 254 321 30 275 40 227 287 …

Example 2:

Input: 1323 976855 808325 875773 -410659 223088 -449793 583823 -606556 829732 233139 -588376 196461 100299 283681 52090 -796124 847466 -733313 -134493 818253 609253 377801 678724 -704 -238433 227184 -493932 -359761 -164016 -316094 220401 460839 -480680 839745 624589 -371207 -54431 43143 409641 -456417 775778 -650115 662985 -401695 279086 -773868 -625833 -380292 133893 686179 -756964 640880 -297067 21011 -213371 769966 24957 131174 -129866 343326 -510851 864120 -894787 -193107 751325 595369 -24979 -501171 -52305 -226688 926303 -543503 419362 -794044 187530 -381149 -816417 -387685 -370465 -907225 -521580 -152027 386940 661618 739660 854481 -215749 -329551 633328 715339 -22885 291477 -210652 -639134 114460 343660 335097 -971223 -597347 665397 974178 167039 180213 -874346 -541225 983453 521965 -64258…
Output: 1309 1202 1247 371 826 342 1042 235 1210 831 244 800 728 859 694 122 1221 161 572 1194 1056 898 1108 655 492 817 309 398 545 438 806 942 317 1199 1052 391 623 675 907 332 1150 206 1075 366 837 138 220 378 727 1087 147 1056 439 652 493 1134 653 721 560 856 295 1184 53 502 1120 1005 621 295 609 480 1203 264 889 123 755 370 106 366 376 45 285 527 860 1039 1093 1160 479 409 1017 1073 608 814 480 207 687 832 827 12 226 1030 1207 726 733 67 260 1209 919 200 543 704 386 445 1063 317 900 503 92 749 295 368 791 1125 1053 145 1066 299 839 88 904 234 808 409 230 559 788 226 608 995 654 26 453 148 607 701 931 942 225 480 606 606 506 513 233 248 545 1031 133 683 962 927 81 1 653 235 795 783 730 322 454 103 1128 80 764 32 55 658 1069 722 382 496 269 2 820 261 37 795 904 254 474 1006 24 927 492 789 303 8…

Example 3:

Input: 14 186773 -781765 337590 938402 -911630 -844438 192280 -521162 232890 -777828 -733515 -496512 -759992 379177
Output: 8 2 9 10 0 0 5 3 4 0 1 1 0 0

Constraints:

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

Loading...
Test Cases:No test cases
No test cases available.
Nico and the Misty weights - MEDIUM Coding Problem | CodeTikki