CT38024

Owen's panels Reckoning

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

It is audit day at the canyon post of Redrock. Owen spreads the panels records across the table and picks up a sharp pencil. Task: Print the number of index pairs (i,j), i<j, with a[i]+a[j] <= k. Input format: First line: n and k. Second line: n integers. Output format: Print the pair count (fits 64-bit). Constraints: 2 <= n <= 3705; 1 <= a[i],k <= 1000000000.

Example 1:

Input: 387 143192210 813422808 788852893 266309775 174746948 369732035 441710954 350210947 998532783 997249705 161741862 620227523 196240387 847695727 305263151 829516200 400920324 505078561 3374639 301066762 714251807 361145838 396212929 380193475 436680446 545521234 18149139 382498395 325403823 185531753 724588550 856891764 155874268 233926080 912417480 208477851 94852272 42640441 728192736 793610480 502080698 411548565 359777446 558560591 322095775 558667903 934945803 292041258 256030772 626652872 8429738 478962448 194140706 710635534 660582282 265811772 167817259 482474847 201840604 380769496 459756518 974336568 177647110 847404641 530338010 392501537 28831916 283084166 765259832 280666269 572008987 293637713 346085302 638717213 485142184 267510406 497518826 377721898 202161680 225025602 2362…
Output: 547

Example 2:

Input: 587 207682627 963504161 101939257 590465168 612805929 612071710 516484884 989464143 454979737 172449045 554332841 844992664 269794843 861872518 169012514 677672788 365806861 426845187 882239649 190569510 501851224 8347732 121055164 318529499 185945285 417661575 231047736 33117229 237691197 411629550 421976163 137471589 161119617 238822562 58237408 835161764 463241636 895631186 93030379 313223370 718038142 700370860 491472924 143592423 481994410 702681082 809560011 998733151 42505906 344523926 240912183 455469877 898521156 443576821 667862951 184923858 263210040 1681200 602106016 554853442 952188992 643057391 603013041 511138446 92312882 189250715 46404452 242369923 114683902 119914364 556614469 621720582 506210355 158441101 890589862 593957449 309197835 129874052 557336233 310046770 403745…
Output: 3257

Example 3:

Input: 2663 1417700882 987186728 229833524 640347014 829975843 415957978 139068762 241493712 839442870 525346413 625058486 772733478 166010717 486545840 434510402 892296984 133593966 789754743 150176270 420418154 401804693 265422926 662765024 928491103 914831035 55225432 614897493 89089516 999182719 683968223 568893215 393645076 130509087 565167637 627727517 835979226 444588716 951686585 803153142 711509014 840998637 777724476 275820861 285046977 913173144 65667540 584022468 215459653 585013217 17976995 767244689 787242033 280978034 432822383 6561134 520555586 776666771 5123855 39790203 346325797 583296528 774987318 809575344 631527587 490096293 160871634 332930388 673022118 334112579 19863416 211662992 415285159 667436192 730241033 976365141 79285960 819425063 544639980 458830527 623913701 32108…
Output: 2953636

Constraints:

2 <= n <= 3705; 1 <= a[i],k <= 1000000000.

Loading...
Test Cases:No test cases
No test cases available.
Owen's panels Reckoning - MEDIUM Coding Problem | CodeTikki