CT34719

The Lazy At-Most Tally

MediumL4 · Loop LordAcceptance: 0.0%XP: 35

Shepherd runs the ropewalk at the snowberry thicket of Winterholt. Today the books show a list of crates, and the numbers must be worked out before sundown. Task: Print how many array elements are less than or equal to x. Input format: First line: n and x. Second line: n integers. Output format: Print the count of elements <= x. Constraints: 1 <= n <= 5341; 0 <= a[i],x <= 1000000.

Example 1:

Input: 66 345115 309974 993302 124126 307820 289099 62325 377838 277106 691777 991847 336468 125056 491974 290634 773281 191892 53762 473817 823604 627191 557744 919253 342919 579070 779535 590971 69965 798919 552991 582836 328130 540106 485333 633421 436853 915835 971883 812042 51668 360426 345049 694123 274174 708827 323452 841219 617337 284374 828532 178409 275135 820295 18354 777900 720824 392156 318131 94303 733236 283364 570912 732378 157179 438230 264539 682573
Output: 27

Example 2:

Input: 5172 160512 480925 223126 628543 740827 98417 376271 48096 119312 416579 965778 469666 967985 893959 939118 254733 343860 259529 183379 402881 795976 513947 261972 880178 463233 486140 761702 274875 352243 688330 483887 196387 588053 818883 943701 989597 267982 491015 684634 443640 547814 953743 595347 629473 829505 505605 400208 8444 586496 883443 283530 26344 431199 678715 704823 496708 675483 231790 396640 432767 939192 277728 954577 830859 734157 701545 107792 274002 109171 49080 913505 69208 954143 572658 326055 918988 646800 686786 172336 639716 803742 716083 223108 137245 458929 580579 804847 122593 255167 692439 874456 605509 385119 272149 645205 50107 383601 991338 706755 134157 795753 137981 84594 574627 530402 208998 490015 618435 530977 654168 231453 376871 245578 463290 609107…
Output: 839

Example 3:

Input: 3192 688108 829013 882369 715213 589257 507600 531953 566544 20552 223516 576589 561601 105562 325433 201287 403815 437476 764670 181285 758193 772460 640787 778947 217513 984196 822664 722770 147314 171350 864727 476705 639182 587323 194600 561355 595076 212318 613161 132173 684432 447615 42595 693617 868627 711317 745997 692587 241256 567747 245951 274570 612803 334256 243210 426831 661128 275182 643093 914390 76099 573895 832179 35612 932680 136498 368511 269323 52340 302083 228837 219457 935308 679882 757422 78096 612362 239263 498021 250949 643720 636614 476090 21250 777394 62683 249466 496269 110530 917606 774449 636793 868769 537801 849177 71078 943549 89109 535140 744673 601925 762247 429816 225677 525809 931046 104077 669405 348217 373864 743089 765853 186361 959672 181765 738532 …
Output: 2209

Constraints:

1 <= n <= 5341; 0 <= a[i],x <= 1000000.

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