CT35622

The Hidden ribbons of Navigator

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

Before the gates of the canyon post of Redrock close for winter, Navigator must finish the ribbons ledger - one figure at a time. 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 <= 1854; -1000000 <= a[i],k <= 1000000000.

Example 1:

Input: 1154 1413266207 563554700 196424654 998222615 152568962 319935955 590396327 761147194 981055280 798277696 710734575 297599061 461249308 448576617 330707806 493982568 922991769 127836732 134201555 802695544 928462187 277921560 556896159 28723720 99914041 748398276 828238326 710925011 327820599 902485131 23135142 616421346 57320981 529421960 488640089 433882299 476981747 869931666 272412254 233592016 174144700 463717871 662458232 806514491 871716013 194909415 864989579 540960357 481972141 741232117 59748178 193158086 295452245 521883422 877080875 291787631 425597592 954842989 888463053 473747844 909130425 804526275 864619047 297824702 934107487 811149080 460610684 581101020 404739650 373175960 32412393 172928901 371327316 888909178 312326369 241445853 225416824 930046891 870933181 91374440 7…
Output: 542775

Example 2:

Input: 1559 877963873 826256584 259204017 727552299 361134804 957881407 328654453 888401602 78813283 334586009 887890771 64151439 824650847 633394911 472851913 392719534 854907725 807665267 675823178 136132128 395200512 493534114 725596471 220422583 31101559 435333419 954826657 726070764 160049496 414993585 882669001 620860725 339207145 483730490 989122098 328589013 650104478 695354098 704159891 681516624 255714640 909790734 705186466 120139265 263339121 613394461 311532402 124651489 564210089 53928434 842532393 185725447 552197612 504560072 517148699 475583030 455034214 658382421 479859243 824239515 374693875 425159067 87122437 922378635 381586383 606280916 27571947 765019368 197869923 159754268 527761272 770554677 613389154 814037094 432829712 454766067 279578331 453474295 475228664 585416889 8…
Output: 480746

Example 3:

Input: 1620 1949971847 297477910 596599649 144609291 652327515 707864597 742541795 153344147 252202853 532754656 947831739 489142644 175403313 342704867 392081960 831879900 601626468 62699561 63140701 382928364 26179979 463761332 997792111 565241282 661596297 746969577 637045862 163739037 934228697 885717752 217596184 207331295 91642466 306787607 415578120 164231353 147054924 821358741 838571998 859140866 794691209 593801678 931707466 289600631 25566268 243865695 62936196 901506948 981009242 72569328 87970981 765716455 434440524 905490231 558904331 366107825 34988543 957585135 894456325 224905162 434064707 474236471 791966443 408546801 808238870 73821135 553706628 675997879 886807599 657079728 292092016 525849026 920346924 927071306 96666973 481147408 138181270 945866723 137801882 87001336 577593…
Output: 1309766

Constraints:

2 <= n <= 1854; -1000000 <= a[i],k <= 1000000000.

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