CT35029

The Rising Marks of the Sable ledgers

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

Indu the cartographer watches over the shale slopes of Greystone's stores of ledgers. A careful computation stands between order and chaos. Task: Print the length of the longest strictly increasing subsequence (not necessarily contiguous). Input format: First line: n. Second line: n integers. Output format: Print the LIS length. Constraints: 1 <= n <= 4000; -10^9 <= a[i] <= 10^9.

Example 1:

Input: 3084 827345686 -506111883 673980774 27811742 -163398559 -542481283 -846306918 555968168 823323272 -683023090 497602859 977293647 -489460794 868211884 -554123489 -798613078 -788554753 -355902658 -21747441 -282679970 823967768 201616242 997914066 -580673842 -553899273 26009125 -826608060 207447424 589477096 -873474089 733858711 830162449 -137115675 -280723507 251862200 306846549 809355840 -572873039 212383343 -478724220 472855217 -909001149 -111832719 389074736 -982771891 760660136 -782049479 -677654663 -310607787 976896896 -785035781 -108697935 -857371071 -40130008 -780919732 176561891 460987447 -351513323 -206639792 -396659442 688032690 615476884 420669683 821017078 603179072 -389613000 671031922 121718587 472968150 -385201199 -448142175 -760272360 601674569 -668807421 591627774 -891953508…
Output: 104

Example 2:

Input: 698 323362846 854178809 723992217 -744173845 -340023363 925031740 -616004107 -374487630 922052859 -903848620 -597254231 -479920411 -972566100 719848942 -330620115 -18601145 -749673477 -989374285 544539602 -779409137 378108866 479341037 518776406 -1379434 802100606 934223969 753502378 166401401 427422247 -29646207 -650624768 8807303 -751623322 927142766 822353954 81824671 980050092 -388297060 841331444 -418334719 624410988 -565798722 171771071 -664298794 -842208757 656790716 -602475955 115919357 -649334170 -205932969 59843015 500661430 -43964316 616827276 -222575092 -939664449 151675592 754660902 -120011696 -277618702 -996826676 -227260692 -176694214 47571660 -941626236 77659562 546590742 -275162595 724675943 -583108940 501189593 359503930 578953889 -581167946 -927405265 -191496013 56956588…
Output: 47

Example 3:

Input: 2083 610832982 664591440 468396952 -507411838 -565391523 -613425870 895727214 -779924499 796016600 -142403478 210037367 -433976994 -971856848 -185824509 -703827873 -403226922 144492196 -493130589 718906016 -682515149 872797357 67648267 -182126787 565089052 -840741092 -272569325 -828055018 635111697 593304019 176316214 -328543124 -791671396 -20563488 636211180 -654925148 -976287014 -171101018 902289817 -696629546 -687469297 862263868 267067088 -262421210 -969113855 -390201720 398674537 -768174138 487000023 -8748950 -719692968 -750425296 759542935 -689402236 53455135 -388851895 914256264 413179891 -947563875 864600380 -448246435 608000026 -892556818 -998894143 -168106555 38880617 503492803 -628579446 969198098 -913280151 376812672 432629499 279788512 140798572 -414011778 -801890307 -19630524…
Output: 84

Constraints:

1 <= n <= 4000; -10^9 <= a[i] <= 10^9.

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