CT50514

The Obsidian Shore Lesser Followers

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

Koda found an old ledger of vials in the cooperage attic at the basalt cliffs of Obsidian Shore. 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 <= 2757; 0 <= a[i],x <= 1000000000.

Example 1:

Input: 784 634103779 174506479 14947452 361368275 194394810 815371833 229790371 910564911 482559195 92091622 187822542 146315689 811134763 870098782 548653100 204794015 594573378 688152078 453301062 174221124 431869463 875316178 772399271 895214743 741906048 358623187 85362994 300612984 714258437 345038408 391820491 495525721 514417897 551117792 914874497 382534042 432044085 991400117 911910881 997058770 320396448 299094288 268866024 868413604 271047993 76742131 248108651 9235939 651535049 389771511 40356891 203199239 25884991 748323686 78500503 370281544 656543041 230241311 161531277 483774391 543132776 329297197 215615709 937774605 808264030 537745257 936887017 622134071 593616507 919260322 168998119 199273186 20865081 663702709 866565775 702157123 599652923 249242343 873933508 429090989 834406…
Output: 489 135 11 274 149 629 171 709 368 67 143 106 619 672 411 151 452 518 342 131 322 670 585 684 560 263 63 218 531 245 287 361 372 402 688 278 316 740 684 743 229 217 196 648 197 54 173 3 468 276 25 145 15 541 55 255 467 159 115 339 376 222 146 685 576 369 682 438 416 665 119 139 13 457 618 490 416 163 620 293 588 396 359 647 195 119 59 175 570 228 300 345 614 129 36 152 40 385 149 258 609 73 133 552 489 382 180 417 626 565 496 548 168 265 86 238 470 45 325 597 409 531 647 150 149 37 123 84 481 494 469 266 265 324 113 602 394 83 378 205 205 95 177 140 268 35 607 97 440 87 63 401 187 112 268 508 77 35 10 589 233 96 422 261 86 13 235 180 204 556 474 322 527 192 374 0 605 18 568 47 461 195 44 94 476 11 511 239 371 564 14 328 151 111 14 271 88 439 531 488 36 100 139 149 57 434 479 344 531 474 54…

Example 2:

Input: 2 398061338 335426590
Output: 1 0

Example 3:

Input: 1846 420596712 641211598 163453741 121843629 77651868 96448281 136153535 468094532 290241313 85322474 82545696 515883732 164483548 582087811 659942839 745120782 827159772 957897712 983194104 143419907 958959353 343053034 80652703 737824954 993971571 879826952 179505607 678676473 852974188 697456005 319466745 245857883 809154035 758392687 251983336 624679064 905312446 390775455 592735245 390240845 182624444 334686792 349882861 53779562 998106831 520517532 323925808 822700441 351080767 708802010 167803697 206583358 933867109 978669262 824811419 615164055 578556235 935465216 80901146 988871127 397445665 474326951 998396846 941928806 601308646 138501767 410087110 244719142 880039514 114471486 105445253 283504064 555904467 518905626 55447374 15086229 962241746 91856064 26965876 281389090 284701…
Output: 753 1163 273 206 124 160 223 838 506 141 139 919 269 1033 1181 1353 1513 1739 1792 235 1739 601 133 1333 1809 1607 293 1221 1555 1252 549 423 1476 1370 436 1109 1642 684 1045 682 296 576 609 85 1796 916 556 1482 608 1263 268 338 1666 1750 1483 1076 1008 1668 132 1767 683 819 1780 1676 1043 219 702 408 1574 187 173 477 965 897 87 23 1694 141 38 469 472 1374 757 769 706 983 1460 1166 472 1547 208 510 1108 1512 1751 398 1551 308 672 578 1555 136 32 395 1380 700 1464 681 1443 484 200 1621 1159 499 1458 933 1463 268 509 713 1449 784 1256 1107 220 382 1351 520 456 1243 1246 1545 1125 1308 222 967 1695 566 945 62 1203 411 1475 44 815 1552 885 1284 392 390 951 628 1373 635 1271 959 1624 47 204 602 921 1372 643 657 1536 97 557 537 669 1443 268 1294 1579 716 1262 1331 1375 879 434 287 477 1343 1255 …

Constraints:

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

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