CT49568

Last scrolls of Felix

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

Morning light hits the lily shoals of Padmore as Felix unrolls the day's manifest of scrolls. The tally will decide the next shipment. 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 <= 1424; 0 <= a[i],k <= 1000000000.

Example 1:

Input: 1403 904223396 351541641 639708294 705965340 889677689 841770398 424009483 948002170 924706474 844930133 478299056 673176236 988394451 679002152 223550486 776575485 900635102 748431062 876747649 83512135 107192200 830543452 206344046 813032966 999132283 638969137 202751528 669142207 338463813 649518586 660352638 786440010 636934834 246496868 989099941 381461491 237085565 818824616 611531500 927519048 687219373 752704926 12689999 197933106 367264758 506769921 219877236 313302179 225216903 703308723 202775715 633603709 481791883 999405170 6752572 459192954 860342177 737327929 546833720 348066855 932906484 988331063 175978571 352165590 516137852 636545322 62700038 631935032 124851044 560697040 99250764 52682713 971954440 745863380 644877728 844888222 860216789 933389517 302498562 347808175 53…
Output: 378857

Example 2:

Input: 917 1965535332 924337132 696971666 943187602 108995006 899327498 135817631 622990147 938885432 499877934 522350863 734005715 695430158 10718571 428332098 661303810 289649266 27478488 208042765 204473295 560912962 649709063 963031138 335678163 226031562 941940204 565175113 401722012 689326329 984201572 418794246 861831707 122047279 390111923 868785936 922362679 376567145 830837936 18726163 631376419 37131512 795329577 316922212 307017121 794000573 601241779 729863952 960001428 927115894 444051383 141126309 800437188 491024696 458887646 315473151 820983734 653628324 734927043 576275552 158775065 320649491 286991839 94891278 606625867 483536163 726148821 436727745 692678354 750098675 111829111 181122427 916348679 31100763 223039404 389012553 991761733 195210862 661656339 210648217 399936757 6…
Output: 419740

Example 3:

Input: 1064 1551099631 865883143 334153324 867705801 829505415 740581999 132535665 931706151 525869473 223110507 41915827 741766256 20447817 688604928 458964167 931413669 138542034 64840527 8151895 523548352 270442233 615370601 259324101 611739410 51740536 291921455 94513975 42343496 886649464 911734857 418163049 152412752 143764120 145351281 161185168 16611843 976050473 731003594 644933185 953109250 259687237 73449876 8464367 6944515 662867412 544029576 576617437 47501527 917916008 848607770 497438519 599479957 650937186 84578833 79766931 858112320 509647183 630505108 581193021 566870034 379090926 405415505 338905987 280877762 113304148 385604275 144446644 839344211 52086982 141929107 291045201 565602735 840193765 174868732 683507282 351073245 473011070 952020615 841309510 156371342 305086274 82…
Output: 505087

Constraints:

2 <= n <= 1424; 0 <= a[i],k <= 1000000000.

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