CT36639

Eklavya's panels Frugal Pairs

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

Before the gates of the lantern lake of Firefly Mere close for winter, Eklavya must finish the panels 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 <= 2748; -1000000 <= a[i],k <= 1000000.

Example 1:

Input: 1966 1581225 397756 -412305 -741632 -25664 703433 -73900 -221065 521337 -899948 -98854 -322562 -729920 908191 901399 558416 334002 69480 -86198 -697722 -360214 171199 324207 -466610 -436773 -874202 -342347 779012 847005 424119 672879 664289 551890 -244482 -279951 -188240 -46271 -549075 -711641 764865 23654 721852 614390 -848935 693865 -831454 -701745 180804 984596 920075 -509850 -410566 834020 -204648 -992806 877744 -861294 334297 3835 -154511 776119 572048 -62970 -504232 353682 300056 573806 342497 855056 -716106 287500 209053 -92002 -884524 127978 408974 593574 -918809 899317 -603255 -472079 -123281 -922385 -803071 648138 -579336 648606 -60436 135595 -155114 -308154 663353 257070 509419 420879 -9732 -90703 -989110 -484986 100185 -907701 -810723 149342 789502 21625 -955547 784702 383286 9…
Output: 1894164

Example 2:

Input: 1312 1596839 -607691 -336946 248490 -712208 -806384 -995566 -573157 443322 -544071 334070 555963 665167 490380 -863146 -760177 195011 802431 -632506 -943268 -766960 630788 -474701 210846 354988 -86839 183312 -309159 472982 -368871 448562 620976 -614163 -562770 -781681 -949380 -919065 -400588 10864 -710477 121078 208488 340120 -463931 -937810 93506 488848 620012 471574 305401 -509487 602226 517896 -450281 515272 800802 520743 974581 -843708 -185721 378848 -36493 -87619 567305 -913565 -991942 -603095 403388 -890966 -520252 -758051 424062 -177920 -640250 584541 -731584 -616231 -395486 -379451 -783999 796428 -275742 -298933 -127301 -913074 889400 -282063 991831 805543 -5175 915314 -726935 563308 140752 -525747 -999321 857710 -365492 394510 -224498 353280 -465850 -581853 -977576 -585839 -324176…
Output: 842256

Example 3:

Input: 2332 994447 -30278 -758071 -975335 -171114 323200 -506530 245464 -676129 -682114 716155 -824712 202780 97465 -928323 -244677 252051 -311406 387299 696154 496814 897259 775045 24784 -607410 -885369 86381 978310 979528 434818 -997409 -507108 -585128 624427 -769643 -551701 -294224 227079 686038 -246425 -736917 -143554 -2735 187466 -854178 164953 -399592 442482 698210 465545 -8589 -702241 402749 34908 -510094 736074 366725 -381892 -89783 320761 -159930 -320756 -608844 -372223 481682 -171944 -126467 467892 -981849 187540 889517 -475422 684645 -813009 -773449 -952139 478019 -60031 -564377 238906 68878 -120406 -642319 -146577 -896881 99011 -718409 -697522 614972 945913 -951947 226630 -390937 458234 38667 789104 -357456 778610 706344 -805892 -670404 383582 784808 -648091 715783 -198894 962802 -801…
Output: 2347969

Constraints:

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

Loading...
Test Cases:No test cases
No test cases available.
Eklavya's panels Frugal Pairs - MEDIUM Coding Problem | CodeTikki