CT46388

Quinn's Frosted Ledger

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

Morning light hits the foggy moor of Greyfen as Quinn unrolls the day's manifest of panels. 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 <= 2469; -1000000 <= a[i],k <= 1000000000.

Example 1:

Input: 172 1528587141 80356654 181805450 745726252 227551409 925174328 984998504 32411925 554102816 858942784 932821768 703209822 101700241 364153490 165487581 697694343 47077007 549745710 96926684 487150742 82124446 457692760 965102739 499252833 152807692 668910472 139634331 292081274 803339289 649691007 299101548 460520387 9927750 23107680 688849138 512529836 171898012 142058503 112118567 514878887 600794588 844826843 219873933 210772715 872602538 179298788 216769612 353291076 577017893 833435620 429656157 533277203 728011263 380157242 610861843 396728888 21022210 503784287 765098711 564371719 813008272 595347553 224863831 172582045 86556383 778066198 103730228 747633385 187654413 810546719 213319899 681561075 435681328 145680777 368195427 888469887 77439706 755496006 536918919 210131390 126242…
Output: 13372

Example 2:

Input: 862 627009703 234829649 638576298 270799609 829440727 601836177 684092732 252743501 718532901 332682626 462225900 996373800 834307475 587404582 901115005 233906668 630348026 589564130 880719539 542012880 757937495 133331723 507023223 190178596 922432612 845668481 598325980 898811478 375520173 376296094 499788753 80707977 717162071 490683640 702439294 666869180 610754985 574287659 202667062 121725473 189660019 607288925 342219081 685843932 407021915 535798853 41873119 851650518 764840257 767407403 618099852 568694316 804547374 640447007 242471203 806237576 913430474 677915081 115399709 426671039 228039307 946172508 517295372 85973532 260307368 582693919 493266245 864978395 286163555 874654337 405708666 408540142 480590859 589594622 826143802 164091577 759490426 790099521 39699094 980604644 …
Output: 63643

Example 3:

Input: 288 635986530 687087437 121512716 703354917 368380926 953205983 38111116 992240372 673097058 380385020 957598277 139932444 146956385 39517636 307458559 196071059 370574847 897732904 533992816 914696807 894209016 724732888 384352748 191512025 397047536 383647097 488367212 652894430 174262282 499446265 159663152 756750698 128003240 523283955 63663765 616397458 562301937 642293609 888513894 817506362 998913660 849079154 111986579 317633162 798083019 678063140 871157345 646067979 920209193 393831529 645051272 314891234 502350370 47298075 329103765 408303949 589822114 293429211 152191393 250329669 14037231 469479748 46336462 223695780 442525688 433161441 324553238 295136579 776589026 442432328 227757743 663303470 805456439 791956731 56354869 196325863 807423715 627232594 402344285 79911182 4116…
Output: 8972

Constraints:

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

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