diff --git a/longest-increasing-subsequence/Makefile b/longest-increasing-subsequence/Makefile new file mode 100644 index 0000000..4227f1a --- /dev/null +++ b/longest-increasing-subsequence/Makefile @@ -0,0 +1,97 @@ +# Normal directories +SRC_DIR := src +BIN_DIR := bin +DBG_DIR := bin/debug + +# Grader directories +GRADER := $(wildcard $(SRC_DIR)/grader.cpp) +GRADER_DIR := $(SRC_DIR)/grader +HANDLER_DIR := $(SRC_DIR)/handler + +GRADER_SRC := $(wildcard $(GRADER_DIR)/*.cpp) +GRADER_BIN := $(patsubst $(GRADER_DIR)/%.cpp, $(BIN_DIR)/%, $(GRADER_SRC)) +GRADER_DBG := $(patsubst $(GRADER_DIR)/%.cpp, $(DBG_DIR)/%, $(GRADER_SRC)) + +# Change CPP source directories if grader is defined +ifdef GRADER + SRC := $(wildcard $(HANDLER_DIR)/*.cpp) + BIN := $(patsubst $(HANDLER_DIR)/%.cpp, $(BIN_DIR)/%, $(SRC)) + DBG := $(patsubst $(HANDLER_DIR)/%.cpp, $(DBG_DIR)/%, $(SRC)) +else + SRC := $(wildcard $(SRC_DIR)/*.cpp) + BIN := $(patsubst $(SRC_DIR)/%.cpp, $(BIN_DIR)/%, $(SRC)) + DBG := $(patsubst $(SRC_DIR)/%.cpp, $(DBG_DIR)/%, $(SRC)) +endif + +SRC_C := $(wildcard $(SRC_DIR)/*.c) +BIN_C := $(patsubst $(SRC_DIR)/%.c, $(BIN_DIR)/%, $(SRC_C)) +DBG_C := $(patsubst $(SRC_DIR)/%.c, $(DBG_DIR)/%, $(SRC_C)) + +SRC_JAVA := $(wildcard $(SRC_DIR)/*.java) +BIN_JAVA := $(patsubst $(SRC_DIR)/%.java, $(BIN_DIR)/%.class, $(SRC_JAVA)) +DBG_JAVA := $(patsubst $(SRC_DIR)/%.java, $(DBG_DIR)/%.class, $(SRC_JAVA)) + +CHECKER := $(wildcard $(SRC_DIR)/checker.cpp) + +C := gcc +CPP := g++ +CXX_FLAGS := -Wall -O2 +DEBUG_FLAGS := -Wall -g +BOCA_FLAGS := -static -DBOCA_SUPPORT + +JV = javac +JV_DEBUG = -g +JV_DIR = -d bin +JV_DBG_DIR = -d bin/debug + +.PHONY: all debug release checker clean + +all: debug release checker + +debug: $(DBG) $(DBG_C) $(DBG_JAVA) $(GRADER_DBG) + +release: $(BIN) $(BIN_C) $(BIN_JAVA) $(GRADER_BIN) + +ifdef CHECKER +checker: $(DBG_DIR)/checker-boca $(BIN_DIR)/checker-boca +endif + +$(BIN): $(BIN_DIR)/% : $(SRC_DIR)/%.cpp | $(BIN_DIR) + $(CPP) $(CXX_FLAGS) $^ -o $@ + +$(DBG): $(DBG_DIR)/% : $(SRC_DIR)/%.cpp | $(DBG_DIR) + $(CPP) $(DEBUG_FLAGS) $^ -o $@ + +$(BIN_C): $(BIN_DIR)/% : $(SRC_DIR)/%.c | $(BIN_DIR) + $(C) $(CXX_FLAGS) $^ -o $@ + +$(DBG_C): $(DBG_DIR)/% : $(SRC_DIR)/%.c | $(DBG_DIR) + $(C) $(DEBUG_FLAGS) $^ -o $@ + +$(BIN_JAVA): $(BIN_DIR)/%.class : $(SRC_DIR)/%.java | $(BIN_DIR) + $(JV) $(JV_DIR) $^ + +$(DBG_JAVA): $(DBG_DIR)/%.class : $(SRC_DIR)/%.java | $(DBG_DIR) + $(JV) $(JV_DEBUG) $(JV_DBG_DIR) $^ + +$(GRADER_BIN): $(BIN_DIR)/% : $(GRADER_DIR)/%.cpp $(GRADER) $(GRADER_DIR)/*.h + $(CPP) $(CXX_FLAGS) $^ -o $@ + +$(GRADER_DBG): $(DBG_DIR)/% : $(GRADER_DIR)/%.cpp $(GRADER) $(GRADER_DIR)/*.h + $(CPP) $(DEBUG_FLAGS) $^ -o $@ + +$(BIN_DIR): + mkdir -p $@ + +$(DBG_DIR): + mkdir -p $@ + +$(BIN_DIR)/checker-boca: $(SRC_DIR)/checker.cpp + $(CPP) $(CXX_FLAGS) $(BOCA_FLAGS) $^ -o $@ + +$(DBG_DIR)/checker-boca: $(SRC_DIR)/checker.cpp + $(CPP) $(DEBUG_FLAGS) $(BOCA_FLAGS) $^ -o $@ + +clean: + @echo Cleaning problem files + rm -rf bin diff --git a/longest-increasing-subsequence/input/1 b/longest-increasing-subsequence/input/1 new file mode 100644 index 0000000..1df2e06 --- /dev/null +++ b/longest-increasing-subsequence/input/1 @@ -0,0 +1,2 @@ +5 +1 2 3 4 5 diff --git a/longest-increasing-subsequence/input/10 b/longest-increasing-subsequence/input/10 new file mode 100644 index 0000000..3255628 --- /dev/null +++ b/longest-increasing-subsequence/input/10 @@ -0,0 +1,2 @@ +185 +-7466 2935 1376 -2453 2071 5576 512 4842 8150 -4707 4762 -1989 -8030 -1403 -6390 -3822 -5672 -5250 7302 -4366 -8361 2188 1490 9085 3102 -7179 -4716 -6153 9766 -3111 -6141 4180 -176 -3053 5595 3940 6314 5069 -4049 4888 653 -7701 8783 5035 -8712 7 -4899 -1712 -514 -4554 -3418 -1913 -8801 1582 61 8086 -3600 -6866 -8725 1126 -2488 9459 1139 -9198 -8267 4979 8400 -6679 5201 7691 -5240 9 5907 -4837 4430 1776 3520 1590 -6517 -6024 1153 5618 -116 3291 -8937 6748 7264 6470 7207 4387 -9241 2036 -6298 -4699 7243 -9528 3790 9767 -393 -4944 -206 5564 -620 -3024 -3289 2992 7949 7198 -8026 -5138 8873 -6668 -6908 -9407 -9726 -7755 -8651 -6721 7191 -6475 2721 -3186 -1998 8544 9107 8826 -7073 1281 -4741 -4825 -9721 3074 -6843 4220 -1617 619 5732 1566 -6449 6507 -6947 -732 2745 -4820 -6970 -3257 -3242 6465 -6154 -6081 -8705 6251 2178 7094 -9919 -8844 -9371 2804 -9671 3430 8774 -325 -6156 393 -9386 8305 -9030 -6257 5384 1884 9805 1531 -3716 5381 5739 -180 -5188 -9491 -695 2879 4568 1915 1258 7765 -6225 diff --git a/longest-increasing-subsequence/input/100 b/longest-increasing-subsequence/input/100 new file mode 100644 index 0000000..77eaea6 --- /dev/null +++ b/longest-increasing-subsequence/input/100 @@ -0,0 +1,2 @@ +872 +-3173 2827 -7977 9426 455 -1450 -9945 -7441 5926 -5515 -2864 -5999 -2046 -9419 2740 -656 -2963 7955 4119 -3890 -7722 9256 1191 1525 -9617 4647 1607 2564 -5570 6445 -5112 7292 -2659 -6135 2292 35 -2153 2724 -259 7958 8908 -1505 4261 -1537 4116 -9359 7839 -1807 1315 -6562 -8535 -3146 -7308 -6125 7717 -3268 5182 2843 -7707 -3957 -2683 -1815 -1971 4108 3491 2716 -6512 5044 -5088 1278 1490 -7713 -5283 223 4952 7444 -2647 9064 -5545 -4811 8729 -2269 -5479 6805 -8473 -4802 1449 -9026 4138 9526 3897 8653 -7801 4357 3829 -5428 -5588 -5051 8101 -5154 7465 5855 -3290 -6190 6141 9122 -8208 3122 -7858 -2212 -7731 3218 7375 8695 8004 -1430 -114 7747 -5327 -8397 2275 2392 -1523 7628 9032 -9066 2145 5624 7043 4767 -9904 -6255 1920 5696 106 -7136 -3575 6274 -8876 6516 -8157 -9603 6122 9991 -7591 4719 2844 -9542 -5275 -4679 -5515 -7518 5084 -6887 -3429 3140 4562 -4479 3182 -2215 7978 -5173 -5227 -2164 -5916 -4353 -8284 -1216 6292 -9654 -1413 -3890 1505 -2478 7893 -8543 3113 -7815 -7728 533 -6717 -7691 -2035 -2753 -4729 -5961 1340 5944 -3328 -9249 -2500 -7640 -7454 -4067 -9590 -5540 -119 -3747 6399 -6208 -3186 8920 -9476 -780 4610 2950 -1802 -2435 -1460 -8967 -1981 3836 -3080 821 7276 4418 -4567 -9319 -8215 -9144 -3096 -7349 -9709 6920 -4221 714 4433 -9835 -1506 2056 -1811 7296 5478 -7893 1619 -1641 -8287 -6325 -5359 1987 -7308 3937 -8615 -9403 -1063 7655 1023 2914 7648 -9214 3806 -5075 -1276 2004 1684 -4587 6593 7191 718 7998 -4775 -8972 -9447 -7898 7390 668 5102 -5798 3077 -7746 3969 5193 -6155 -4746 -5844 305 3542 -876 9175 -8782 -2353 1220 -214 -4849 -4870 4319 7697 -3481 -8857 77 -3053 -2451 -650 4008 8014 5329 -917 6969 1510 -1370 -6382 -4862 8970 5734 4482 2315 -6399 5525 3126 393 -2717 -8533 6479 2601 4113 -4480 2431 -8975 -6189 6616 -179 4342 6735 -6850 4350 5384 -8182 1923 6208 -2523 -9238 -3740 368 -7176 2657 3483 -4665 4293 -8945 -837 -210 839 -2941 1939 -4233 9077 -6876 6029 -6962 5985 -4789 -7123 -7451 -5749 -6110 4090 -7087 -3485 -5993 -7448 -6001 4398 5478 3376 -4720 380 2767 1581 -167 -4551 9435 9546 -3917 -8450 -1674 4660 -929 1055 6811 -1941 9249 -7834 9993 -5348 -1298 -1345 9064 2332 860 9753 -9960 280 -9833 -4169 -1521 -2074 -7804 7011 5783 8783 -7629 5813 -4507 -6239 8179 4611 -634 -611 4992 -894 3713 -2020 4962 2909 -8920 5962 2708 7468 -2541 -8158 -3217 -4098 8586 3736 5098 4850 -3108 3739 2954 -6756 -2387 -9195 1453 6670 4373 -4359 3763 9111 6479 6211 1461 -887 6068 -566 7145 3784 -8127 -7945 9314 8563 5488 -8571 -5283 -8303 6704 -2918 -8696 4017 -9593 -7157 -9713 -2115 -8038 5063 -7880 8689 2214 5361 8139 8530 -5603 1611 -205 -8400 -3387 -1760 2304 -9533 7975 -475 8364 6106 8778 -5874 4448 6378 4517 -7179 1021 5394 7467 885 -2673 5731 -6669 4148 2849 6521 7961 1054 -1649 -8201 5613 5353 1484 -1566 110 9623 3493 -5713 1547 9177 7796 5118 7624 -4021 -2373 347 -4011 4916 -8529 6508 8956 -5805 -7641 -7975 1879 688 7739 -2790 6639 -1713 6730 4807 3515 -8928 161 3749 2040 5085 -9826 4979 -1854 -4339 -7528 2075 7336 -2001 -9189 7999 -4563 5648 -2777 -1022 -9080 5571 5870 -1015 3562 -6075 2288 7965 4073 -9040 2706 -7544 -1668 -5343 -6604 4706 -8319 7732 5885 8432 3869 -8043 -2647 -6838 5411 2151 6828 9772 6290 398 -4293 3415 9395 2773 -3732 -2302 3923 5108 -9136 2302 867 -1829 -1694 8209 -4425 -588 -9451 -7588 8490 6459 2794 5815 6018 -5518 -9329 -2807 6392 -1887 5552 -1215 -135 9332 8847 -2790 -3896 6863 1982 -5356 -9502 -3549 9451 -7971 -2740 4875 -6687 -7947 2620 8069 -8758 -6247 -7815 -4499 -7713 3060 1305 7266 -4621 -7802 2571 -3870 3708 -5207 -758 9978 9055 9082 1079 2136 -4419 8715 -1134 3311 2591 -813 9659 -3112 1407 -9680 906 2536 -8818 -8338 -1804 7975 -4397 -684 3119 -5189 6313 1973 5089 -9988 -1954 3746 -3329 4923 -2279 4432 -927 1531 5271 -1911 468 2019 -1145 -7761 -3216 -5458 -7173 -198 8358 -9975 4198 -2169 7912 -6721 6611 4770 -6032 -1471 -1158 -1914 -2632 706 4307 4061 -5711 -5793 1012 -5662 2781 -221 29 2019 -4205 -6820 5894 -3649 -8404 -6895 -5495 -2445 8835 -7324 3436 -2661 -7058 9743 -9217 7147 -1720 6967 -6880 -6307 8370 -532 5682 8554 -6861 3569 -8298 -3959 4250 2045 -4432 -5626 5504 5225 -3562 -1540 6345 5231 1589 -9495 -9542 -4839 7552 -6731 -9095 780 8810 5776 9899 9818 2429 -2263 -4513 -3801 -5464 -2484 4602 -4721 4614 -8002 -1193 2294 9413 -122 2507 -5911 -3795 6886 8306 -1708 -8901 -6007 -4770 -7106 7324 -8618 6537 4200 4436 -4538 9174 2013 -6261 -7011 4759 -6006 1569 4928 -9459 -6355 348 -3560 -5900 -807 -5529 2310 8632 4664 7876 -8887 7456 -7511 1538 -3976 457 -5843 -5534 5164 8774 -8357 7779 9488 -7460 4932 -8159 -748 -5752 2168 158 3061 -2755 -4076 2947 -9454 95 -4073 3108 -3487 -6011 1546 6804 -8192 961 7107 5834 9810 5933 -2231 -5143 -7903 -268 -1939 3465 4922 -1108 7937 -6239 6446 -5567 4263 1661 -4679 6088 9891 diff --git a/longest-increasing-subsequence/input/101 b/longest-increasing-subsequence/input/101 new file mode 100644 index 0000000..a353fd9 --- /dev/null +++ b/longest-increasing-subsequence/input/101 @@ -0,0 +1,2 @@ +108 +3654 7514 9539 4944 4149 -81 6402 -2279 -3555 1269 -8584 7796 3951 8091 5279 9541 203 -3384 4904 -2962 -8442 -7860 -3339 2480 -5881 8359 -6369 3196 -6110 -5782 -1314 6167 -2631 1465 5208 8903 -5304 5688 -824 3969 -149 1831 -2451 1012 -6308 -6132 -1198 -2640 8719 -868 -5393 -8500 -9315 -2409 -4490 1527 -3725 2227 -2714 -3418 -7336 7655 -9171 -7722 -2828 -9398 3092 4225 1389 8882 8253 -2881 -463 3370 4847 7927 8353 -6044 6077 6689 4987 6773 3536 -9507 -8299 6992 9268 -9935 -4070 3455 -9007 948 -561 6251 -5000 9447 -3634 9504 -8757 8464 -4218 4302 5250 5 3988 -6418 -7091 1227 diff --git a/longest-increasing-subsequence/input/102 b/longest-increasing-subsequence/input/102 new file mode 100644 index 0000000..71b5f75 --- /dev/null +++ b/longest-increasing-subsequence/input/102 @@ -0,0 +1,2 @@ +401 +-4831 -5859 -2962 -3606 9195 5457 1328 -9291 -6515 8221 6546 -7321 9829 1822 -9293 4201 -2781 9758 5822 8575 -4381 -7375 4218 -9288 -7313 9037 4207 -353 6737 6903 -5820 6181 -8194 9436 -5932 -6800 -3639 3657 -6465 463 3929 -9933 -6877 -2022 1503 -3316 -2242 -1729 -2050 -846 1284 -7547 -9297 -2279 5103 817 -6991 -5424 9336 6417 -1383 1201 -62 -3703 -5207 -3690 -2320 8352 -3811 -3686 -1451 682 -1465 -7345 1751 5852 -3186 -1244 6485 -6801 -2730 2283 7127 -1283 7830 -6888 -7163 6571 5772 6414 8847 2027 7429 -8219 6149 50 -8018 -793 -9578 4999 -1979 8438 3441 -7176 699 7204 -2107 3956 6309 -5225 -6014 -3729 -9357 3342 -5988 8428 -1179 -7937 8577 -9663 9121 -818 -2461 -3246 7495 93 5464 -6901 8360 -4311 -247 7441 9437 6056 1321 -9174 3246 3241 6973 1130 -6688 -7837 -2066 -2977 6198 3150 -3535 2581 -2478 4397 60 -3289 9699 1088 9634 9336 -7997 -433 -3308 -9884 -2532 -5057 -354 3948 5737 -788 -6900 -3363 5936 -7693 8437 1618 -1444 -3078 -9204 1980 -7826 3988 -4242 2764 6398 -8509 608 3754 7626 4485 -7604 -4727 1353 4908 -8980 4077 -9376 -927 -4985 143 -9554 -5738 8077 837 2542 5860 -8808 -4415 8551 -2570 -9153 3066 -3460 -511 5557 8135 -8532 -5927 -9188 -6130 396 421 4404 775 5594 -5221 -817 9293 7311 -1622 -3830 -4127 3968 -7948 6586 7296 3777 -718 -1193 4248 -5937 -4396 -9560 143 -7707 8948 7599 -4943 3550 6443 -5445 -1445 7962 -7630 -2566 874 -1270 7181 -4348 6466 6484 -3461 -1171 1681 -3655 -1947 -1551 7583 204 -3132 6378 -7897 -2264 5404 4928 4551 -2048 -5046 7744 -9601 -5374 -4076 -7833 5461 2124 8819 -4310 -7334 -7586 -5019 -8235 -7604 5771 -3639 -4394 -1104 6508 -9387 9967 4268 1884 5236 -9402 6113 6011 2562 9806 -4977 6689 -3662 3501 -6683 -2469 7101 -2522 6296 -9287 -1576 8757 2299 -8981 5587 -8774 1468 2844 8646 6500 -7049 1050 -4500 -1328 6222 -6387 -8770 -8067 -7065 -2487 -9357 -3755 -8110 6930 -6058 7829 9722 5600 -7010 -5334 -6041 -105 -6331 -3228 -3948 -9251 -1564 5670 -601 -7941 5675 8290 7400 -6881 7418 1761 4111 2308 6468 -2272 -8628 -5783 -7007 5147 4604 -1848 541 -8287 3662 -505 7545 8690 8946 7232 2925 -9274 -5398 4769 -5870 6411 -7421 -911 3002 5450 -4673 -5890 -9438 -947 -8812 4501 -1310 1159 7115 -5427 7470 7419 -6270 424 diff --git a/longest-increasing-subsequence/input/103 b/longest-increasing-subsequence/input/103 new file mode 100644 index 0000000..fe52a7d --- /dev/null +++ b/longest-increasing-subsequence/input/103 @@ -0,0 +1,2 @@ +968 +-4894 9233 2983 7432 -2681 -2632 1296 -2607 2848 -2443 2026 7118 -5346 -3050 8354 5139 -1820 -5853 -1373 3949 -7324 9968 -7106 -659 -7438 -9999 8500 -2316 -7446 8422 9773 327 9870 -1858 2268 -7794 -3903 9101 9442 -6555 7799 -925 6898 1831 -6396 -5519 3534 799 8245 8197 1407 3942 6811 -4483 -6140 9635 -5788 -2363 8482 -4642 -7137 -2126 6894 2877 -5601 -45 4738 5264 2154 -5693 9618 2314 938 624 -2827 -4557 -80 5203 426 7211 1720 9014 4436 -9066 -901 -1015 7385 7225 9574 -6392 1340 957 -1007 -9181 -9972 -1584 -7179 5439 2114 9723 -6375 -7828 7012 -4347 6458 5888 -5691 -460 230 2197 4956 4410 -3746 -8800 -7559 8790 2417 2667 2597 -5814 9803 4897 8864 7008 2725 2103 -6398 9419 -6696 8104 -2597 507 4196 -5950 5561 9620 -1666 -2788 -20 -6716 -3958 -1196 -2372 3903 -1124 -8006 -8927 5515 -1751 -1338 -8891 -483 500 3980 -8755 4691 -819 -9312 270 1103 -7740 -9227 4962 1661 8395 462 -9331 -5215 -2724 -8777 4299 5458 3294 7371 9118 9503 8496 5699 -8668 8470 -6367 -942 -7982 -619 -9883 1893 3421 8035 8726 5993 -8709 2815 9911 5170 9229 7897 -162 7338 -3561 5763 -4578 9445 -6491 -7567 2201 438 898 -6268 -870 8011 5665 -4485 9057 -6323 7800 -158 9564 1990 5114 -6214 -1142 -8562 -1791 77 5682 -5351 -2600 -716 4387 -5191 9626 -3062 -5341 8438 828 -1140 -2361 2295 -1728 4074 -3675 -5788 -6659 -2033 4280 112 1628 1997 1569 -4778 -314 441 7495 4 6732 -9446 -3543 -1253 7883 7686 -2045 -9776 8183 -7015 -2074 -7019 4064 4439 -2666 -5498 3929 206 -6162 1524 780 -7901 -6505 2823 -7682 3280 -8579 -1531 -6908 5361 8672 -679 1283 6452 -3338 -3850 5990 9420 581 4154 -2452 1051 -8658 129 1950 3172 8959 -6598 7150 5203 9293 -8410 -7061 2864 7269 -5167 6298 -7352 6741 -8630 3281 -1077 5230 1822 -6362 6380 -8834 -8213 -9681 -1699 -7209 -5170 3647 7678 751 1331 -7946 -4366 8984 -2268 -5661 1745 -7481 3363 -1541 -847 -5149 8629 -7169 -4476 68 -402 8016 -9365 534 -9342 2712 374 9419 -7261 1956 -9967 -6572 -1923 6611 -5259 -1749 -2256 -2415 -1853 -6112 -8520 5850 -845 -4328 -1258 8315 -2245 -6087 -9296 4218 8616 3285 -5280 -320 -2261 -1770 -207 2898 9911 -4341 -2125 1443 5128 7687 4079 -4788 -7908 -9536 4715 2869 -8642 3934 4900 -4028 -4302 -7707 2007 -8025 -3825 1733 2401 -5706 5405 13 5814 4846 -867 -1146 -3179 8675 -9103 -2287 1440 5142 -6224 -9058 -6090 -1903 -6807 -4984 -1107 2053 -8015 -6917 3493 4409 -5781 2547 -2751 6648 -9540 8020 4513 -6982 -3797 2186 -976 4479 9862 6195 -3952 -9904 -4156 7191 2936 4624 1206 542 5780 175 9790 2239 4137 6912 -1702 3896 -5678 5543 -3632 1615 8569 103 4866 7466 8067 -6087 -5000 3156 -6065 -6723 -4608 -4433 230 -9689 8512 6859 -305 -3386 9396 -3581 6548 -3665 -3596 5125 6959 425 -6479 2268 -1788 -3182 -5514 5904 6970 9205 990 3300 -8157 4491 -7972 8442 -8940 644 4152 -2920 7153 -7883 -6897 -355 6104 2085 -6311 7532 -2801 -5469 1868 1852 -7564 2500 7037 3524 3199 1057 -848 -2851 5813 -8869 -7920 2263 -1955 -3935 9301 495 3796 -3362 9413 8800 1518 -2551 -8335 5480 4750 -6423 102 147 8713 1151 -7622 9419 1497 -6921 -5902 -9755 5546 3390 -2848 -6097 -3088 1015 8602 8828 3673 1373 -5870 -3593 3302 9853 -7515 -6723 -3555 -2127 -248 -833 -4886 247 6868 -9170 -3724 -725 342 -2021 8440 -1305 -6130 7893 -9074 1443 2833 -6784 105 -3393 -6030 8446 -7430 -6668 -2308 -9034 7407 8416 4252 -5416 -6253 370 -6763 -9092 -4222 -4396 9437 -5441 -3349 -8565 -9215 8088 -5536 8902 8857 5606 320 -4214 2499 -4420 -3139 -987 3985 3665 -1405 -5674 338 -2677 3947 -2889 -7298 -5979 7000 3365 4341 9075 7831 474 -8520 2399 9525 4416 -8441 -5495 -5989 -4721 -8735 -7225 7518 8791 284 -7039 5196 3979 3582 -8449 4135 6082 -2633 -1607 -1628 -1397 1309 -1916 7507 3473 -7345 7257 1237 -3842 -4753 -8289 2555 3861 -1809 -8220 -9154 -9036 -5366 -4313 -5717 -6807 177 -5646 -8215 7428 3046 -8054 5254 -3064 4506 -5341 3089 -1164 7101 7221 6193 8191 351 -4680 -1462 305 7145 -7237 -6386 -3008 2794 -3435 -1555 -7915 -8600 -1275 6028 8322 9209 119 3862 -9790 -9521 6978 -2058 5825 -5191 -1333 4578 1714 5647 -1081 3796 -2660 -6805 -622 -737 -7130 -2906 767 8698 6259 3202 3729 -9339 -1695 5471 249 -1300 7356 3232 4434 -8144 -1711 3731 7278 -5487 9129 9691 8311 -3380 3363 1991 -5094 -8200 4637 -9660 6764 -9235 -7709 -5475 6838 -1317 -1808 -9620 5643 -1629 7655 -4379 6712 -6034 -2340 6295 7796 -2525 -2644 3160 -7720 -6510 -4151 636 2218 6649 -8364 7889 -9026 7105 -4087 -2388 -1672 -9320 6920 -6264 -4420 -2402 -6039 2992 9660 8403 -8931 3249 6448 -1980 -3036 -6081 -7317 4871 -7807 8448 9481 8729 -1188 -130 5237 -5271 1873 -3568 -4226 1033 -6153 1574 4074 -3798 -7976 -2242 4190 4206 6313 4922 -7478 -9219 2859 -1010 8744 -6981 -7601 -315 -6315 4184 -8656 5819 2870 -5332 8347 -4938 9832 4322 -581 846 8983 -9551 -667 -869 -5090 -3929 -7702 -9332 -5969 -3481 4306 8585 -5257 3673 5378 5583 9822 8079 -9519 6116 -4415 -6029 -4710 5878 9051 819 -6522 95 -3189 -8073 2066 3572 -7046 7533 8535 402 -4571 -6696 6731 -1640 -2404 4572 3574 9309 -1896 5442 7114 -328 -8925 177 -1177 -6104 3268 -9786 -845 4157 -816 2359 -8655 -3495 -3629 1944 4602 -1854 6537 6068 1944 2136 2093 -3777 -4208 3603 6808 -6723 6252 -712 -9890 -630 8777 -2295 -3758 3259 -8697 -8744 -1630 8870 2844 8945 5638 -1630 2960 7947 -9222 -4994 -4301 -8125 -7438 6409 -9712 3914 7142 958 -9863 7400 9445 9061 1284 480 diff --git a/longest-increasing-subsequence/input/104 b/longest-increasing-subsequence/input/104 new file mode 100644 index 0000000..36e1c32 --- /dev/null +++ b/longest-increasing-subsequence/input/104 @@ -0,0 +1,2 @@ +4 +8265 9791 4871 -7257 diff --git a/longest-increasing-subsequence/input/105 b/longest-increasing-subsequence/input/105 new file mode 100644 index 0000000..64970dc --- /dev/null +++ b/longest-increasing-subsequence/input/105 @@ -0,0 +1,2 @@ +765 +3642 1291 6626 -5169 2020 4467 -8984 -6425 1793 2398 6542 890 -5741 -9795 -7030 212 5560 -3856 -2868 -6941 -8762 -4640 -1129 8724 -1242 590 -4420 3937 -8297 -7086 2836 1132 -7321 8723 -5239 -1732 4322 -5635 -1913 -752 8646 -5579 -751 -8465 2549 7070 2906 4398 -8794 4074 -5766 8582 1979 6735 6775 -3665 -1858 5061 -172 -5208 6096 -3433 -3259 -2737 -7217 -1644 5033 3423 2834 -6799 -9055 1442 5647 -3813 -2058 -9612 2309 -9775 9055 -4783 -3553 -653 -950 -1810 9328 487 4019 -5662 5041 7711 3732 -4390 6335 -4230 -7988 9561 -8028 -1914 -5308 5783 1770 9654 -5525 8915 -6252 28 -712 1079 3542 1468 3925 -8850 3112 -3010 9886 -9671 5579 9814 9109 -1399 8851 701 9505 -8687 -4217 3236 -7921 7798 4044 4022 -4664 -9191 -2379 1703 6635 -5007 1244 6303 8922 4443 6101 -5111 6198 -8269 -5930 4420 -6035 -5563 -5874 3208 8671 2387 -5723 -2695 -2368 7651 -8792 2257 -3732 -5275 6116 5456 8092 -3942 -7951 4708 1552 31 3349 -1658 -6404 -8930 6511 -7131 1153 2536 -4208 -1397 5161 -3031 3499 -4529 4087 7587 170 -9065 2114 -7599 7845 2197 6559 1180 -8347 -7511 6715 -7532 -8468 -5661 7412 -8287 4583 -7854 -6341 2364 -7707 522 9640 4000 760 -8635 -7366 -1393 -8842 -3605 -3868 8577 9146 -8041 1159 9805 -3686 -9300 7675 3775 -7226 -300 -8059 7309 30 8572 2753 1087 6156 -328 6926 -4996 9148 -2006 -188 -2287 -6880 -8432 -1004 1998 -7798 -3764 -115 5888 5647 6779 -9604 -3763 3341 -5881 320 -8269 -1726 776 6795 7970 9167 2410 8000 1916 2330 5790 5371 9151 690 -202 7239 -4270 -9140 5344 7334 3019 -9770 -3993 6333 5782 27 8099 9823 1904 -4778 7707 -3493 756 -2167 -3998 7825 -1515 6603 -7555 800 764 -1592 -5987 9140 4979 6297 -8613 -6349 2976 9508 -775 9427 -9281 -6880 -4551 4301 4573 -470 7703 6477 -3555 -4558 -1406 -6436 -1427 9387 -9414 6442 110 3131 -5930 -7092 3485 3940 892 4010 -6907 3276 -5486 -495 -581 3927 -1510 -7926 3459 -245 5293 -4429 3853 2844 -4113 -4564 8080 411 -7101 -1656 2425 -2435 9228 3912 4682 -6164 7527 3687 8401 -6794 -4744 1935 -5243 3279 -9717 2365 5227 -3083 7476 8742 5761 -7440 -9601 2763 2500 -6236 -9991 2138 9507 -4289 601 1046 1509 -5070 -6934 8203 -5633 4966 9773 -1701 -5714 1106 2490 7448 2237 -2779 -6569 5715 9361 -4413 6151 3527 1299 -48 9770 -1493 1425 -496 2314 -3716 -4510 1109 5326 -1593 8466 -2270 7117 -5944 976 -7541 2365 -8141 2415 6675 -8428 3560 -8101 -8789 -4238 5086 -9030 1382 6613 837 -7229 2870 -81 -733 -5314 -1248 -1637 53 -3304 2115 8339 -8657 931 176 6088 3527 -3037 7985 5411 -4156 -4985 8265 3107 -2546 1984 -8709 521 7517 -4799 9551 -8379 6549 5615 -700 -6544 -66 -4929 -5914 -1687 1906 -9341 -7630 -6625 3851 -6095 3062 -3130 -2348 2887 9205 -2758 -7162 -599 -7652 -5792 -7257 886 4791 -117 -2733 -999 -1003 -1094 -106 3003 7068 -8673 4024 3186 -789 -4360 2632 6572 8237 9399 1417 -115 4158 -7845 -3845 3955 -9308 -8065 -749 2678 3291 3568 9806 8629 -7265 5768 -376 -7253 -1229 -6917 5755 -9686 -4633 -7412 2491 -1492 -2678 7361 5470 -1607 -9464 3510 1179 8972 -4234 1198 2107 1113 6391 9574 -9400 -967 3405 9071 4187 248 -9098 -6788 7505 -7992 -8570 1093 7255 9910 9115 4630 1304 -3777 3450 3154 4845 -9466 9558 -2178 2598 -3923 6371 9387 -2257 1032 -8814 2770 -8565 8784 -4547 -5116 3058 6439 6058 8502 -5389 -9987 -6539 5551 7645 -7797 -889 6266 5210 -6664 -5975 9695 -7393 -813 -3808 5533 9212 -8365 -7417 794 920 -4390 -6687 3106 -2064 -8506 8186 8842 -2335 8667 -2832 -2990 -6714 295 -8977 8515 8248 1503 -4924 1846 -2973 1872 -8153 -451 9454 2875 -9186 512 4318 -9764 -3960 -2016 -5021 1766 5925 -2397 2543 -797 -1991 -6840 8060 2910 4562 6996 8434 -3631 -7436 -5819 -2515 -8560 6538 8503 3913 -9895 -9369 5377 -4016 6355 4904 6436 -8159 -4082 -8339 -324 5976 -3821 -3537 5278 -4403 -7376 2730 2840 -697 3704 9719 -2332 -8373 4495 -843 -9309 -8612 -4914 8053 -6587 4932 7967 7851 -577 -8733 -6811 -8127 -6608 9920 -8904 6445 -1937 3140 -9198 7514 -436 5694 932 -1525 4466 -1545 667 5196 7329 -8534 -1650 -5982 5204 -7323 9196 -7035 -1974 -1727 9289 -1977 6954 -4374 -1554 -5229 986 -3282 -1290 3500 8732 -8722 1655 3676 -4589 -2847 -2877 -5735 -7286 3107 6841 6866 -2303 -5834 9835 -1206 -6737 -5628 7476 -6734 6382 9057 4761 -7235 -928 929 4504 -2057 diff --git a/longest-increasing-subsequence/input/106 b/longest-increasing-subsequence/input/106 new file mode 100644 index 0000000..b4ff2e7 --- /dev/null +++ b/longest-increasing-subsequence/input/106 @@ -0,0 +1,2 @@ +1000 +-10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 diff --git a/longest-increasing-subsequence/input/107 b/longest-increasing-subsequence/input/107 new file mode 100644 index 0000000..95dbb39 --- /dev/null +++ b/longest-increasing-subsequence/input/107 @@ -0,0 +1,2 @@ +1000 +10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 diff --git a/longest-increasing-subsequence/input/11 b/longest-increasing-subsequence/input/11 new file mode 100644 index 0000000..a0cc0a1 --- /dev/null +++ b/longest-increasing-subsequence/input/11 @@ -0,0 +1,2 @@ +237 +9448 2478 -7248 -2964 -3486 3559 -8375 8544 -444 3164 9166 1574 7081 9912 387 9054 5890 5739 -4691 6592 255 -9797 -7302 -2793 6262 7147 -8577 -6462 1201 642 -7498 -8977 9078 6007 2354 9278 3002 2859 152 -6045 7142 5684 3825 2656 1344 -3366 6751 -531 -218 2225 -3803 -4639 5699 -1807 -7910 -3581 -5734 6130 751 6558 -7190 3830 5404 6607 -3306 8624 736 4330 -616 -9272 -345 -5611 -4161 -7290 -8252 -5491 -1932 953 6830 -890 -9002 -312 -5090 7573 313 1447 6690 -9862 -892 -2020 8322 737 -2986 1294 -3 2950 1351 -7038 722 6330 6605 -973 8028 -5175 605 -2728 8914 4354 4375 -7132 4088 1078 9663 423 6574 2534 -7692 4737 2077 1860 -4117 -5447 4328 245 -9459 4823 -3313 -4934 -3775 -2843 3852 1770 -6040 2759 -831 -8300 -937 5304 917 -6518 -2923 7758 8748 9244 -6929 9089 -5985 -3138 -4851 118 2278 8523 9555 -4027 7485 -9848 8959 1240 -6630 1610 5563 -8496 -8590 -9456 -1067 -2532 189 -4280 -9201 -2257 1148 -3634 -8946 -6909 167 8051 -3398 6177 -7196 -4509 1239 -5938 -1780 -9256 5229 7502 5014 8967 8773 4144 3379 -4238 -7772 -3348 -4865 8543 -6942 -3104 3698 5559 4214 -8584 4620 4982 -1667 9893 -841 -4906 -7169 3328 -500 -4383 -5287 6331 6026 -7087 -573 8028 -4805 -9393 -5370 7608 -8174 7804 -4157 -9018 3899 -9634 4442 6571 7503 -3250 9665 9472 -1480 -7730 4803 diff --git a/longest-increasing-subsequence/input/12 b/longest-increasing-subsequence/input/12 new file mode 100644 index 0000000..1f9bab2 --- /dev/null +++ b/longest-increasing-subsequence/input/12 @@ -0,0 +1,2 @@ +160 +911 -3124 -5644 7997 6625 5512 1970 -1465 -2562 2407 428 -4068 4210 1696 -7391 6247 -9141 6411 4017 7320 1563 -214 3675 3950 5531 -2119 -3082 6544 -1452 -7891 -8092 -8364 9320 1737 -63 1858 2164 -2858 2909 2415 5848 -7156 -1837 5786 5998 6755 -3945 -7922 -3103 -6459 4016 6252 8295 -8443 -2264 6787 -4857 4432 -5090 -4026 6007 -3235 9557 8201 3836 -1356 -7632 -9180 1270 4818 9859 -2204 -1856 7528 8663 7079 2315 6854 -8334 7920 -2262 6636 -7567 8617 -1326 3720 656 7733 -6401 6692 -5458 5102 -8531 9787 -4685 -7700 -4166 -5521 3384 473 -7578 -1894 -8266 -6865 5568 9781 1051 6986 7487 5776 1576 -1582 7588 -1083 -3149 6867 8350 -4621 -974 5194 6196 -1413 -6612 -1929 9660 -9410 4092 8229 9029 1690 3663 22 -866 5832 -7518 9020 -88 9065 -1295 8669 -1607 -929 -2219 -7271 -2021 9326 2559 -548 4002 843 3810 6404 -4997 -9980 -7520 -538 -3426 3550 -271 -388 diff --git a/longest-increasing-subsequence/input/13 b/longest-increasing-subsequence/input/13 new file mode 100644 index 0000000..40af6b2 --- /dev/null +++ b/longest-increasing-subsequence/input/13 @@ -0,0 +1,2 @@ +50 +-1927 1247 -4355 6353 3046 1377 1202 5197 -8381 -6073 789 4104 -5611 -6 -9865 7445 8707 4012 -7218 6788 252 1014 4160 -8181 -7998 656 835 801 9845 -862 1712 -388 6278 4346 4556 7043 8478 1521 -6491 -6417 7350 -771 -8077 -6093 -8984 -2915 9987 8622 7321 5608 diff --git a/longest-increasing-subsequence/input/14 b/longest-increasing-subsequence/input/14 new file mode 100644 index 0000000..19012b2 --- /dev/null +++ b/longest-increasing-subsequence/input/14 @@ -0,0 +1,2 @@ +59 +8244 6710 4389 9300 6129 7497 -3780 2358 -7232 -2620 -8309 -6152 6319 -3311 53 -9143 -7186 -6600 260 4628 6447 -3222 -2936 -9263 -4851 -4089 3582 -9951 -1837 664 -6492 7007 4454 -7564 -2035 2093 4017 3104 -4888 9277 9584 -2068 -8895 -3954 287 -2732 9534 -9799 393 -2815 -7080 -6663 6064 485 -5142 8207 -5816 -976 -8900 diff --git a/longest-increasing-subsequence/input/15 b/longest-increasing-subsequence/input/15 new file mode 100644 index 0000000..7eb3709 --- /dev/null +++ b/longest-increasing-subsequence/input/15 @@ -0,0 +1,2 @@ +52 +3139 -6713 8007 -5926 9279 -5949 -5368 -8748 -718 8238 8158 8780 6784 -1853 8094 560 -5155 -4084 605 7067 -8473 7895 7807 -8824 6693 -1548 -436 -6693 3027 -5309 -7413 7280 2600 -3655 4294 8377 -2084 5293 -9597 6760 1153 801 3877 -1855 -7364 -3210 1002 -874 -8702 -1464 6671 4306 diff --git a/longest-increasing-subsequence/input/16 b/longest-increasing-subsequence/input/16 new file mode 100644 index 0000000..2e3d7a5 --- /dev/null +++ b/longest-increasing-subsequence/input/16 @@ -0,0 +1,2 @@ +242 +-3717 9119 -6775 3573 8246 -4686 4779 8094 9269 4820 5304 2138 1353 -6311 9608 -4691 -7245 5618 -2016 -2209 -7031 3717 6418 -2610 -1620 -5641 4476 8923 -5109 8778 -8511 9292 -2655 3773 3034 -5272 4061 -7508 -2063 -3496 9073 4969 -9374 6830 -7616 2319 6000 4666 -8764 -7475 -1172 8761 1620 8482 8100 4300 493 1836 -7884 1930 -3451 -39 -9775 -7699 -6278 2487 4758 2163 -4668 -3417 5369 -3517 -4176 1501 -2946 -114 6371 -5562 9255 -7964 -3555 3770 5610 -6520 195 898 4995 -4215 3579 -5749 6199 6307 193 -2704 1682 924 -8701 8631 -9816 5922 5347 4920 -9832 5210 1069 -9216 -1102 1680 7268 7351 -4043 -8315 -8116 -2652 5241 6785 6635 9958 7051 4812 -836 -7584 -6458 -5777 2941 -359 4093 2139 7370 1673 -1513 -4579 -7518 3808 -5567 -2558 720 -1815 -2416 9226 -9905 3012 1672 -4447 5915 -3312 3171 5882 5582 -5746 3198 -7878 -1694 146 6958 -2284 173 1713 2371 2151 3734 8851 -4908 5939 -6893 1581 841 2825 -2708 5796 -5115 9191 7969 4438 9499 -2743 2441 6398 3893 5212 -6051 -3616 30 769 8536 8161 -6215 4455 4140 5344 4069 649 813 -3241 -8989 -5116 -341 8350 -4405 3317 2178 -3435 -2609 4645 -1831 -8478 -1240 6312 -4763 1090 -950 -4999 3956 -8174 -5323 -5821 7252 7349 3038 1861 231 -615 897 4705 9392 -9306 -8816 4242 -5796 -5596 -7372 -4012 -8799 -8973 -801 5329 -7210 1686 -5079 -66 -7790 9868 diff --git a/longest-increasing-subsequence/input/17 b/longest-increasing-subsequence/input/17 new file mode 100644 index 0000000..c193817 --- /dev/null +++ b/longest-increasing-subsequence/input/17 @@ -0,0 +1,2 @@ +14 +-8096 883 -8568 9865 -8417 5815 -8044 -8745 2209 7009 3346 7122 -769 -8738 diff --git a/longest-increasing-subsequence/input/18 b/longest-increasing-subsequence/input/18 new file mode 100644 index 0000000..f0d4e43 --- /dev/null +++ b/longest-increasing-subsequence/input/18 @@ -0,0 +1,2 @@ +102 +6188 5118 -216 -7471 -1425 -9321 6678 -2155 -3491 2739 -4528 -2406 4343 3212 -5522 8500 1651 5170 4758 -9279 -1030 9832 1983 -7582 831 -1532 2012 7061 6435 2369 2044 -5655 -3296 4592 9216 2482 8699 -4 630 6976 5847 1877 1456 2203 -73 -3977 3857 1286 -3905 5975 6677 1782 8835 7564 6154 3972 3378 545 9463 4211 -6306 -843 -7744 -3678 -2917 5193 8170 4964 -9095 5784 -9039 -4131 -6042 7477 -6585 -8033 4140 8988 5031 -6008 9387 -5038 -3569 -9761 -3458 9 8792 -2347 -2428 1646 -7978 383 8819 8465 5181 386 4032 5390 1938 -9014 8348 -5461 diff --git a/longest-increasing-subsequence/input/19 b/longest-increasing-subsequence/input/19 new file mode 100644 index 0000000..6a14b31 --- /dev/null +++ b/longest-increasing-subsequence/input/19 @@ -0,0 +1,2 @@ +222 +9713 8170 2831 -6161 7586 -9163 9491 3034 604 6316 6690 -799 2937 -5219 8518 1912 -2952 1571 5250 -8648 9153 4533 -5777 -99 -8385 3272 379 6792 -6782 -1980 -8314 2601 -9685 -8178 -7078 6344 -5042 -5032 7098 8049 80 -1313 -745 -4562 487 9535 1298 -5746 6142 -3730 -381 233 -6003 5680 -9065 -3024 -2912 -4211 9713 6747 5420 -5934 8581 -8780 573 5770 -2161 8221 -913 -4647 -9357 -4622 -776 1238 9220 2912 -8305 6198 -15 -6531 5302 -3890 -5234 -9791 4878 -3264 2519 -1686 5578 690 -2091 6408 -7109 6804 -5108 -8767 8466 2846 6370 -5089 2342 3301 6041 -6534 -2701 1480 -9304 -9292 2890 -9506 -2366 9748 6198 -4324 -6123 -8565 5440 -6033 3588 -1205 -6863 541 3925 -4109 9940 -3910 3528 -4249 -129 4141 -1581 -4166 3909 5221 -9320 -4464 -1690 -562 -5976 4899 -8562 -1719 3328 3903 -3870 -8427 5460 5749 183 -7402 4913 -927 -1485 8645 -5255 4684 8844 -7816 -87 3290 1721 2086 9142 3021 -2247 -425 8209 -9839 -3080 6891 2835 -5076 -3408 4198 8562 -5848 -9140 151 1840 -4618 2627 7301 49 -8886 -8703 -868 9912 -8083 2267 -2612 -8205 9162 -5612 -8566 -3300 -5325 -5367 -2007 -4276 1846 1450 -574 -2456 3432 -1658 7196 -5713 -6869 1084 5398 -7323 -8250 -265 3105 -863 -8097 -7794 -2602 6368 -6974 2085 -7485 diff --git a/longest-increasing-subsequence/input/2 b/longest-increasing-subsequence/input/2 new file mode 100644 index 0000000..6ce70c4 --- /dev/null +++ b/longest-increasing-subsequence/input/2 @@ -0,0 +1,2 @@ +4 +2 3 -1 4 diff --git a/longest-increasing-subsequence/input/20 b/longest-increasing-subsequence/input/20 new file mode 100644 index 0000000..d13e208 --- /dev/null +++ b/longest-increasing-subsequence/input/20 @@ -0,0 +1,2 @@ +99 +-935 1056 93 -1274 -2792 -8278 8779 -614 7537 2831 -5858 7004 -6990 5230 -645 -8649 -8606 -5456 8921 1039 -3577 500 123 -9350 -3882 408 8298 3159 1274 -4074 -4698 9694 3102 -7770 -7703 -8721 8625 3558 3496 3701 301 2009 -9911 923 -7657 -4290 7314 4443 -2227 3937 -8639 3451 -1221 -3982 5882 -5648 -6949 -6545 2688 8304 -1364 -6268 4205 -4924 6265 3973 -8234 6126 -8978 465 -2079 5572 -2305 8777 -567 -2225 1992 2203 -1059 -1577 5845 929 7129 -1297 -991 1532 7255 -9798 -4583 -1121 3742 7843 -3507 4938 -7885 -5686 -8258 2260 -2264 diff --git a/longest-increasing-subsequence/input/21 b/longest-increasing-subsequence/input/21 new file mode 100644 index 0000000..8ff1c8b --- /dev/null +++ b/longest-increasing-subsequence/input/21 @@ -0,0 +1,2 @@ +244 +-6845 8379 -9708 2290 -5883 4955 -1704 1367 -5355 -9978 5122 3220 6014 -9633 -1859 5474 3740 5376 5293 -2211 -6765 -7713 92 2645 5024 6717 -4497 -6096 -9839 -4403 9009 5893 7208 194 -3156 5279 -1833 -7377 2996 4660 -3432 3208 6130 7848 7228 -8373 -7159 -8636 8208 5534 6912 -2918 -4440 -2414 6541 1216 -9132 2524 7245 -2448 -393 -5317 -2108 1260 5420 5450 6970 -4897 662 5644 2733 -5453 -5007 -6298 -627 6727 722 6804 -2621 -5189 7536 -6826 -9072 -3314 -9872 -7662 8584 2443 -2412 7668 406 -7473 -776 -3305 -9363 2247 -6961 -8250 -5603 7011 4315 -4736 1884 -4692 -8709 1102 7840 -7671 -6537 -5737 -3937 9839 -9306 -4722 -7590 9641 8491 -219 8414 6446 4690 -6688 4171 1800 -8810 3994 -8698 -5521 9293 -8048 9738 -8530 8590 4204 -153 -2732 -9075 -8940 -3337 -6957 7481 9692 -6931 -371 -1079 2404 -8545 -4221 -7324 -2852 -1153 -9221 -9159 -4125 2202 -4185 -796 -9442 7074 6902 -5005 -6270 -8981 432 4741 -4523 9520 -8748 7807 -6682 -6178 7440 -6740 -1663 8607 7417 6102 9822 111 -1029 -1099 1795 -8588 -4794 -88 -9624 4883 -9423 -9181 -3128 -659 -4278 -6973 7131 -1402 -3868 -9215 -796 7325 8986 -8894 -8229 755 6354 8659 9393 9625 3921 -6843 9680 -4634 6791 -1185 8403 -976 2243 -9272 -2798 -4048 -7594 8002 -7857 -5098 -6731 5535 9907 -847 1763 2738 -7241 -4143 -2706 -7963 -3690 9912 6255 6752 1098 6623 9432 -4619 -5352 5245 6988 diff --git a/longest-increasing-subsequence/input/22 b/longest-increasing-subsequence/input/22 new file mode 100644 index 0000000..9b3b592 --- /dev/null +++ b/longest-increasing-subsequence/input/22 @@ -0,0 +1,2 @@ +208 +6162 507 -8061 -3367 -4713 5576 -889 -2608 -9983 9896 1989 2680 7211 1486 7064 -9465 -2548 -742 -6902 4836 -3783 -422 -3189 8989 -7 -9567 -3047 2301 5265 7150 -2841 -147 -867 6299 7244 1193 6258 4127 1472 7950 5319 4283 672 -2177 750 -3168 419 -8834 2903 -2225 -2150 1829 2550 439 -7230 6898 -2242 6594 -8262 -8973 -9053 -1575 -3599 -6865 6120 -4704 -28 1511 3859 5851 -6530 3703 6139 -4869 -1295 -1834 8171 9842 5044 319 -4364 4444 8234 -4289 4565 -9438 6465 -5052 -9834 -6631 5025 110 -34 -1726 3721 -9967 -8508 -4850 3788 -4405 -2670 4672 -8323 -7349 5634 -4160 7229 -8152 -4627 -4462 1019 4202 -6136 2208 -9623 3012 2291 -5770 7369 6905 -6443 2212 -1143 -3067 -1565 4327 8262 -394 122 7312 5712 1385 -5241 8331 608 -7688 -4937 3077 -4647 5614 -1006 4546 -3277 -2388 -7013 2685 6796 3750 4252 737 1088 6590 -7145 -2210 252 -3145 7957 -4016 -7275 1928 4106 8285 3926 3947 -3015 -9967 -685 -9716 3809 -3230 9000 -5602 -990 -6688 7644 -7862 4132 -2322 -3984 4606 -852 2316 -6075 8063 3799 -4691 -1062 8247 3312 4449 3829 -3933 3052 -9069 710 1460 3110 -4031 -6184 3912 -6167 3690 -3364 5796 1588 -2264 8712 5347 diff --git a/longest-increasing-subsequence/input/23 b/longest-increasing-subsequence/input/23 new file mode 100644 index 0000000..89ab3b2 --- /dev/null +++ b/longest-increasing-subsequence/input/23 @@ -0,0 +1,2 @@ +101 +3620 -8746 -5050 -876 -6749 87 -4279 6504 -5478 2759 4885 -5139 -4114 -6419 -6327 3604 4822 -59 5390 -544 5716 -6836 -5172 8037 3786 -3663 3978 7339 -7275 9949 -475 -5804 -9011 -203 6192 -4337 7437 -1506 1325 -1652 133 9466 -1266 -7821 1509 5574 7185 2404 -8946 8311 -5192 -4992 -360 3298 8204 969 -5535 -6226 4880 4100 -5305 6187 -5911 2292 -8280 5907 -6170 -8264 2363 4348 5115 9911 5887 -5490 4731 -4006 4022 3467 -4321 3469 -5194 7408 -3910 2162 1202 -6360 3720 4022 -1175 -6971 426 5857 7272 -7521 6216 7655 -1718 9907 1148 -882 9668 diff --git a/longest-increasing-subsequence/input/24 b/longest-increasing-subsequence/input/24 new file mode 100644 index 0000000..69710bd --- /dev/null +++ b/longest-increasing-subsequence/input/24 @@ -0,0 +1,2 @@ +289 +-3065 3458 -686 4196 2302 -9311 -8558 -6004 2677 -1810 9557 1538 1162 -9784 -3969 8465 -8930 -8077 1321 -6245 9233 -963 -8196 1619 -3222 4904 -6962 1142 -1957 537 7868 -8740 -4608 9651 7120 3173 -9784 -9305 2607 7253 -9394 6329 1491 -7624 -2328 5685 -4765 4552 -2283 -5583 -1101 -6883 -936 5467 -7572 7696 7221 3276 -8503 760 -4614 2706 -3474 3416 9935 -6823 -6612 -7584 -1367 9433 -5498 7365 -7816 2508 4791 -5610 -1151 6804 -9928 -3455 7663 6499 3336 7776 -5085 -7457 -6877 8442 -8557 4025 -465 -4499 -505 -6410 3235 3757 -4344 6955 3603 6305 4256 -1033 5675 -2880 8578 -2909 6273 -7755 -7576 -2213 -6766 -6689 -4364 -4652 -8993 9275 2107 2 -8482 9273 -5767 1880 8239 -8924 5009 3180 1274 8595 -2652 -3179 4811 -715 2741 4500 8521 2584 9585 -2865 442 6634 -8084 4090 194 -5112 -4607 -4207 -5431 -8489 -2756 -1286 -6476 -2838 -2926 952 8048 6254 -3308 6828 2140 -1567 5132 -1121 185 -5919 -625 5978 -2499 3194 -8973 -2136 3005 -9087 6800 4827 -2969 2835 6764 -3480 -4123 1112 -7922 -2124 2184 9643 -2061 -2850 -8671 -8408 4143 -4099 8321 -6465 -476 -1104 3293 -861 -882 -4857 -8024 -1069 3211 -1195 -3550 3544 -2928 -6007 -1975 -8170 -4993 8418 -3758 7652 3989 -6198 2842 -4784 5501 1231 -2412 9667 9612 -8945 -3709 4345 -1320 2925 -9488 6653 3224 3226 7045 3580 -3542 -7422 -1850 -284 -8313 -6954 1761 3111 -9812 3505 6260 -22 -8791 8251 -8708 868 6610 5432 -2996 7660 -6634 2602 89 -562 -6609 7293 5959 3990 7433 8457 -6798 -426 -2564 -4265 -9110 -6618 -2884 -1727 -4676 -3032 6310 7155 -7692 -7982 1295 2626 7689 -1984 -3264 5109 8965 -8360 -9144 -7598 -3277 237 2729 diff --git a/longest-increasing-subsequence/input/25 b/longest-increasing-subsequence/input/25 new file mode 100644 index 0000000..19c7486 --- /dev/null +++ b/longest-increasing-subsequence/input/25 @@ -0,0 +1,2 @@ +89 +-8597 4710 9917 -9630 -4457 5773 -2749 -5662 -2083 7334 1789 -1280 8983 -8996 2097 585 -3614 4175 3073 -7440 -2452 6874 6628 4581 8224 8089 1296 2506 4814 -7956 -5542 -2875 -9282 814 1662 -2974 3279 -2621 1103 -8357 1331 -362 2043 -1260 -3307 3225 4836 -244 -6868 8649 -8532 211 -4871 -8862 4478 5795 -1975 -6835 -662 8368 -7782 -3265 3770 9196 -1451 -4399 1625 -868 725 5262 -6057 8919 -4283 4783 2929 -6031 4705 3154 -6630 3343 1995 -1899 361 -2353 686 2123 5136 5961 8518 diff --git a/longest-increasing-subsequence/input/26 b/longest-increasing-subsequence/input/26 new file mode 100644 index 0000000..7f7c8cd --- /dev/null +++ b/longest-increasing-subsequence/input/26 @@ -0,0 +1,2 @@ +223 +-5199 4202 5667 4160 8817 1133 3208 7307 -2418 -8938 -3995 -3905 -3983 2405 -6450 -7684 1474 -315 -6446 -5972 -8192 3099 6343 4963 -6105 -8648 3009 -1016 6333 -9442 6185 7675 1252 -48 8399 541 7548 6903 8266 2119 -6387 3091 8863 8128 8826 -9786 -5875 6748 1605 -6415 4653 4218 -264 -1895 1745 8009 3080 2576 9603 -4719 914 8234 7919 -3457 7976 2293 -9253 1779 5437 4001 6642 2582 7321 6816 8780 -5048 5310 -651 -9196 -1613 -2349 3198 8225 -8499 4424 1905 -4544 -3324 7764 -5542 -7742 6426 -6567 6547 4499 -8260 4292 -4513 -9853 -1180 1846 -9958 -9661 -7473 3200 -6256 8207 3882 -5680 -4302 9544 -6286 6044 4296 7461 -8201 -9794 2047 -7275 -5106 -6654 6780 3239 -2410 8100 7042 8709 -3382 918 -900 547 301 -8377 -1715 3766 3924 -70 5078 -5879 -1165 -327 -1937 4878 7838 9302 -8996 -7055 9476 -8343 -5447 8480 -5078 5733 -2808 -1047 -1035 1075 -2097 -3261 1362 1431 7421 6277 -1719 -2466 1285 -1049 -1351 -4605 -3040 -6997 -6170 3193 5796 2730 8191 1536 -1035 1324 4159 5862 -6068 7751 2683 7748 -868 -9994 -4367 -1568 -4960 6295 8691 -7374 -6734 5443 -3166 1924 -1792 4450 -1442 -536 2463 -9879 4800 2930 5081 5937 -3074 -3278 -7051 -8771 -4562 3291 9073 -8721 -259 -9130 3224 -1547 1932 -8456 -6219 3541 diff --git a/longest-increasing-subsequence/input/27 b/longest-increasing-subsequence/input/27 new file mode 100644 index 0000000..44e0ff0 --- /dev/null +++ b/longest-increasing-subsequence/input/27 @@ -0,0 +1,2 @@ +168 +-4512 8762 -5068 8374 2713 992 -8238 -9049 -99 -4596 -9906 -9241 9007 5782 9778 1288 -2988 -5096 7421 4469 8221 2191 9932 5541 -3340 6504 4625 -5398 6826 8720 -8376 624 2169 -261 -8092 9395 -4815 8262 7446 -4586 4422 8647 2327 -6695 -8704 -3740 -5883 -8813 -2401 2571 8850 -5153 -6713 -1944 6015 -3100 -5687 3703 -561 6069 8208 -2453 2558 -88 -3996 9675 4224 7333 246 6071 7751 -2841 -1000 7383 2926 -9900 4793 7291 6200 2297 -9728 219 -5052 9264 -1977 2697 6928 5825 1318 8735 -6614 -9417 -9906 4583 4973 -3469 -9193 -9004 1199 -5069 -4391 4914 -8436 8852 5692 -7279 -6401 -6991 -925 -7763 -2516 182 1740 2138 -888 5696 -8989 7214 7244 6808 1311 -5031 -6419 9280 -2247 -9850 8080 -4088 -716 4548 -658 -3255 7746 8809 3975 -865 -6860 2240 1539 7409 3561 -2356 9535 -8082 7716 -5615 -6032 -4577 -3772 3862 -733 64 2176 -3108 4551 1078 -2294 1254 3597 7820 5778 5598 8184 -5296 1709 36 3146 5717 diff --git a/longest-increasing-subsequence/input/28 b/longest-increasing-subsequence/input/28 new file mode 100644 index 0000000..6d5d951 --- /dev/null +++ b/longest-increasing-subsequence/input/28 @@ -0,0 +1,2 @@ +3 +1910 -5964 2237 diff --git a/longest-increasing-subsequence/input/29 b/longest-increasing-subsequence/input/29 new file mode 100644 index 0000000..f67f812 --- /dev/null +++ b/longest-increasing-subsequence/input/29 @@ -0,0 +1,2 @@ +204 +-6121 -9133 -6876 -3882 -4695 9924 3435 -6288 -3462 8512 4243 -157 -7057 5521 -9695 3671 9095 5420 -7717 8670 3677 -9961 -505 -3230 -7606 8224 6316 2446 2176 -5320 2631 7861 6085 1100 5058 -8299 -8263 9717 4559 -1249 -5289 4488 9069 8060 7530 2919 -3773 5926 -4408 9936 7212 8843 -4402 3295 -4176 -1799 -6498 -8902 1819 -5212 2328 5646 7053 -5990 -5178 -4929 4333 -9561 8878 6199 -7331 -5648 7722 -5652 1498 9456 4466 1064 4955 1063 -5941 -3756 -7176 -7148 6183 -2783 3680 -2137 -5112 -8676 -6223 5637 -8663 -2592 3819 1670 -1909 -691 -402 7850 1321 -8003 1630 2624 -2051 6937 -4722 2154 -2333 -982 -9422 -66 4461 2591 -8594 4663 8971 3577 -2830 -1225 1857 1403 -1314 -6683 31 1438 6656 -3629 2101 -1357 -5834 2780 -1555 -9911 -3398 996 869 8522 8704 4167 -9210 9540 4048 -5763 -967 6233 -7177 -9808 3246 931 -5874 -1791 6922 867 2454 9998 -9267 -4240 -6742 6255 6 -7556 -7305 1446 -856 -4136 -799 -979 7805 -5472 6556 -7668 7564 9334 3235 6966 2370 -1312 1292 -5538 -1433 1353 6408 -1548 2754 -3920 7354 -8931 -3476 6581 -1170 -3156 -3808 -7102 -7311 7890 8472 -3509 -5482 -1663 -1675 7289 -7616 1895 diff --git a/longest-increasing-subsequence/input/3 b/longest-increasing-subsequence/input/3 new file mode 100644 index 0000000..b261da1 --- /dev/null +++ b/longest-increasing-subsequence/input/3 @@ -0,0 +1,2 @@ +1 +0 diff --git a/longest-increasing-subsequence/input/30 b/longest-increasing-subsequence/input/30 new file mode 100644 index 0000000..8284722 --- /dev/null +++ b/longest-increasing-subsequence/input/30 @@ -0,0 +1,2 @@ +290 +5742 -3259 9120 3648 -1731 -6846 8702 3926 5259 -8874 7749 7823 5463 -8504 -9236 -1790 -930 -1558 5750 9837 6789 -7995 8787 1179 -9047 -5080 2275 -7737 -7342 5627 -2845 -380 -3010 -9063 -2232 994 -7514 6868 4999 2340 -5857 -3329 -6969 8275 -4937 603 -6621 -7803 -8093 9391 -7851 -7353 8162 8042 7001 1450 -9072 -8780 -6144 3129 803 9543 1593 -2305 2044 -4209 9667 194 -6214 -5234 3579 4898 -540 410 -7285 -1316 5147 4857 6458 1645 -4061 1165 8804 -7817 -2918 -1249 -2361 -8022 -92 6613 5158 -7429 1503 -3335 9353 -3298 -8621 9346 -6036 3419 -4051 -8438 8417 6115 5355 5907 -5759 3111 -8754 6454 5342 -2275 9357 -3497 8327 7980 -5077 8382 -7320 5908 8065 3553 -524 -433 4581 3884 -3745 -691 -3397 7715 -5553 1441 6676 2477 -4659 8108 -8526 6576 3064 -6179 -7878 7579 3797 5833 7080 1064 2059 -8633 -166 8126 6496 7032 4307 -6722 2781 -836 3547 6697 4674 -2951 8311 -6033 -4649 803 -5496 -1773 2169 1303 9685 -6977 6267 9786 6587 -9777 9883 -4164 -964 -7311 -8565 6949 -1594 -2897 177 9540 -5301 -6045 -1802 6256 3700 -8730 -8479 1853 4339 -8722 910 -9969 6298 9234 7478 -5972 1585 -1990 7622 -7753 2353 8450 -1118 -2961 -4225 7451 -5274 -7939 4302 8964 9620 -7260 -5594 -8149 4485 338 -9347 4870 1866 6217 1006 2822 7793 -4267 -968 8876 903 1552 2845 -7945 3943 -9641 1550 1055 -170 -9484 4264 -2282 5615 -5909 1580 7987 -4679 -5272 7546 4964 -2818 882 -8705 -2141 6321 -4495 -2314 1885 1428 3987 8412 -98 8579 501 3879 4841 -5871 6815 8865 9858 -6540 3644 -7454 6484 -494 6714 7011 35 6660 -5029 6087 -3005 -7498 -6350 -3757 9444 -6639 -7471 -5405 9742 diff --git a/longest-increasing-subsequence/input/31 b/longest-increasing-subsequence/input/31 new file mode 100644 index 0000000..592ae85 --- /dev/null +++ b/longest-increasing-subsequence/input/31 @@ -0,0 +1,2 @@ +279 +-2254 5553 3822 -300 -6390 6437 -199 4515 -8361 -2654 3614 6215 -7963 -4947 4596 -9193 72 5257 -3087 -2769 3631 1551 -3849 -4962 -1077 6929 3646 -7400 -8786 -4073 7792 9287 2046 -3351 9217 8197 -5857 -6263 3855 2132 3654 3041 -5974 -9661 9198 7873 -6051 -586 -8406 3860 7579 -7250 342 9927 9358 -3775 -4870 -4021 -850 -6821 -253 1102 -6060 -2993 -5801 3421 9998 7696 1832 -5717 -6748 9941 -6328 -5458 9321 -140 -3407 7919 3890 6014 -5848 -7174 7904 -5274 -1774 -8355 -4232 1157 -2261 -6593 -1667 4419 259 5277 -9485 -5856 1857 8191 6109 2483 8128 -3326 5679 -9723 -4630 9656 4832 7522 7418 9621 1427 9244 -6449 3374 -4838 9856 2921 -7321 -44 -4612 -5926 5077 -943 1362 -1542 -7317 7130 -1971 -652 473 -6685 5672 7801 -1034 8255 1447 -4379 -9105 -6167 -9238 -9870 5187 2872 -6276 1438 777 238 -5659 4330 4935 -8559 8060 -8512 6587 4472 -1667 -787 -7742 -5259 4683 72 -7609 -9950 -6013 9658 -1928 -9530 -1977 7330 -7852 -315 -5330 -9277 7648 5550 -6177 -654 3002 7587 -4798 -7572 3611 -5091 61 -6859 1369 -1364 2104 7789 -8317 -1618 3501 3025 -2343 598 -3724 3869 5069 -8776 -2626 -3260 -281 -4471 9084 -1781 9690 4726 -7654 4580 2836 -7744 1729 -1516 -7062 -4434 3410 -6097 -487 5705 -1563 -8091 3800 6401 3949 7747 -8064 -3550 -3245 -9884 -7960 4207 4842 -6354 -8882 -1673 -7622 -77 2540 -8081 -4690 9851 6881 215 8040 -1333 -7536 -1775 -4446 1491 222 -9620 -6017 4013 -1967 706 -4932 -761 6807 7897 -4220 4691 -8338 -6310 9865 3453 -6977 -3031 6672 3703 5330 776 5283 -9346 2028 -8679 7349 -1171 -4932 -4123 diff --git a/longest-increasing-subsequence/input/32 b/longest-increasing-subsequence/input/32 new file mode 100644 index 0000000..c30b4c3 --- /dev/null +++ b/longest-increasing-subsequence/input/32 @@ -0,0 +1,2 @@ +143 +-6200 1039 7698 -7700 -1023 6916 453 4559 -6838 -1462 -5875 -6138 178 -2488 7053 5549 9245 3284 -3160 -4527 4904 -6673 -9272 -3555 1215 3201 -6954 -793 -6644 -6468 3370 8114 1597 2860 8350 -7937 -4530 9482 1158 -349 -9913 -5161 3147 -8266 7260 -2428 8661 -9788 -2231 9050 9887 -4148 8461 -1512 2863 -2656 2632 2981 -6435 -4497 -7487 -6323 3821 -9707 3695 3703 4132 -5256 5997 -6081 -643 5889 -9429 9047 8443 -940 3877 -6770 1081 5051 9838 7416 -2240 3772 5147 -1948 2222 -4649 4904 -4274 -7269 -6757 -2459 -9001 9031 -1588 1378 -222 -65 6632 -6626 -5045 5033 -9438 9302 -730 -3911 -5141 3503 3861 -6323 501 7683 -1863 8488 -8928 1428 5564 9320 4900 -2371 -7449 177 2458 -8249 -1144 -4696 491 -1416 -4435 7337 7228 -3447 -3670 -1994 8099 1235 -646 9089 -2889 7409 3200 4171 diff --git a/longest-increasing-subsequence/input/33 b/longest-increasing-subsequence/input/33 new file mode 100644 index 0000000..d26fa12 --- /dev/null +++ b/longest-increasing-subsequence/input/33 @@ -0,0 +1,2 @@ +189 +-3453 5032 -2342 4260 -7381 -3093 8457 212 300 9728 2536 4390 -4675 -1439 9211 8973 7862 -6712 8986 5375 -708 8355 -9512 6049 -4021 1651 -7592 4015 1326 -4886 -6990 3281 2036 -8012 4134 -6780 -5958 5086 5846 -4796 5275 1175 8628 -4822 6415 -9810 4308 -964 -9673 -8864 9098 1637 7765 -4670 3522 -7424 -1420 9604 -2274 -4744 -6203 8621 3091 -658 -4657 4001 3025 -2263 6632 6017 -4697 5741 -9313 -7263 9592 -3086 2479 1248 4338 -687 -8855 6251 9907 5266 -8506 -6655 7158 4276 5922 -976 2463 -6435 4842 -2129 -9632 4887 6502 3948 -5807 -4680 3679 8302 2390 3994 256 -9538 7173 6663 -6287 -2358 -9520 9895 9955 6944 5512 5979 12 3644 4574 -3187 9427 9123 8988 6938 -2055 7107 1622 6315 -1779 2092 -7860 3972 7632 6292 -5552 7319 6144 3743 521 2175 -5613 -8946 -9363 1406 9146 2224 6666 -3594 -1444 3398 -1259 5795 8350 4744 7992 -9093 9035 -8925 -1008 -2984 6480 -2392 -4000 -3917 7970 2653 2059 2126 7461 2464 7213 3174 -2301 -2411 -1064 6262 -7251 -8010 -1948 -7854 -2008 -4070 350 -3610 -7753 -4804 -9380 6602 8865 diff --git a/longest-increasing-subsequence/input/34 b/longest-increasing-subsequence/input/34 new file mode 100644 index 0000000..21fc561 --- /dev/null +++ b/longest-increasing-subsequence/input/34 @@ -0,0 +1,2 @@ +60 +-8209 813 4298 -6497 -2731 2570 6876 -1129 3730 -1342 -9568 -8787 -6736 3068 -4078 -8913 -527 2278 1732 3831 -2151 7066 1779 6176 3286 1631 -2101 6900 -2200 -207 -8706 -9118 209 -4001 1425 6486 6718 -6553 3654 2766 9370 -5506 3220 -4104 -4411 3636 -9567 -6422 -3456 -6785 6930 -4054 8466 1626 5756 -101 9400 1510 -6795 -877 diff --git a/longest-increasing-subsequence/input/35 b/longest-increasing-subsequence/input/35 new file mode 100644 index 0000000..a75b6c2 --- /dev/null +++ b/longest-increasing-subsequence/input/35 @@ -0,0 +1,2 @@ +226 +-6990 -2370 -3133 -5794 5933 -1811 8958 -4368 7246 7008 3685 -2825 3562 5553 -4018 1941 -8384 -2110 4828 8321 9163 6311 -7485 -8315 -7291 -8816 -544 -8807 3305 5366 -8729 1195 1967 621 388 -4213 -4135 9402 7816 4089 -6326 -5951 9012 9443 294 -5917 9096 -2281 -4572 8512 -6906 3630 6446 3322 -2719 6679 -6208 2576 -2469 9377 6023 3283 -6848 -400 2255 2127 -8972 -5724 3834 9989 -5275 -6137 -640 -7548 6447 2889 -9279 -9346 9211 5623 6572 3394 -9905 5159 4124 -3994 -8584 7578 5550 368 4031 -4141 -2360 -8908 9048 -7095 8394 -8710 -7768 3635 2432 -8296 5683 -8648 -9331 -8103 -8955 -5462 -3601 7225 8149 -2668 -9667 7979 -5383 1221 -2644 6291 1689 1312 3103 -348 -1609 -6676 -4743 1233 947 3281 -3286 9223 3208 -4822 -5538 5599 3677 -6067 4397 7606 5598 -3862 1083 -4836 -2407 -8332 -2146 2148 2005 -6617 7955 2621 -5296 -3088 -4985 7668 7728 787 5494 1360 -1415 7040 4296 8605 -531 6098 -3267 -2637 8789 8475 1724 9155 -6382 1594 -5576 -2211 6640 -9439 -7047 2643 -2107 -8149 -1428 5622 -5660 2926 9124 -2828 -1880 -8860 2553 2599 -9117 381 6773 7366 -8356 4368 6840 -3587 -3433 -8248 -3067 -5926 -8015 9731 -4449 -6890 -8320 -5874 3491 -373 -4086 -2856 -2752 -9101 -2507 -9167 8251 2450 -3419 -1264 414 1048 2177 -8291 9072 3216 diff --git a/longest-increasing-subsequence/input/36 b/longest-increasing-subsequence/input/36 new file mode 100644 index 0000000..d2dd55a --- /dev/null +++ b/longest-increasing-subsequence/input/36 @@ -0,0 +1,2 @@ +64 +1678 -4109 -7532 -4202 5989 -2735 4945 -6599 7313 -6924 4947 -6346 -5339 1645 -8504 -9412 1564 4991 -8976 8476 5909 7883 -7020 2577 -6157 -9880 7919 -2593 2442 9949 -9924 -2367 -2619 -6197 -5767 -725 3832 -2298 6670 4443 4189 -5498 3700 -3261 -4653 6809 3944 390 -5640 5323 8327 -3999 3974 -971 -7406 -5128 -9609 -2798 9686 6800 4789 -9555 -8296 6290 diff --git a/longest-increasing-subsequence/input/37 b/longest-increasing-subsequence/input/37 new file mode 100644 index 0000000..27a8c81 --- /dev/null +++ b/longest-increasing-subsequence/input/37 @@ -0,0 +1,2 @@ +187 +-6312 9724 -5644 4923 1721 7329 1410 2794 -9897 9140 -6062 -4622 -5132 6190 9509 1972 2274 1160 -5738 -9945 2620 7735 9663 -6634 9089 -2013 5646 7987 5766 -3419 3298 -3095 -164 -2977 8262 2897 3753 -8291 -1553 -1752 -819 -9185 -7621 -4125 -2116 4699 -1819 -272 9637 -673 -9498 8476 4812 -6905 -7820 6303 -7169 -3151 -4300 3285 -7706 -1728 -6931 3948 -227 -5740 -2142 2722 2136 3577 -898 2370 -7550 -9802 -4914 -4395 -8006 5295 2960 -6544 -4849 -318 -2242 2456 5311 9406 2688 -6860 -7013 -7706 -5451 1778 -5526 -2021 -5263 -9078 456 8285 -9994 1748 7710 -2161 -2763 -5088 8294 5790 -3185 -4600 3112 -8115 -3014 -534 703 3045 -4166 5104 7797 -7176 4741 6621 7503 -8643 6293 288 7128 5681 -5408 -4138 5285 6005 3212 -7008 -6984 -7772 921 -3494 633 -4448 8040 -698 7031 8691 -7186 4780 1158 -7041 -9829 1399 1764 278 -360 -9444 -1734 6146 -162 150 4829 -4929 -8788 8871 9452 3416 96 -7131 1141 4220 -8096 -4517 -1666 7505 9165 6178 -2792 -9251 8825 2300 7180 6536 436 -8984 8532 -4178 2378 -7668 511 -9043 -3505 diff --git a/longest-increasing-subsequence/input/38 b/longest-increasing-subsequence/input/38 new file mode 100644 index 0000000..815ecc1 --- /dev/null +++ b/longest-increasing-subsequence/input/38 @@ -0,0 +1,2 @@ +328 +-5181 -189 7665 2316 -5190 -6731 -8868 1786 -7663 1941 -4477 8090 -973 -9570 -9707 3663 1648 -9433 -2661 7766 -4929 -4707 -965 8426 -6255 -1996 1973 2614 7480 2061 -8103 -2874 5491 6981 -4330 -8195 1063 -8003 -609 8241 4665 1455 -712 959 7024 -2747 -1703 -5571 4139 -2162 1687 9623 -7724 5342 2981 5820 6241 -6163 3016 -1967 9040 -435 5616 -1493 -1530 9105 2527 -3019 -7643 -9993 6225 3948 7637 -497 -6626 2460 -7858 -4417 -6576 8094 -5936 1923 -1682 -6942 76 -3137 1274 6065 7399 -7162 -8163 -3040 1893 3572 -8048 103 -4274 9334 -1708 7966 2993 -8472 7276 3650 -9882 -7655 -4177 -3045 -6958 5018 7509 1946 2688 -4735 -3644 6662 9627 6318 9204 -9354 2263 -5073 -8370 -1434 -5801 8906 -4433 -9965 8921 15 8190 -9616 -8836 -700 6906 536 5047 -963 -9584 -819 1277 7384 -8834 5844 8209 -7282 -1648 9732 3821 -5334 6993 9336 -2238 1904 -6030 738 81 2631 -7786 8459 6392 -1591 2953 5261 -1943 1154 5330 3498 3873 1036 677 9996 -1 6661 -1921 -150 8173 -2415 -9036 1501 -9354 2558 -8536 -78 -6999 -607 5066 -8311 3873 276 3589 3556 -641 3297 4017 -4588 819 5232 4308 9393 9747 -9513 2392 9927 -926 6902 -3706 425 -4760 4559 2086 -554 -2444 -7515 708 5027 1706 -2799 -2957 4971 -3278 -2070 4019 -9020 9616 -3228 5658 584 -1798 -31 815 7441 -5205 6082 -3154 -6506 2003 -4085 372 5742 3001 415 -7234 8933 -782 4264 6045 5157 -2245 5117 6996 9054 -2912 8639 -7839 -9318 1858 -4759 416 -2765 1515 6744 3217 -4224 4097 -5932 -4584 4122 7174 -1178 6969 9807 9413 8923 474 -4477 1294 -9362 -8796 534 -9580 -6310 8632 -5460 3051 -2807 305 5591 -7181 -4372 2136 -4963 -8609 -6687 109 -1896 -6683 -6891 -2783 3576 -6774 8954 3704 4967 116 7840 6738 -100 5822 9018 -1582 7179 -1828 3963 -7919 9820 -43 3661 6310 -1923 6092 7279 2512 3336 2792 -6381 -4269 -5103 diff --git a/longest-increasing-subsequence/input/39 b/longest-increasing-subsequence/input/39 new file mode 100644 index 0000000..7ac5b63 --- /dev/null +++ b/longest-increasing-subsequence/input/39 @@ -0,0 +1,2 @@ +495 +-2681 8339 -672 -9038 577 5167 -9262 -7414 9539 -1686 -5945 749 -7147 319 7597 -9537 1758 -3491 -4637 -6441 -8497 -6493 3149 -704 -2872 5202 -5269 8850 -7726 -5548 7137 -1014 -8538 -6172 3272 378 1092 -8750 7507 -8643 3354 6627 -1157 6338 9859 2345 7835 772 9913 -8111 -4250 8324 -7926 -2253 8801 -1926 378 3926 -9835 5645 -7823 2136 -7680 -1678 -1468 867 -8595 1148 -5583 -185 8321 6043 3482 3511 9312 -778 -2263 -412 5480 7544 -4047 -777 -3604 9312 -7576 -7210 8784 9737 -481 2528 6670 8901 -1290 4747 9171 -8908 2625 -376 4048 3698 -7644 8901 2125 -8033 -1063 2619 -1007 7016 -9922 7405 8136 3900 -2687 3570 -4526 -3143 5160 -1818 2713 -2314 -4093 7000 -2902 -1602 4778 1303 4707 999 1208 761 -4613 -4649 -4640 -7458 -6173 -1680 1216 -2343 -3444 8285 9588 5943 2921 4776 5199 -4832 -5504 5834 -7375 -2569 -6273 2676 7422 4834 -2300 -8292 2628 -4592 8411 -3498 2111 6477 6084 3719 3062 830 7353 2709 3130 -3759 -1948 4398 -665 8850 -4161 3710 -7052 7212 4287 -6812 -7592 -9691 3052 3779 -2654 -2770 -1201 5260 -6756 536 7055 9535 -9556 -5375 -5212 2546 -2996 -6696 2908 9247 1515 5161 4595 7237 1940 6915 1981 9385 1934 5850 -672 420 7597 -1368 -5608 -3917 -2419 7838 6472 6109 7684 -2564 3016 -659 6287 1892 4789 -8046 -5080 2154 6766 2345 5596 -2267 5256 -7451 -6437 7298 1865 3846 2846 3674 -4680 2956 -2960 9159 -9601 -1383 -6830 1109 3170 9445 -2284 8359 8993 2449 8519 2553 -1379 -9643 4598 -2244 853 -6937 -4046 980 -557 -5207 7190 -7110 7954 7381 -1171 9543 -631 -6353 -5455 -4845 2475 2700 -498 2642 61 6482 6758 7914 -2664 6506 -5401 4514 -8735 1720 -1546 1999 -5029 2315 -2839 7326 -7278 7572 197 3039 9140 -9280 -8805 -2933 1479 6140 -5750 6837 -8411 4218 -842 -7352 -2059 -2794 -2123 5499 -900 5607 6295 3258 -6907 6111 -8313 -3558 -9503 2393 6757 -8164 -6830 1632 2400 -1679 -8033 3547 -3398 3895 -2946 -7182 4939 6577 4631 -4993 7387 -718 282 8747 5449 -2337 -2333 -4977 9752 -7614 -96 -713 -8628 1999 -917 3269 2405 -7992 -6716 -4573 9632 4896 -4872 -1455 -8190 8599 9530 7947 -2500 -3930 2305 6918 6400 6567 7071 494 247 2784 6309 3442 -2456 2403 7004 -513 -7885 -4980 -9891 5843 -5320 -168 -880 -6238 7024 -2627 2276 -3359 -3720 -3085 1674 -1466 -581 -7629 8466 -3416 1369 2962 -3743 1587 8772 2838 3357 2743 -6975 4766 5854 5062 5985 2636 2909 9140 -356 -9196 -9884 -9263 -8188 -7425 6525 5149 -5046 8757 -8794 -1997 -5973 -3922 -8064 -9676 5326 -830 -8495 -5459 7572 -6144 2502 -2253 8624 2331 2967 9413 1788 8169 -9069 -1317 2631 8912 4676 -4940 -7421 -5631 8334 -6983 2961 8734 9119 -5558 7248 -7400 -2189 1898 8016 9621 9538 3452 -7789 -109 -9348 -4900 859 5141 -3145 1362 -7962 -8508 2303 -2630 3817 46 5392 -4564 9900 3731 8625 diff --git a/longest-increasing-subsequence/input/4 b/longest-increasing-subsequence/input/4 new file mode 100644 index 0000000..f9d9126 --- /dev/null +++ b/longest-increasing-subsequence/input/4 @@ -0,0 +1,2 @@ +4 +-10000 -10000 -10000 -10000 diff --git a/longest-increasing-subsequence/input/40 b/longest-increasing-subsequence/input/40 new file mode 100644 index 0000000..7f315a6 --- /dev/null +++ b/longest-increasing-subsequence/input/40 @@ -0,0 +1,2 @@ +138 +-3463 -8854 5279 5758 -9459 7610 9630 -7617 -4023 -2518 -4187 -7918 2668 -8127 62 -9610 9408 -573 2278 6584 -5336 4258 -6002 -9243 -2821 2758 -301 6771 2743 -8077 -2137 -5486 -5373 -6931 -7623 2452 -6276 -3952 -3668 -1986 9606 -9924 5136 3731 -8064 -1643 -830 -209 5562 2578 -3815 -2560 -7766 -8673 -999 -103 2547 3886 -7766 -8141 -7672 4418 4474 3822 -9877 7605 -7835 5926 -7870 -4574 7358 -8523 9242 9298 9659 -6565 -8685 -5685 9089 -9923 8148 -7628 6847 3216 -2454 -733 3038 -4506 8256 902 -8971 -6444 -4400 -8898 5704 -5677 4308 -9576 4872 -6050 2539 -5279 -1838 8915 8618 3343 -4141 1294 -9448 9515 -2003 6167 -1935 -5262 -3608 -3737 470 7193 3342 -9552 -5020 -3879 -2808 6517 -2569 -9620 -1878 -6061 2384 -2085 -2460 -8905 -3541 1011 4368 -2223 -8058 5465 diff --git a/longest-increasing-subsequence/input/41 b/longest-increasing-subsequence/input/41 new file mode 100644 index 0000000..804b538 --- /dev/null +++ b/longest-increasing-subsequence/input/41 @@ -0,0 +1,2 @@ +319 +-1542 1227 -4306 3110 -1541 -515 4907 -5521 5995 8584 -5986 -2702 -9690 -9343 -7437 3417 5679 9447 3067 271 4296 -7855 -6586 -7449 6464 -6563 8595 -6052 9765 8906 9933 -1412 -8150 -7449 5538 4245 -6408 -1192 -8645 1056 1805 1885 8797 5905 -9283 -5382 -3039 2240 -8728 9430 -235 -6893 -6411 -4069 -5841 773 8602 1967 -8231 1082 1076 6282 1904 7813 1748 -5482 -8362 -4816 -7687 2166 -2271 -3173 6232 -5203 -5026 2782 1171 -6073 7232 -3127 6891 6696 -6255 2885 -8065 848 9252 83 8509 -543 3369 -8869 1592 2640 -9705 -9905 -8674 -4278 -5654 6181 -9762 -4968 -4282 656 6815 -1986 7260 -6132 -5736 7161 -1173 -8579 7063 6979 -6130 -896 1074 247 8703 5433 2835 4272 250 -4018 7321 7085 -5492 -4478 6923 -4745 -824 -4507 -7967 5388 3883 -3725 -9918 -4304 3005 -8675 8035 -2273 6128 8264 -3378 1423 6862 6793 4310 5968 -1294 -1506 -1625 -7 3926 -1799 -9988 7427 -8723 946 -6003 8925 -1239 4752 -1344 -7930 -8996 -4292 4357 578 -9241 -7003 4588 7562 -203 3151 6146 1541 2493 -8934 -2360 4283 -9557 3080 -4434 -9389 2970 4876 6379 -2273 -5744 1317 -7883 4840 3665 -2782 2559 -4378 -4190 2820 8044 2004 9452 7312 -4325 -7515 -2167 -4555 -1061 3320 -1578 -2973 2791 6235 -9988 7773 -2856 4957 5835 4568 5685 -1154 9138 -712 849 699 575 7555 -379 -8352 2703 4479 -4009 -6880 2889 1144 -3696 125 -4941 9893 -5192 -2638 -7419 6111 -166 -705 -9269 1517 1822 -5954 6418 6761 9100 2191 -5860 1361 3607 326 -5628 -9318 1328 -5606 9571 -9048 -5662 7775 8334 9540 7288 2168 -3210 5769 -3848 7508 4795 5448 5109 -2718 1290 9765 6285 3192 -6213 -8463 -5469 8821 3395 4341 9266 372 -2076 -5775 -506 5215 -9745 3320 -211 4739 -5164 -1243 6834 686 -2865 815 -9098 1809 -9874 -198 2345 -1185 5136 7447 -8942 -722 7148 1960 2656 6776 3679 diff --git a/longest-increasing-subsequence/input/42 b/longest-increasing-subsequence/input/42 new file mode 100644 index 0000000..b2de54a --- /dev/null +++ b/longest-increasing-subsequence/input/42 @@ -0,0 +1,2 @@ +480 +7143 -8400 -7273 -8996 2129 -9724 -4779 -4649 -5248 -7302 -8028 -5510 -9469 -687 5051 1275 4691 2414 8703 1959 3140 5912 2486 5053 -8501 8354 -5624 -8353 -6520 -5774 7874 -4816 -267 -7082 9364 3741 -1413 -3364 6152 9203 -4032 -1778 -5217 5821 -1881 2547 20 -5966 -8127 -8944 -9863 -1485 -7326 -5234 5084 369 1646 3745 1100 7223 -3352 3587 3950 4642 -9386 -6623 6108 3022 -3323 -7973 6748 -6461 1370 2012 -2067 1707 9600 -6536 2327 6666 -9559 840 -1878 1702 -7725 1022 4039 -2777 2048 6263 -3749 7683 -2644 859 -8540 255 8850 -4932 -1864 -4832 -2603 2905 2738 1252 -8249 9365 7325 -7032 7311 -2608 -6910 2124 -4390 7273 670 -2677 -2683 2619 1479 -9270 9562 -601 -7669 8079 -8406 5392 7622 3842 -1747 -6780 6325 -2424 -7185 -6728 -9281 4965 9641 2675 8113 5033 -6533 1565 2568 -7693 9726 -3645 3645 -6701 -5678 -6410 -2963 -6805 7809 7568 -1222 7357 1471 4536 -8050 1679 7993 -2453 3700 8601 3902 8331 8040 4342 -3186 -9474 -461 -4435 6092 -7870 667 -4215 2639 -7064 -1550 -9839 7854 -955 9969 1313 5248 -3874 1205 -7197 7896 -5830 5611 9234 -2609 -8426 -9085 6067 -5695 7235 7708 1105 2693 -7012 7169 797 8420 5072 9595 1479 4052 -2259 6081 1451 698 691 4866 4097 1935 3666 -9398 3596 5596 9003 8694 6305 2233 -1197 2409 -8864 4251 8699 -5104 3847 -297 -8332 3804 -4349 2797 -2749 7286 -8912 1275 -3462 1126 -5913 7254 -2038 -6043 -1647 6105 6910 2228 -7841 -6211 -3375 5320 188 -7448 8054 6155 8241 7060 -3394 -245 2282 7394 1494 8328 8276 1979 900 -3816 -9961 -5748 3794 -3398 2753 -8193 9592 -4141 953 5885 -7417 2831 -9187 -2198 -3922 5801 -1799 -4280 2185 -7614 7524 3819 -8296 5172 139 -2080 6773 -7567 3996 -2253 9310 -3212 -2344 7304 8084 -1873 -3064 -4085 2009 246 3957 2653 1547 -8358 -7710 -1158 -1547 -8485 -9260 -4338 -6559 -4158 6207 9300 -7676 892 -929 4915 3567 -2351 -7303 -4165 3049 1847 -4054 -2454 -1761 3158 2984 -4820 6165 1255 8839 7628 -2367 -1523 2397 6881 -553 -2707 -8049 -6611 1102 -202 -1299 -4968 7968 -2054 886 1298 5770 2288 2709 -7722 -6901 -4137 -6646 -8542 -7893 2971 -3420 9858 7161 4837 7151 -9583 -6987 8719 4760 3093 3183 2375 7671 -3790 -1633 4792 3521 -4603 8496 3605 -8967 -5304 -2536 -692 -4062 -3919 7300 7325 -5668 9067 1140 -7581 -9273 3598 5424 -6369 5826 6076 -335 472 -446 -5177 -3875 3329 7284 -904 2454 -5383 -3045 9324 -7884 4551 7635 1562 6081 -7330 8358 -3365 9199 -2931 -6866 -8286 -2933 200 -2834 1181 -211 2851 2485 6930 -8291 2279 6228 -2677 -4868 3517 4466 -5208 57 9939 3859 3238 2966 592 9722 7472 -7133 8775 -6057 6151 -2573 9631 3038 -7332 7803 -8409 4957 4717 -5842 147 1200 6956 -8734 3910 9913 -3262 9828 8635 4818 diff --git a/longest-increasing-subsequence/input/43 b/longest-increasing-subsequence/input/43 new file mode 100644 index 0000000..c181a07 --- /dev/null +++ b/longest-increasing-subsequence/input/43 @@ -0,0 +1,2 @@ +440 +2143 4341 -5108 967 5106 9200 5913 8264 -8609 8939 -3703 4583 9360 174 -1525 8694 3164 -7551 337 3097 1346 2380 1863 -7822 5445 -6943 -8655 4828 9093 -4058 -9176 -2617 6429 3893 1589 -331 5398 -3464 7653 4517 -2227 -2257 8960 -8668 -3261 -9282 9126 1860 -6069 5123 2281 395 -8237 -2417 1964 2609 5242 4768 -7611 -7985 -4884 -3649 2948 -4125 7845 2843 1534 -1095 9060 -6746 -5392 9702 -8247 3253 -4766 -9995 7378 -6615 4559 2122 1320 -3454 8303 4612 7804 8152 6719 -2361 -2662 755 4524 -1112 6311 -8137 -1957 5300 8087 -2648 8354 5190 -3413 -7339 6552 2698 -878 -8693 -5482 -781 -5171 9122 2370 -9386 791 -2157 -3909 -5479 -5395 -4578 -5807 9708 2286 -9038 -8192 6095 -8994 1409 4967 655 -8922 768 -546 1550 6257 -1819 -7507 8265 -9057 -8182 -3281 7295 6573 1006 2816 -1989 7966 3139 8292 4730 6709 2100 -3020 1545 7866 -9551 3061 -2427 2032 -8194 -2959 2160 7530 -7525 5308 -8166 586 -1032 9122 -3356 6166 6985 -2026 632 -2560 -1612 -8452 609 5469 4160 8256 -9984 4763 -75 -1558 -2909 6247 6964 -6606 5622 -5246 -2538 5111 -7308 -5857 -8068 8851 8665 3548 9153 1004 -6501 -8860 5930 4539 2034 3217 8709 1318 -7315 4017 7146 9773 8322 7057 7159 -9244 834 7114 5971 -6037 6394 -8871 -3670 7318 -1271 -336 -3268 6973 3811 -6682 -2684 -87 -5972 -2584 -4531 -6073 -5810 -6175 9499 1322 13 -7583 9942 361 5368 1423 660 50 -1281 7085 -7652 -8720 1814 9338 -3425 -7712 -17 6582 9025 8605 -8010 1108 4375 6590 5302 8327 -961 -2634 1227 859 4294 -8169 -5159 6275 -9830 -129 4264 3244 985 -9624 8622 -9362 9991 -9580 1675 -966 -8175 -3422 -7096 5524 -401 5493 -378 -372 -7718 -8095 -6837 -2244 4838 2305 -2463 5945 -2077 -8024 5071 1332 -954 -8946 -1002 867 -4880 -6327 -7547 7156 2552 -4041 2943 -5205 -3302 1251 -3909 -9002 -7198 8984 -8158 4954 2090 -9056 -7761 4342 -6310 -2450 9695 7442 4681 2183 -3102 6871 -6710 -3931 -7810 -3224 -3295 -5897 9063 8741 8231 -670 -5000 7492 -5807 9097 2067 -1245 1888 -3433 -3556 9932 83 1669 -3396 5934 -6798 4584 1539 -9827 2652 2551 5019 3334 -4915 -3012 -8606 6864 -3557 3423 -77 7503 4319 5120 8419 -7620 -8954 2033 2927 4221 7194 147 8863 -505 -6711 5493 -6465 2216 4066 -6766 -1428 1058 -9111 -5132 3420 9252 2913 -2624 -4480 8331 8327 -6994 -3447 6369 -2411 -9130 7884 8221 4288 -4297 7057 -2645 7330 4429 940 3114 -4024 7968 9290 5947 5474 4188 3242 7643 2836 -4835 8972 8258 4489 -8 9730 5992 352 -5310 -4987 diff --git a/longest-increasing-subsequence/input/44 b/longest-increasing-subsequence/input/44 new file mode 100644 index 0000000..e2fd51b --- /dev/null +++ b/longest-increasing-subsequence/input/44 @@ -0,0 +1,2 @@ +280 +1159 6110 -8440 -6957 3677 6473 2630 6385 -6326 -6642 7929 -6667 -1522 -5469 4237 -6756 3451 4291 6293 4272 9453 -7557 -7888 6553 -5732 8185 -8396 -6257 1049 -9228 8805 3232 9759 -6948 1994 7544 -9477 8994 8507 5634 6247 -3533 5665 -1477 -9979 7452 9288 2574 -1299 7233 -9028 8190 -1938 -7569 -8561 3086 -6126 444 -9072 -3610 -7848 8182 -7767 5719 1421 1395 1188 -1934 5064 2367 1949 2827 -3393 -6528 6713 4435 -4724 4727 1858 -6627 7916 9556 -1556 -5014 -4103 -5592 7490 -4729 -5988 8710 -4432 -1667 -2784 -9307 -9310 74 -6365 2892 -9029 -5548 -3056 9262 4575 2694 1233 2780 3211 -1189 -4310 -2145 -4905 6997 1032 9303 -8967 -5539 6195 -8984 4134 -8727 -4207 -2330 9156 -3299 -7864 -3868 -8780 4495 -4948 8894 2666 -8340 9451 -9776 -7838 -2444 9708 343 7307 -3961 -9536 1937 -6328 9626 -7524 -8969 -9446 -7860 3536 -3590 137 -2384 2583 -7462 7091 6642 2765 7624 -120 -1873 8701 1035 415 3921 -4600 2033 -9930 9910 8098 -4496 7854 2587 -7666 -7986 4370 -7084 -2353 -2743 8704 1874 1732 5769 -1710 -5372 6147 -4732 -2671 6304 -7188 4377 1179 -8912 -7966 1115 8539 944 -7968 5394 -172 8427 6436 7897 -4199 -3761 5458 782 -7885 4650 3212 -5114 -5213 -6521 1894 -5491 5375 -4224 -3393 3449 -3979 -5028 -4627 -3368 -3667 7052 3910 2199 4751 -3469 -1734 -5640 6809 -5642 479 -9773 -1733 -1319 7739 -5840 9796 -8062 1684 3449 2430 5512 1812 -8683 3791 -2842 5419 6163 6393 9204 -9568 -6186 1276 -2505 1999 -4790 -8338 9728 -4457 -9230 -5379 2943 9319 -44 9399 1341 -9920 5320 -3754 3605 8263 -4355 -2463 -5596 9432 7238 -5328 -2329 diff --git a/longest-increasing-subsequence/input/45 b/longest-increasing-subsequence/input/45 new file mode 100644 index 0000000..48d726b --- /dev/null +++ b/longest-increasing-subsequence/input/45 @@ -0,0 +1,2 @@ +199 +-3662 -730 -6792 -7425 910 6872 -8581 5426 1412 -2543 7490 9492 -2114 -8696 3741 -1432 -4585 -958 4456 7779 -942 -9036 -4059 3091 -7881 9350 -3299 3440 -1175 8624 -5607 -2242 -3867 -9593 7242 -7288 2404 4609 -7233 40 -3376 3336 -4361 -6196 9882 -9087 2340 5587 -8897 -2480 -5825 2728 -4175 -5418 -4669 -3628 -8586 8999 -2825 1193 -8771 4609 -3073 -9973 -3693 -4871 5865 1695 9122 -3065 -5520 9802 -7024 684 4944 3031 7577 -4635 3969 -4355 6920 -5637 5249 4282 7229 9123 4429 3542 -1271 9313 6440 -7780 -4738 5515 -5029 8752 -3753 2428 121 4107 -6578 -8842 -4976 2943 1763 -1184 -8716 9498 8161 -280 -3491 1018 6958 -7502 7597 7720 6674 7221 -5947 6098 9332 4268 6906 274 3408 1318 -5893 -7174 -406 -382 6469 1717 5445 -272 7565 6519 5203 2850 3232 -4979 3605 8139 587 -7014 -9833 2686 -8448 8078 4029 -3275 1769 -5611 1598 7419 8364 -9981 -2041 -3029 -3189 -3403 -1986 9114 1338 7031 -4083 1932 3039 -4944 1184 -6693 8281 7060 3652 -2930 2779 -5085 3321 -9966 -1270 -4599 -8674 3437 -4570 3160 5248 -3226 4085 -8748 -5175 6648 -988 -848 -4962 5812 1595 5716 -6107 1078 9394 diff --git a/longest-increasing-subsequence/input/46 b/longest-increasing-subsequence/input/46 new file mode 100644 index 0000000..e5d9eca --- /dev/null +++ b/longest-increasing-subsequence/input/46 @@ -0,0 +1,2 @@ +91 +4024 -2690 8578 2748 4894 -6226 3080 -9554 -9936 -2750 -9584 776 5165 3135 8606 -4366 -4664 901 2040 1299 -8033 2578 -4474 8624 7342 8454 -1658 352 -5498 9773 -8499 4393 1472 3424 -452 -6149 368 -1793 -5412 4907 -6053 3405 1587 5750 -2642 -9952 5096 -4571 -5046 -6797 -8998 3148 8796 -1904 -9409 9335 -290 -7741 -9769 -129 -279 -6837 4392 3049 1957 -1186 5315 7720 -5481 -2404 -4072 -7861 -8721 -4419 -8733 -9195 -8742 5124 2488 3514 -6498 5232 579 -4934 -977 -6199 -6825 -3427 899 -8116 6138 diff --git a/longest-increasing-subsequence/input/47 b/longest-increasing-subsequence/input/47 new file mode 100644 index 0000000..f43c663 --- /dev/null +++ b/longest-increasing-subsequence/input/47 @@ -0,0 +1,2 @@ +306 +-3878 9998 -5417 -6314 9093 -2530 485 -9860 -9638 8283 6044 1860 -3994 4972 2502 -5159 -4503 8603 -9269 1709 -8461 2929 -7748 -8708 -547 556 -9203 6547 6813 9229 3292 -2681 8629 9194 -6377 7703 8089 -1145 5746 2671 -5677 -7267 1447 -7502 1494 -3452 3495 -3504 4127 5852 642 4955 -9399 -3158 -5469 -8123 -2108 9201 -112 -4087 -4459 9860 -4634 7891 9202 4357 4238 2873 -7009 3275 -4751 -9684 -2551 548 -6373 -5191 -5129 8381 4172 5304 -5952 7675 4365 3856 -6177 -6581 3936 -7087 -5667 -3937 9677 6259 5769 -8357 8711 -1037 8168 -9889 -1249 -5373 3221 4984 2087 8262 -7963 114 4874 -1307 9353 -2567 -7372 -8056 1408 6624 8706 -9064 -492 -7560 -7476 -6845 1119 -9704 1948 -6909 -4558 -7694 -5937 5903 8378 7149 3275 -5115 -7228 3996 9361 -7772 2661 3717 5394 2887 7978 5018 -8070 166 -694 9091 2333 -1635 -1467 4910 -7489 499 -3613 -3306 -9410 -5396 8457 -6762 3029 8990 6948 5110 6662 1308 -8361 8584 -1000 -3249 -3564 5394 -7787 -1370 8793 -565 -9453 5977 287 -8672 5225 -612 1437 -8204 1833 -2700 -3438 6138 -3946 6092 9033 -87 -1526 -4032 5256 5669 -8229 3864 -6543 -5883 5744 -4933 3393 5685 7265 -5527 -6462 9046 643 8725 1593 -5367 5933 8551 6354 1154 -9751 1303 6040 9060 -4692 5080 -3793 -4897 -1907 -5520 -510 2856 -6576 165 -6047 -6576 2325 4588 8040 6327 -3544 7618 8482 -3302 9810 -1556 4617 5771 5085 -552 8666 -2537 -3543 8478 -7753 2739 -4399 734 -3346 3514 2783 1689 7495 -467 4723 -3507 -1224 6093 -6184 -472 2248 4407 -5569 9082 8749 -2259 -1875 -9250 7971 -3141 7700 -6726 6908 -7859 4371 -9286 -7171 2740 654 -5223 8174 8281 4013 -7575 6510 7423 412 3422 -6867 37 -1003 -4989 4967 6299 -3507 -9891 -3862 -848 -2031 193 -9568 3831 diff --git a/longest-increasing-subsequence/input/48 b/longest-increasing-subsequence/input/48 new file mode 100644 index 0000000..5d404b4 --- /dev/null +++ b/longest-increasing-subsequence/input/48 @@ -0,0 +1,2 @@ +403 +200 -2694 3410 -115 5878 -495 3061 -1174 410 -6185 -8739 -1372 1200 8245 2803 -7323 2932 -8422 2818 8457 -6317 5704 7160 6931 -6005 7074 -1025 -9098 8013 -3539 9063 -7425 4838 -3413 4315 -3445 2646 4973 -4681 4134 3945 1673 8033 628 2488 7801 -125 6764 3130 9082 -6918 -59 -185 -7488 -1149 9107 4458 9050 -8351 -185 -4869 4500 3936 5047 4452 1332 -5202 7533 -5227 -7234 9727 -1649 -2752 -4611 -9128 7633 4528 -2681 6754 6299 -2373 8919 -2508 -2048 -27 -2511 5218 -5387 -35 -1945 8091 8234 3363 -8935 271 2466 2769 1863 3759 -1667 8034 -4109 -310 -423 -6714 -167 7385 6651 -6047 5438 -7054 8426 7405 2418 6321 -3884 -5561 -8080 -4571 3304 -3783 7683 4838 2060 794 8575 8258 -5845 8419 -7090 -3036 7767 955 -3912 8269 1360 7571 7978 8954 3167 5182 2661 7181 5568 542 -6710 -9319 589 -2899 -2218 -8487 -8398 -2149 2462 380 -5293 -8867 -9856 -9674 8315 2138 9868 8268 -3167 -9598 2756 -8122 7821 -7316 2827 -9262 -3751 -307 -3397 -1600 8829 -7993 6716 1345 -7808 4919 7105 5385 3741 3484 -2503 -4504 5271 -8516 8972 1032 8623 -3299 -7022 5683 -5417 -1140 -4552 -3249 8962 -5034 -9755 2218 -8545 -2021 -8789 6514 -8278 -4895 -8293 4999 -6083 7090 -503 -101 -3745 8010 4595 3570 -8655 3065 -1281 1297 -7673 -9864 4547 -6739 -7497 -1417 6351 6986 -2061 5946 8682 -5738 5338 -4337 1306 -7334 1911 3359 -8901 -3404 2056 5237 5917 -194 -2391 1037 7683 8241 522 -5023 -429 -9982 7199 -951 4134 5249 -4926 7216 -1445 -9125 -2628 -1456 3432 7713 -8853 -3652 -2246 9754 7957 935 4673 433 -7127 -3498 -9113 -1779 -4804 4369 596 6774 -1493 7802 8678 -6646 7543 6357 -9952 3268 8850 6935 9499 -9536 -7004 -4462 -3468 -7879 6495 2850 2779 -7481 -4517 9531 9748 7300 3675 -7101 -2241 7338 7226 -7541 -1189 -8135 5381 580 9718 2427 4603 158 7463 5534 -3812 -9744 5950 -7190 5385 -7096 4837 -3045 9710 -7989 9245 -2584 -668 2497 678 -4061 -6599 -2735 -8176 1808 8414 8941 -8721 4474 2822 2609 7213 8013 10 -1161 -4614 6059 -1217 547 -221 -8325 -9915 7863 4507 329 -7672 9688 -4930 8348 -97 -9241 -9854 128 7045 -2869 6945 5581 -4801 -4526 -4806 4445 6739 3470 5502 -4914 -1183 -52 -2785 3572 -5396 6577 -1281 -8224 6910 2703 -3856 -3011 4785 9305 -8613 8915 -3136 9330 -6919 4713 diff --git a/longest-increasing-subsequence/input/49 b/longest-increasing-subsequence/input/49 new file mode 100644 index 0000000..834bfb2 --- /dev/null +++ b/longest-increasing-subsequence/input/49 @@ -0,0 +1,2 @@ +478 +-8127 985 4279 -6598 -5769 4793 8275 -1755 6553 -106 4665 2575 -3629 -2237 -6423 5128 53 -5075 -5303 -4876 -212 -104 8020 161 -4934 -7928 -8146 1143 1799 -330 -8067 -6242 5213 9587 2029 1538 3291 -3409 -9727 7827 9309 -1801 6317 5533 -4676 -2431 6210 1745 -2796 -6284 3371 -6132 7995 9991 -6966 9818 7716 -6438 684 -3628 -8927 -4007 -6427 5312 518 -6140 -268 -5813 5726 -2575 -9729 5019 1851 -4420 1505 -9666 5071 -4659 4780 9832 -2804 -2623 -3009 -5682 1535 6741 2504 -6858 526 -8339 -561 -4293 -2679 1393 -3484 3762 507 7617 -5424 -5944 5833 9376 2043 -4505 -1613 -5822 9481 990 2121 4757 -6982 6817 1761 9549 7630 5397 3719 8525 -1830 -4181 -5462 9035 8901 7618 7275 9471 2698 8207 -3402 6485 -322 3151 -3144 6563 -2203 -2308 4985 -5854 -1097 8052 -4487 4716 -7131 8286 8138 2126 5273 -8591 945 9681 7984 7717 -3359 -3838 -3965 -753 -8053 2821 -7486 42 9923 5676 2751 311 3106 -9208 -900 6040 7564 -3567 -1385 3075 -8731 7269 -7441 8670 7261 -3979 7232 1513 -8112 -247 1107 7891 -5679 -9832 2489 4111 1353 -3404 -1774 7138 2288 6606 -4778 5058 -7379 9 -7915 2170 4411 7341 -2465 2228 9127 2390 -2819 -6709 1596 6032 -8553 741 -6127 -9814 295 -5858 -9298 -3462 5275 -9481 -4523 922 -9951 -9740 -7286 -2310 1971 -3855 -9582 5911 -7104 4636 -466 -8833 -277 1724 -5395 -8620 9754 -2366 8201 8159 6810 -7675 -6166 -3855 2781 -5507 -6048 -2657 -4923 -6085 -1036 -2031 -2826 9271 -8918 3656 -5275 357 -9138 -9866 812 -8699 4762 4247 7415 -5779 -4498 3910 842 1407 4178 -8391 -8730 -5262 358 -1088 3913 -8532 -3512 -8993 -303 8571 -4890 -6224 2131 -2243 3486 311 8472 8777 912 -5265 -9046 -2657 -4398 -4018 -8780 8003 -4612 6002 2413 77 -8706 5351 -7180 4313 -2328 -1694 4056 -3410 -1577 -4828 7639 -907 -943 -8489 3899 -105 9022 2312 740 -6016 -6082 1526 9317 4250 -7089 -1534 -833 7670 2304 7602 -2654 -6481 -4049 7367 -8826 -1768 -1477 2223 -1289 6920 -6622 1988 2812 -3178 -876 -7720 2198 1990 -5386 5798 -8763 6221 7988 9096 -1610 -5999 -7077 -5919 -6498 8432 -9881 -1628 -2489 1830 3738 2522 832 5488 9952 -7555 -5120 4634 682 9979 -9321 -8247 -1924 6368 -1411 -7171 2879 4366 2491 4376 9846 3351 8503 4213 6377 -782 -3479 5141 -7486 1743 9470 6844 6613 -9661 -5149 -3590 2419 -4317 3215 -1214 1307 5410 -7466 9235 1673 3989 -13 2627 7299 5160 2105 6746 3733 -9881 -9541 7071 -3856 -5033 6004 -690 -8979 -7868 3799 9364 -9089 5351 5756 3699 -5848 -4687 -3064 9166 -5713 5621 -3879 5517 8863 -1219 7964 5806 -271 -5158 -7125 2376 -8490 4985 -6975 3642 9218 3704 3602 6376 661 1389 -2956 8123 767 9287 1036 -7345 -1219 7254 -1496 -3002 2064 4275 1513 -2092 -1164 -2741 diff --git a/longest-increasing-subsequence/input/5 b/longest-increasing-subsequence/input/5 new file mode 100644 index 0000000..8f87425 --- /dev/null +++ b/longest-increasing-subsequence/input/5 @@ -0,0 +1,2 @@ +9 +0 0 0 0 -1 -1 -1 -1 -1 diff --git a/longest-increasing-subsequence/input/50 b/longest-increasing-subsequence/input/50 new file mode 100644 index 0000000..b4c0fb9 --- /dev/null +++ b/longest-increasing-subsequence/input/50 @@ -0,0 +1,2 @@ +122 +-4939 -4299 -9789 7174 -203 -6644 -123 9491 -9454 5539 3997 -7231 -5809 1077 -7812 -2700 -3873 -7326 8749 -4683 3228 6719 5822 -2756 -5720 -8695 -7266 2335 -1644 -9899 -6031 -1194 -9185 -3673 6854 6060 -1873 -2196 6175 560 8796 7414 -8929 -4977 7795 -4835 -932 -4915 4491 -135 -5338 -5934 -2967 -4837 -4225 -9002 904 8673 358 -2352 -9322 -2533 9153 9610 2888 4846 -9538 6529 3361 -9763 5765 4744 6773 -1709 -2457 -6852 -9355 8409 -1867 -543 8780 5251 -1605 2009 -8341 2466 7120 2382 -1069 4850 -9007 -5995 2858 6359 -319 9982 2049 -2587 -8960 7103 -9203 -6067 4090 -7155 9427 6289 -9212 9562 9381 2624 -7628 9191 -3395 -9725 -450 -5894 -3911 8134 -597 -2640 -2481 -6535 diff --git a/longest-increasing-subsequence/input/51 b/longest-increasing-subsequence/input/51 new file mode 100644 index 0000000..3ec264b --- /dev/null +++ b/longest-increasing-subsequence/input/51 @@ -0,0 +1,2 @@ +469 +-4092 -751 -3646 -8106 -2086 -4925 4461 -3226 -5163 -1899 -9644 -3741 -5343 -1427 -385 -7628 5761 -3331 -8921 -5178 -6290 6161 -8450 -7860 2415 -72 3905 -7891 -1732 7254 -1186 8059 7097 2945 -1411 -377 -8432 -7983 -3999 6147 4371 -8576 -577 -9784 -6183 -9636 -4282 -4528 -3670 2569 9618 4951 -8054 -8153 4697 -5180 -5792 5924 -5211 -4244 1031 -8737 -873 -548 -7994 2562 6502 9284 4632 3815 -5150 2836 8567 -2239 -5214 -4585 2118 3983 6166 9968 255 6670 -5073 -977 -3990 7170 8841 2603 4976 -2890 -3319 -6113 9553 6700 -2678 2305 8250 9730 -2545 -613 -9377 96 370 488 5945 5338 8990 7290 4950 -3511 3576 -559 -1451 -6736 -3438 -1252 5046 3156 -8110 -8335 3563 -3064 3878 -5594 4651 7455 -4534 -8310 1599 3380 3252 -8876 4873 6627 5983 2634 8714 -31 -8564 6652 5686 -5918 9251 -7121 -9018 4905 -565 6530 -6809 5229 2110 3217 -7698 -1438 1353 8474 -9159 7130 7020 -2623 3743 6269 8599 9768 -2844 -7497 -123 -4329 730 -2882 5203 6655 -4658 7774 7184 1969 -5928 5804 185 5237 -9899 -3484 -7563 9908 -4611 9152 -6373 -4702 -1461 -271 -6210 -3780 -6046 3268 5308 -5110 749 7184 -3013 -8668 -3273 6933 -1733 -7506 -4408 -4693 8543 -2976 3167 -1934 4792 1073 -9254 -4974 -2805 -7504 368 9226 -6576 -2126 2629 662 1938 -4442 -1193 -4021 -361 6313 3046 6382 2914 630 -7462 -7502 -1968 -7346 -8532 -201 -9383 -3934 6141 8714 3449 -5869 2133 100 -96 1256 1087 3629 -6968 1171 3892 8877 4867 5182 8360 5309 -3447 9849 92 -4304 -3627 2148 625 5358 -143 -563 -7599 -946 -6503 -5251 2396 -8659 -6283 -8862 5838 -7908 6841 9726 -8478 932 -2753 -2137 2582 5229 -3258 1624 -9413 -4041 393 -7353 -9650 8651 3247 -134 9712 -532 -2299 -2879 -5478 -5385 2720 -7131 8285 1530 -4956 4218 -4738 -7723 -1801 1482 981 -831 8851 -6809 -9502 -3358 6452 -5823 -6554 -33 -4559 9965 -824 9014 7303 8292 -1112 6484 -413 -6910 -2237 9885 8623 -4700 6040 2669 -6063 -1655 6026 8065 -7480 -3982 8764 8331 -5186 1705 8855 6809 -1146 7100 -6104 -8812 -1016 -3308 1519 9136 4353 162 -7581 -2594 485 -3609 -8635 3050 1723 -7854 -3656 -4579 4495 -550 7689 -5784 -6840 523 -6648 -9970 4701 3906 4575 -21 1132 2540 -3790 -2360 -9438 -1653 -8793 4409 8345 -3479 6642 9576 2186 187 7963 4248 5001 7823 1314 -9847 -1063 -2350 8657 -6231 -3516 1776 5768 -3633 -8495 3291 3337 -5113 1288 -3213 290 -6567 -1397 1835 7289 5185 -1152 1029 -6888 -7984 -8870 -2840 -6223 -7224 -4066 -1349 7661 2946 -1206 -2682 -5357 -4965 3609 -2967 -2853 -4458 -5702 -2481 -1739 -4322 -3405 -3469 -3305 -9122 -387 5608 -7040 -6215 -4645 9679 -2235 -2686 9232 2669 -2113 3134 6881 -4547 -7294 9384 -6827 611 57 diff --git a/longest-increasing-subsequence/input/52 b/longest-increasing-subsequence/input/52 new file mode 100644 index 0000000..28e963e --- /dev/null +++ b/longest-increasing-subsequence/input/52 @@ -0,0 +1,2 @@ +342 +-5922 -5873 1093 8230 4405 -7047 8776 -8876 -2435 1717 -1885 -6155 -2931 8931 3090 -543 -6768 2545 -2487 -3577 -8949 -7098 6767 -3729 -1100 3585 1595 -4246 -7016 -1637 3248 -7620 -7138 6703 -4170 4258 494 525 -6345 1465 -7421 6160 -2388 -3114 9013 -5630 -7260 2048 3303 -5599 235 1018 -2943 -3228 -3822 -6752 3081 -8933 8554 -2810 8966 -4346 1174 -2443 1270 994 1555 -4180 4651 -4652 7982 8079 -3784 9730 7777 -7297 -2653 -5027 6646 -7618 -6715 -6395 5664 8954 -1457 9256 4691 3999 3721 8860 -5793 5702 -8080 4120 3149 -1763 -4791 3723 3610 5889 4592 4181 -3702 -1633 -5292 9568 8309 -9550 -9924 1154 5121 229 -2626 9501 3416 8588 -1377 4781 -2702 9845 3335 -5299 -9276 -6323 9319 912 -2810 9974 2181 -7310 -9405 2983 5580 7004 8859 -341 -7097 -2835 7854 6228 -992 -6162 -2113 -8559 3030 -8339 954 549 7687 4427 4016 1604 5001 -6315 -6945 -3564 -5002 1378 -9046 -6338 5294 4448 -5601 -2876 7635 4905 -5508 5573 -5818 -1040 6168 667 1494 -380 -5804 6067 9025 -6392 9953 -5682 -3823 -8077 -3314 -1516 9164 -7305 3115 8843 7670 -4013 4172 1932 -7232 7908 1823 -6816 -7904 4627 -9892 8495 -2519 -5671 9292 8414 -6613 -2117 -4107 -7739 -1953 -5515 -7761 -1732 591 7008 5093 -1553 4715 -6229 -1344 1586 1567 2650 9089 9484 -5844 -7086 7996 947 1988 -4554 7739 -7572 1559 997 -5074 6377 1976 5971 8316 3506 -4343 4924 2466 2854 -6974 -8180 6683 -2662 4980 3736 -7493 -707 9714 5143 -657 8473 -8196 -8339 3056 -1007 -353 4786 4348 3636 7309 2431 4978 -9057 -1495 -3641 -6302 921 3305 -9319 -5112 -4519 704 -8605 -1737 -7231 341 2733 -2309 5868 -5598 -5115 -5905 -7950 -8283 -5730 2546 1612 7513 -8594 8977 7050 -9575 -9837 4468 -6697 7027 -3045 5719 -8752 1914 -1254 2878 8633 -788 -9260 6688 -3963 -5731 -7105 -8523 1443 5516 -161 3148 7318 7285 -1447 5749 -1078 3008 7632 -8151 9832 5615 -549 6795 426 -1850 2189 -1326 -830 5933 3535 -6497 4609 3740 4711 diff --git a/longest-increasing-subsequence/input/53 b/longest-increasing-subsequence/input/53 new file mode 100644 index 0000000..aea97d8 --- /dev/null +++ b/longest-increasing-subsequence/input/53 @@ -0,0 +1,2 @@ +10 +-5951 9003 -3582 405 7568 -1792 2666 6858 -7151 6991 diff --git a/longest-increasing-subsequence/input/54 b/longest-increasing-subsequence/input/54 new file mode 100644 index 0000000..e42ee0d --- /dev/null +++ b/longest-increasing-subsequence/input/54 @@ -0,0 +1,2 @@ +159 +-1063 -9063 -2567 -8960 -7649 346 5999 9643 2176 -2537 -8582 -2343 -1078 466 7208 9363 -225 9676 5489 -2349 -3821 1478 -8430 -2390 -6400 2248 2890 5323 1488 -7521 -5613 -5828 -8777 -5646 -7671 7001 3787 1721 2316 -1660 -5419 9210 7689 2414 -635 946 -561 2063 -9059 7261 1411 4407 -1890 -473 7687 2937 -5650 -2136 -8215 9736 -4626 -5681 2470 -2742 2498 -6007 6529 8094 -8587 1414 2619 2604 -6678 -3822 6494 9200 8384 612 226 -931 6947 -409 8061 -6884 -5375 7978 -3360 6824 -5556 -623 -2214 -4163 -9360 2989 1872 -4630 -6611 -3922 -9979 7776 4353 -8680 -6429 7165 2908 1729 -7447 -2007 9207 -3596 339 -2051 4784 -6728 1994 3663 7351 -6295 5428 4612 -7844 -9434 -3288 -9957 4255 5307 1184 8822 2139 9736 -4185 2368 -6681 -2960 -5399 -8836 1052 1602 -8313 9026 -1153 -1255 1351 3445 -6743 1231 6415 -5843 690 9461 -3379 798 -5062 9096 8800 6328 2416 -9212 -9550 diff --git a/longest-increasing-subsequence/input/55 b/longest-increasing-subsequence/input/55 new file mode 100644 index 0000000..2bc2e74 --- /dev/null +++ b/longest-increasing-subsequence/input/55 @@ -0,0 +1,2 @@ +450 +-4197 -5084 490 -8077 9615 -5102 -8951 2134 9493 3113 7274 627 3713 1184 -3111 -3876 2012 -3435 1508 1951 3823 -8216 -6963 -8478 1742 6734 -9233 -427 -9341 -5809 -9754 -5655 -495 -9018 7048 8102 2084 -7129 -8650 5417 931 8332 -6391 4324 9621 -3766 7990 8355 6837 8531 5202 9347 1916 1695 8703 -4636 -3882 -6186 8090 9863 -4673 -8874 -1153 1430 6880 -5438 -7917 6818 -1328 -9837 -8092 2561 3706 6007 9856 -5715 -4972 5368 196 8194 6966 -1232 -1975 -7777 8724 6477 -5120 -2269 -1862 8404 -9838 1728 9328 8337 -6364 6224 -2598 1059 -3500 -4100 -371 -8937 -9940 -6591 -2392 -370 1621 7907 1222 8732 -1871 6839 2573 8138 -6138 4923 3747 7386 -1035 -8691 -6796 3781 5659 8264 5396 -2645 2032 4321 411 -6898 5283 -1274 2216 -7216 -578 -1164 9812 -4271 -1934 -3388 9179 2275 2648 -7229 -54 -5220 -4052 -1075 6796 -5045 -2531 -2363 -4496 3152 5373 836 -3035 5550 -4257 2521 1316 1754 4952 -3465 1058 -9016 4395 8857 -1768 -8487 7994 -6287 3269 -9855 -6658 -4672 4096 -6195 9044 -5772 -9010 -5388 -4190 -5167 -6738 -2337 -9436 6664 3159 2164 5859 -8745 -9099 -8253 -8931 401 -4526 4461 -8825 -5769 -9189 -5642 -2017 -1994 3359 6053 5391 6587 8688 -3680 3772 50 1541 1152 -8046 -7445 5057 4733 8000 -1645 -6113 -3617 -3599 9762 -2922 3648 -9600 7461 -5421 8526 -4947 -5129 3863 -1022 5202 5311 8689 3030 4193 9941 -157 2973 -5254 6497 -3566 -5584 8934 6272 7619 255 4836 8137 -4746 9512 -8922 -3925 7584 3914 -876 -6737 -9308 6124 -1911 1916 -8112 -2149 -9351 -8752 5565 2608 -1400 -9399 -9048 -2375 -7956 4440 -2473 -279 -549 5213 2032 -9218 1235 6980 -4098 -4997 -8350 3737 -5353 -9258 6965 -9581 -968 -4267 109 4832 6413 4005 -8203 -6160 8927 9395 -9208 4607 -4652 3525 1960 9508 4629 -4212 9469 9067 -3697 -3133 -7206 5390 2544 -1216 -8701 -9637 4769 7289 -4886 4169 450 6951 6903 7484 -999 1137 6912 163 2774 1674 -5799 5630 -6089 -1659 969 939 -5067 6970 -9991 3672 -9997 -1181 3527 -462 951 -1960 134 9120 7020 4953 -7928 -5084 364 6907 8377 1053 -7452 5438 7447 5138 -1487 -86 2024 8439 -9100 5983 9940 9926 -3139 -2338 -679 6585 -6912 -1576 9718 -84 -7336 -1076 5107 -4919 -1881 -7626 5507 9790 7211 -8563 -7181 -2196 4524 7448 5992 4128 1524 9812 -6591 6968 -343 637 7867 -7955 4488 -2021 8007 7717 6446 -6288 -489 -3419 1651 -6750 9567 -6920 -3848 -2298 -4939 1607 1843 -6951 2966 -1605 4216 4536 9633 5785 7421 8720 1215 8909 -5976 -2902 -2799 358 -1415 1989 -2971 1920 -2631 -7674 -9903 -4520 3208 -5156 5976 2634 -9057 4853 diff --git a/longest-increasing-subsequence/input/56 b/longest-increasing-subsequence/input/56 new file mode 100644 index 0000000..6891fee --- /dev/null +++ b/longest-increasing-subsequence/input/56 @@ -0,0 +1,2 @@ +904 +6524 8965 -1353 3720 -2034 6570 -996 -6160 -8090 -8236 -3644 6936 5917 6911 -9554 2347 3730 2014 -1329 -3232 6466 -666 8261 8794 -6303 1162 -4544 -8229 5498 -9254 -2789 -6594 243 6709 1244 -3153 4652 -3361 -9204 7562 1185 3242 -4175 -8393 -8459 5524 6214 3394 8921 2064 -1515 3052 7810 -7704 -7803 1421 -3864 -2340 -7944 4103 594 2565 -754 -7658 -7370 -9016 -6724 907 -2140 -8895 -568 -4616 -4177 -9842 8675 -7170 5952 -1799 -7148 9790 9443 -1291 -2801 -9789 8282 -2889 -7601 1532 -3939 -7012 8893 2244 6144 -4254 1160 -4854 -8925 6610 -2449 -7458 3693 -7342 -3724 9764 -7084 -6628 -8973 1560 2024 3514 -8994 6738 -6868 7367 -8084 3959 -2140 -6794 9941 6653 4171 -6714 5080 6617 -1710 3660 -1576 -8095 7896 3074 4905 2725 -7607 -5265 2916 6051 -6346 -2913 -5403 1815 9956 -8196 8670 -9568 8318 4999 6862 6160 -2884 4143 9119 4830 8359 6072 4337 -825 -3619 -7215 -5002 -9539 -1650 -4140 8179 -5230 -8258 6440 7593 -1531 5914 -4834 -8850 3050 1850 8870 9492 -9770 1454 6334 -2911 -8597 4034 -9007 1435 2125 -21 -3050 -8031 -2925 8804 8668 -5288 -8765 -3757 -6003 -2079 9103 1885 -631 -7560 -2897 -4678 8537 664 6543 -5151 -8633 -3187 -5650 -6642 -6223 -9354 -9522 7080 -5788 -9414 -6676 8924 71 -4251 746 -3888 4106 -4564 -8706 -2577 -5894 -3936 1442 5693 -3908 7560 -2731 -3754 -220 -3972 7769 -2191 1752 -7974 -1400 -131 8091 -2905 6985 6553 -3511 -8908 4012 5061 -4676 -1266 -9963 738 301 -6026 5725 -2580 -7221 1679 3159 6629 -8976 1086 -9983 3681 -6312 -7306 5276 -3617 -3462 6827 -8695 -3580 -3061 6460 -8471 -6935 5913 4960 8553 4313 -3888 3706 4161 -534 -2473 -3392 7463 -4302 -9248 6028 -7493 -5127 -7506 -4047 376 3948 1262 -9783 3959 9710 7185 5924 -5109 8700 -6753 8469 9001 -6825 383 8569 6091 8139 -6911 -1683 6571 6528 -7807 -3874 -2447 2829 -1327 2011 -8300 3773 1402 -9909 7127 34 -3490 7856 -7794 5488 -5626 4042 -6700 -7595 -6786 -2609 8353 9301 -9585 9583 6206 -8237 8609 -2964 -5033 1921 -477 9637 27 -6510 -7664 4754 822 3044 3338 -935 -8885 2525 3728 2490 -2433 -7621 6336 -5757 -3255 -7884 6327 5272 8391 7975 5044 -5143 -502 9482 8674 6521 -1549 -5326 256 2079 -4626 3168 5132 -2762 8301 -8414 3098 2295 7475 9532 -5524 1539 9176 -6872 -6576 3965 -1416 9376 2311 8843 -2921 -4597 -2290 1797 5862 3716 4587 -3026 -3682 2958 6443 -2509 -3734 5970 4641 -9407 -4119 -2756 3212 2477 9463 -7143 -8896 -5609 -561 9156 -167 -2259 4420 1269 787 7584 -8026 5429 -2941 3117 4715 -8053 552 -158 7672 -5868 8305 -2297 8693 -396 -7775 -5263 -9938 6398 9057 -335 2707 -1358 -968 1033 -4006 3206 794 5281 -615 -357 3103 2903 6556 -1094 -94 7072 5956 5636 -7230 3981 8594 629 -679 -449 -9628 -8468 525 -690 9030 -3893 -6536 -3958 1962 -1527 -4500 270 -5547 -2128 4227 6023 3916 -858 -3964 -2387 -6252 2123 -2732 9950 1556 -881 -4392 -5742 -5847 834 7857 -6665 -9659 4709 9354 -2702 634 1680 -258 -1720 -5831 -3968 2283 4423 -5880 -4319 -2587 313 -5446 7559 -191 -5119 -3276 9945 -4386 6902 3599 4976 8499 -9127 -743 -7583 -5439 -3780 4861 6958 -4073 2274 -4058 -6357 8969 -5963 -1039 5830 -8123 3268 6982 -7735 -173 6938 -4821 -2502 9307 6513 -6270 -3513 -4375 5203 -1507 167 -7487 -2109 3820 8323 -9986 -304 7538 8972 6599 771 8637 6725 -6582 7709 6895 -4908 2108 8671 -1161 6918 -4298 -6124 5743 4599 -7920 2502 -7420 8321 8746 1160 -8383 -2819 -46 9173 158 -3884 3258 7187 -9940 -8867 4469 -886 1362 4040 836 8775 -522 -6311 -5948 9115 -1936 4100 2644 -6661 9210 7395 6413 -456 2754 -627 1832 -9187 -9049 7203 921 -9628 3637 8026 9972 -2233 -3806 -3972 -6021 -2373 -5338 -1129 3029 8789 -9189 -7323 -973 6671 8460 -2609 -99 858 8444 -7374 3550 1842 7731 -8135 -7657 7609 -9729 -7084 7425 3366 -5408 2185 9934 1214 5475 7061 -887 -7355 -9906 5454 8896 -9842 -1922 -4220 -4381 -8783 7353 4509 6450 -870 1552 -7928 -4708 6407 -225 6941 5844 -9986 -63 9958 1449 -5076 -1628 3874 -2299 7200 -6175 -6239 -1476 1984 3460 -2993 5341 -5207 3893 8060 9407 -9196 6262 7447 3190 -2124 728 -6198 -5802 9808 -2904 8149 -9763 6393 -1106 5070 8937 -6132 8226 1938 -8743 8085 9629 -8706 9755 2532 8881 -1449 361 -2898 -9797 3989 -5010 -5851 -7325 2670 -6946 -3018 2706 -9850 -2637 -9020 9760 8385 -6309 1598 -7342 1777 4885 -7330 2120 9728 9241 1968 170 -779 5786 7450 698 4097 -2111 6227 8194 -3453 -9161 -2031 -3333 9531 -6202 -1986 -1191 -3303 -7773 -6308 6845 -70 3687 -2248 -4075 6351 -4467 917 3668 1695 3346 -702 -3226 -2272 3015 2997 -7131 6848 5761 -8226 8419 -8037 1024 -9757 -9219 -6017 -5638 1825 9627 3343 -6914 2734 2656 -4035 5723 -9218 3877 1087 794 -7146 846 -2919 2094 7354 -3176 4019 4348 -7193 -3489 7583 2881 8667 -3678 588 5113 7484 -1455 6867 1709 -1704 -3989 2816 293 6093 5905 4901 4448 2196 9436 935 -7143 -1636 -9204 -7306 5139 -6901 6282 -6175 -30 4655 6374 -6405 -6322 -8856 -8348 1226 -8302 2414 6078 7388 -3118 -7 7686 1914 5223 -3309 6162 1892 6645 -7887 -3404 -8401 8031 8415 -1278 9158 -5636 -9115 -4643 -1888 -4616 7178 1073 -2727 3068 -8990 1418 diff --git a/longest-increasing-subsequence/input/57 b/longest-increasing-subsequence/input/57 new file mode 100644 index 0000000..7ddbdd8 --- /dev/null +++ b/longest-increasing-subsequence/input/57 @@ -0,0 +1,2 @@ +258 +3533 -7636 5846 8014 -7079 8893 -9511 -3368 5602 -9269 -8098 7983 2076 -8770 8162 -4904 -1259 8598 -2729 8037 8964 -9939 7312 -1308 -2398 -392 -5082 -1406 -3140 -9133 4776 -1943 -9963 5995 -6965 -6993 1577 2887 6237 -8804 2799 511 -5006 -5454 -6460 -4792 3412 -2335 1085 421 -2779 -2275 3077 -9588 8907 -4134 2284 7730 5945 1750 -6967 -4251 7422 -9551 -949 5739 -5813 6008 -6224 -1244 -6703 -8358 -8208 8074 -7558 -725 -4782 9676 -8149 -6508 8257 -4389 -3862 -5078 -9122 970 -3351 3346 8793 -313 1006 1989 -4473 -1981 -1790 6922 2248 -5108 6717 -1561 -5379 -7806 -1227 2887 3225 6829 3130 9186 6492 9323 -7088 6612 5839 -9736 7827 3970 -16 860 -2956 5891 -4380 912 2505 -3906 -7801 4188 -2010 -6188 9392 9393 2080 -764 8671 -1370 8546 -8827 4566 555 -7286 3691 7538 6053 7013 2895 2671 -9719 799 3623 4751 -9623 5830 -3286 -9920 -5109 9796 -1769 2471 8145 9222 6164 4415 624 -594 -8590 2674 522 4809 3769 5313 -5450 -6999 -365 6185 -3523 -395 -4416 -3918 5814 3027 1093 3445 6954 -1173 -5037 -1210 -1021 -6469 -4163 2494 -128 4502 -9319 -700 4638 -4327 -789 5507 -7604 2724 -3244 -2201 7434 -4956 -4145 -7970 4527 -2815 9070 4250 -8650 4638 4835 -1331 -9727 40 3231 8498 -7227 3138 9034 -6313 -7797 -1317 -3090 167 -395 -7139 -3458 -5537 -8093 -857 -2703 1092 -4261 1436 4224 -4449 2990 615 4785 -900 -7645 -8591 -172 -2305 8250 6369 -8303 -4747 -5694 8244 4146 -9000 -2264 -5093 -3150 -5326 7236 diff --git a/longest-increasing-subsequence/input/58 b/longest-increasing-subsequence/input/58 new file mode 100644 index 0000000..659e37e --- /dev/null +++ b/longest-increasing-subsequence/input/58 @@ -0,0 +1,2 @@ +772 +-3440 795 -2882 6049 -6486 -6005 -3740 -2611 -6744 -4931 -4761 959 -2885 8079 -3514 7955 -283 -5085 -5002 -3328 -5115 -3753 -6177 9373 3585 -2540 2800 9508 5668 -9767 4747 -4456 -2469 9873 6442 -3874 7809 2104 -426 6116 -7452 -7815 2841 -5291 -2067 -5679 -9103 -9149 1739 -6583 -8142 9926 -637 6185 1102 2993 7046 -5006 -9020 7515 -9227 1839 5048 -7124 7611 -426 -2647 -5177 -5508 1940 7437 8312 -4865 -9531 -529 -5671 -7731 -8315 2790 -6270 -906 6254 8066 -5478 -4262 8294 8712 -1107 -2244 2730 8029 -6957 2938 -2578 -7198 -4004 -1566 2001 -8862 -6322 2573 4316 2091 1689 6160 -8939 5150 7042 1886 -967 3329 -368 -8349 7419 8904 -1236 8859 8611 1814 -3110 -66 2400 -2042 -1349 -981 7520 6707 3830 6686 3177 9124 817 -4725 -6951 -2891 1424 753 -8148 -6934 7462 -8923 -7958 -9778 -6696 6596 6329 7383 7763 -6441 -629 -3989 5568 -5566 2530 -5155 -996 4615 3677 -5884 2934 5192 -598 7947 -8751 -6203 2860 9675 -2337 -8477 8974 530 8708 1313 -4997 -160 -1151 -7786 -1317 5451 -3318 -9660 -1879 4124 7920 -6360 9385 -1840 7927 -3985 -4811 1001 6973 6447 584 -517 -68 2240 -1567 5124 -3798 1497 -2662 -377 4314 1790 1432 -4066 -1911 7490 -422 5825 5498 7603 6223 -5804 4438 6591 -2294 4989 5384 3691 -2019 -2762 2013 -4328 -8404 -8470 4854 101 9099 764 883 6661 -9232 9568 4345 9749 1572 3002 -6894 7019 5313 889 -4621 -3516 5936 6823 -1667 -1317 222 4878 6381 5442 -8766 -1901 -5796 6135 3759 6963 -9836 264 5947 1493 -8828 9323 2303 1907 -726 -4587 -5786 -2844 4840 -2929 -5038 -9930 432 8286 7928 -8091 -6203 8520 7795 3249 -4369 -7024 9301 -5384 -5747 -8096 7923 -525 -6521 7971 3040 6955 8783 3092 -5744 -9630 -211 5467 -8491 6560 -95 2078 -734 9501 4248 4421 1616 4910 -5850 7925 2620 2854 8117 9814 -8814 2088 6589 -8024 2324 -2917 -4914 9210 3991 -2911 2995 6663 -4624 8790 3757 -3668 3234 -4836 -9904 -9974 7554 1781 -9721 7826 -418 -9670 2594 -7826 -673 9810 -3924 4659 -8905 -7599 4836 6726 -9573 8406 -5347 -9750 -1095 4590 6742 -8714 -2427 2521 8421 5380 -6859 1773 5150 -7598 6219 -498 4879 6371 7147 -6390 2453 1972 9250 -8227 -6147 -5996 -7861 -8458 6535 -8387 31 -9026 8114 -647 -5958 -8827 7224 2242 -4491 2604 -3534 -4187 8244 -2360 9748 -3805 -3936 9062 4107 6226 -6725 -245 -5295 8457 -5617 -7026 -3982 -5856 9742 2383 8310 5782 5871 3067 -6761 8267 -9226 -9969 -7825 -4175 -3753 -1449 3937 -8909 -5743 3170 -3478 -2241 7740 -9377 -1930 -4364 -754 -5863 -1482 6651 5106 2854 -3738 -525 -4598 -3226 -7754 3735 1520 3616 4566 9123 -7826 -9152 -6188 -5787 3724 4361 6000 778 5062 -1288 -5874 -7669 -7525 4837 6603 3041 -315 -4408 -7523 -4288 7592 3423 -1749 -2453 -4774 7207 -2021 -233 -7161 7852 395 -1583 1601 4937 -9780 -8198 -2193 -4594 5692 1853 -4882 -9744 -2733 3539 -6226 4581 6232 -1640 5700 -4080 -1602 -1008 -9720 -1192 -7914 1551 1362 8906 4713 -647 -4960 2808 -382 7499 -7026 -6054 9060 -7849 781 -6269 -2806 7901 8093 -5719 2926 -9644 9334 3247 1560 6224 2809 56 -7631 6189 2539 -30 6526 -8167 -600 -1373 1413 -7681 -5589 4452 8611 3267 3547 7730 -7356 -3055 8080 4122 9090 1559 -787 9271 -5556 8407 4167 4921 3909 -4468 -2155 -1565 -6501 -3320 3690 9973 4018 -1600 7554 -8659 3884 1139 217 -139 -4693 5257 2551 8949 -6561 3109 4770 -3951 -2353 -8685 -2183 -8712 6612 -9754 1929 8979 -7306 -2426 2155 7453 3311 6972 -9514 7275 124 997 -7676 -4122 -9036 -5003 -4964 3927 1038 -7574 -5428 2612 -4140 -3344 8068 760 -7359 -9964 -9804 9715 3076 5896 7445 -9130 3592 3855 -8440 -7093 7807 7549 6502 -4659 8963 8453 -586 -8169 -880 -483 -8450 -2151 87 -9291 -3937 1984 -7342 -5851 -2781 -1890 -5631 36 4577 -9446 3056 -1286 8690 4088 -4246 7370 -1697 -5671 -3905 4840 8639 3855 6508 9961 -4063 -9832 -5781 9399 -6993 -4162 -2647 5811 -2303 866 -2553 5355 1369 -6179 1517 -3520 6757 8435 -3464 -4546 4076 4167 -3005 -1656 9507 -6284 3227 -4487 -856 5527 -5987 2693 3890 5836 778 6884 1605 -3414 -4167 -7752 -3414 -4909 1793 -1541 1887 -2492 9470 6927 -5858 -7477 -8012 3039 1936 9166 415 9985 -983 -2689 3467 9398 -6382 4987 -9889 7301 2721 -7173 4929 3987 -7052 918 4157 -2772 -333 -7151 3992 8604 349 4820 2583 -7718 4661 4483 456 4502 -3319 5098 3384 638 -4260 6410 -7164 435 -2292 -2381 2514 6129 -8982 -6232 4958 -1657 5983 -9537 5500 diff --git a/longest-increasing-subsequence/input/59 b/longest-increasing-subsequence/input/59 new file mode 100644 index 0000000..6dd34dc --- /dev/null +++ b/longest-increasing-subsequence/input/59 @@ -0,0 +1,2 @@ +838 +-3974 -9236 5450 4663 -6813 7726 5901 277 5374 8140 -2406 -9596 -5295 458 6975 369 -2498 1649 -6495 -1407 3055 7855 5587 211 -6637 -3660 -9339 -934 5068 7462 4352 -8064 9744 -9769 5943 1529 689 1475 3428 7316 6927 -3165 5446 2460 7571 -1803 -8800 8971 -7157 -773 564 -6319 2434 9442 -4788 -7111 -3942 -7065 -8083 -9608 2174 6699 -3867 8516 -3890 6884 -5475 8125 4619 -9272 -8791 -7757 3771 -2310 -4139 -468 -8686 -3192 2587 9614 -3754 -7311 -8036 1782 -2107 -2754 -5428 743 -9165 5882 6717 8669 -7535 -3267 -4485 -1659 -1507 -8786 -3963 3571 -761 -2249 -1767 2960 3196 2100 -1261 -7549 5509 -5989 -7302 -8861 -7987 3082 -2165 6567 -760 8231 -2069 -4219 -11 -4091 4514 -4594 -2669 -1477 -501 -8720 4386 4125 1721 -4268 2381 4985 8975 -2611 -2661 7985 -2753 -6954 -6938 171 -5490 -9474 569 7874 2567 2453 7771 1063 -3859 -4939 -3078 -1306 2467 7187 4200 -6881 5002 -4297 2637 8546 -5831 -117 3382 1810 2211 -6686 -3024 872 8862 -2111 -5793 -6882 1770 1848 -5350 -9062 1461 -5387 4223 1972 4040 -2655 -8952 -324 -6995 -3075 -1512 -3398 -1921 2760 3119 4278 5213 2192 1235 3240 8210 -8760 -4084 -8734 -2453 2272 7255 -9405 -3430 8677 -329 3618 -8387 5819 9346 -2254 -9641 -8119 -7980 9305 -93 2345 8842 -424 -271 -7243 -1748 2647 9145 418 -4391 3486 -3651 -2314 -8725 -9676 6401 1741 5211 -4187 -6487 7632 3170 -3217 1303 -452 -3327 4685 9366 -8625 -5656 8458 -1409 -9004 9021 -4038 6892 8360 -8464 -4605 -3216 3581 -6529 3323 7496 -1352 -1530 -527 -1297 8758 3008 419 4738 -9229 6494 -4112 -967 1474 -7073 -900 -8948 -3574 -362 400 5713 -6388 -4541 -3993 -6151 -3977 -3481 1655 5744 -3662 -5499 -8535 8697 -5448 -7616 2998 7535 2629 -394 -9229 -4191 -7691 202 -1548 -5948 7921 -6186 4307 3910 -9424 -1374 3467 2081 3651 3268 -3491 3347 1759 -8663 -4709 4302 -7690 6042 5922 2526 919 4920 -9481 -5327 -1161 -257 23 7583 -9892 -9204 -8869 5509 2538 3596 -1028 -5465 8446 -5172 -6371 4681 5230 -5268 -6474 260 -7073 9949 -5981 8336 -2570 -2551 8154 -3758 -9595 -975 -5066 -3413 7316 5563 -5562 -9327 -6722 2800 5119 5714 -63 -9940 -2319 -682 4105 -2793 6448 -3797 -3044 -4320 1406 -5689 -8025 -6479 -8491 2644 9151 6653 -6030 5781 -9035 -3285 -1895 -9595 6770 797 -8975 -8396 -4584 -1652 479 7867 4862 3790 5779 8879 9931 -2804 -1724 -3105 9867 -3042 8717 -4049 -7849 818 -9206 -1295 -4231 -2884 -9761 -5159 -8481 -8147 6187 -1386 -446 3361 9331 -6181 110 3487 -2203 -803 -2156 6053 4217 8560 635 -624 67 3369 -3867 2937 5015 6564 -7196 -1822 -8991 -2034 -1935 -3276 246 -2541 -4635 -8551 4779 7757 -2681 -7914 -6238 2463 6022 -1639 -8137 3996 -9307 4783 -366 6680 6639 -67 1539 4797 -9904 1860 3196 3878 1041 9592 5625 7640 -3046 8737 -2098 -1889 -2025 1350 -4854 7715 3682 -7298 7535 -4063 9120 -8751 9447 -5460 -9878 -3996 -6630 3768 6438 -2961 7011 -4762 8168 -7621 -6465 -9724 -9343 -8441 4309 5477 5074 5126 -2543 -2278 2024 -8113 7819 5656 -8116 -7677 -7089 -9627 8125 5538 -1426 5446 442 -9603 6194 -9658 3726 5084 -72 -2016 -5323 2781 -6229 -1694 -366 -5751 -575 -4255 7287 3136 2763 -3417 -1782 9999 -4281 5412 6817 -9168 -213 5777 5963 -5818 -3628 -231 -4660 4654 1830 7820 -6310 -2742 2985 -8133 -5894 8112 -4655 5610 -3261 752 7664 -4572 5783 7369 -3853 4521 -1166 1300 3602 -7244 8636 -4266 5038 -5216 -9318 7441 -9341 -574 -734 -6461 9134 9970 -8143 -1647 -5751 2943 8594 -7499 -6275 851 -731 7288 8266 2049 -2032 8305 6259 -2202 5346 1853 -9541 4186 195 -9202 5333 5119 9953 2994 -2865 -8222 -8528 3193 -1996 9375 -5560 -9442 9378 -9691 2489 -1510 -4275 5067 -6841 3893 8877 2911 2389 -5427 8658 7983 -8895 8506 -740 7184 4649 -2367 9399 9118 -4270 4938 -6705 278 7104 8081 6256 8697 -1151 -1403 -8812 -9824 -961 3516 2499 2481 -7374 -9541 3540 4280 -1345 -1567 4203 7591 3756 -8443 -1416 857 -3352 -544 -238 -2559 7499 974 9670 3861 -4241 2273 3325 5292 -4773 5856 -9618 5436 -1148 -5932 -4636 -6356 -9120 5511 6749 -4010 -9202 -172 -8039 -9849 -9003 7127 -3417 6799 -5549 9751 -6837 330 -2761 -2281 8495 5690 4071 6988 8278 -8106 1491 7453 9179 -7305 -2513 -9675 -9219 -9534 7029 2667 4435 -3302 -2266 6387 -1812 6917 6029 3141 8630 5310 587 -8794 342 3147 -5307 5637 -105 1883 -2515 8419 8700 4840 -4309 -9877 -65 -1409 -5489 1861 3959 -1773 -8216 9415 -2110 -9200 -227 -422 2043 -2415 2913 -2225 -8485 8351 -4532 1230 -1168 6867 6384 -1436 8235 -7119 2290 -6985 -6782 3995 9156 -4970 2904 3129 7934 -7960 5261 7992 -3605 -3034 8269 3882 -2585 5230 -5441 -4125 -6328 1765 -6219 6896 6727 1477 7135 -1134 5634 -7304 -1701 -5862 3426 -9808 -799 7524 8253 -7572 -4615 8123 -2745 -3303 1382 1898 -7600 -5316 5929 8850 -3024 -9243 4122 diff --git a/longest-increasing-subsequence/input/6 b/longest-increasing-subsequence/input/6 new file mode 100644 index 0000000..f013e50 --- /dev/null +++ b/longest-increasing-subsequence/input/6 @@ -0,0 +1,2 @@ +8 +-7215 1663 -5179 1091 -542 7868 -5687 -1048 diff --git a/longest-increasing-subsequence/input/60 b/longest-increasing-subsequence/input/60 new file mode 100644 index 0000000..68f3c5c --- /dev/null +++ b/longest-increasing-subsequence/input/60 @@ -0,0 +1,2 @@ +695 +8482 -4119 389 7571 -1332 1933 -3771 -7550 2776 9741 -1453 6125 1509 6125 4043 9185 -3719 5896 8518 -5338 -7582 -5923 -6348 32 8236 9527 -307 -1784 9013 4687 4320 7077 -4083 4555 -5164 3762 7024 3250 -554 -4387 1792 -8790 -4549 -2187 -1749 -9264 350 384 9343 5451 2050 -1370 2397 -4167 -8526 7676 1317 -1079 -5354 -9801 2944 3208 -948 9154 -605 3706 6926 -1205 -2129 1770 -4295 -6267 5032 -581 -9144 -3026 876 2690 8179 190 -6052 9885 -9539 -3509 8971 5709 154 1479 -5119 -1516 2102 5631 -3454 8813 -747 5331 -6738 -9795 -3755 9314 -8271 -7956 -3881 6721 -1270 -5003 5848 6587 5332 -9638 -9946 9650 -5508 4751 -7746 -3458 -4513 4054 -6553 9439 2384 -4151 1759 -3925 4033 9231 -9914 -4751 8510 -2553 6672 -5477 -1211 253 4721 993 8853 3308 -9281 8400 9570 -9772 -3587 6880 9621 3749 2693 -2514 3913 -2953 9002 -3766 -7375 -843 -1798 4033 -3393 4880 -4716 -3813 -5588 -677 5438 4929 -5211 647 -217 -7295 5183 -6084 7536 8997 8676 1354 3895 1424 -9297 7613 1126 -8532 3897 -4209 -7247 -7917 -7881 6063 2828 5505 -7363 -2800 -1608 5724 1078 -8189 4841 -6392 8993 9809 -8733 -4569 -5924 -4650 7969 -2786 -8347 -1772 -2367 -5711 -7275 659 -9668 4028 827 -7864 -804 -7879 -6570 -1223 -3641 -6111 8807 -2937 -4025 -4619 9241 -7329 8993 1249 -1309 1242 -1075 -6606 -4654 1707 -170 744 -3154 4434 6459 -4474 6947 5939 7951 8910 -8435 223 -4591 6027 -1079 275 -4535 2913 -5564 6371 9933 4954 142 7907 -259 4811 -9906 -8882 -2395 2543 -8674 -9496 7118 6839 -2278 1320 4760 7294 -9184 8391 9162 9929 9344 -7813 -2828 3422 6457 6716 7722 -81 3610 -554 4522 -1899 4953 8777 -5251 1786 -1802 -2655 -4939 5213 -1069 -9812 7149 4194 9957 8623 -7960 -9100 -6562 -9781 -7362 4704 -5974 -6966 5183 -6985 -1838 5022 -3730 5123 -4498 -8816 2888 -2355 9192 -4704 -105 -7807 -72 7794 7734 723 8066 9711 -6362 6279 -5472 403 4839 -2984 -2658 1805 6263 -4071 9989 7471 -6562 3599 2851 6840 1733 3996 -9343 7842 -4779 4255 -6676 -5451 -6767 6529 9257 809 -7933 5932 6604 -2305 -1290 -9810 -3928 -3790 -2348 -7519 -410 -373 6650 -6849 1668 -3665 -2753 6939 -1169 -9046 -5858 -5802 5439 -6777 9943 -6301 5531 8534 684 2530 808 -6267 -9172 8988 -6018 2080 1985 5214 -1180 -1555 3786 6759 5748 5508 8497 8253 7751 4671 -961 5385 8652 4328 -5980 -2798 -1629 309 2619 6135 7587 4737 -7748 8054 -7876 2515 8712 1668 -2826 8929 -9362 -8502 -9695 -2434 8955 1245 6837 -4916 6129 -9309 3994 1438 549 7017 -7020 4264 9131 4318 -490 -2 5782 3121 9784 767 -6568 -2921 3714 -9932 7524 -5494 -3852 1295 3601 2073 -3988 468 1181 -9036 -8660 -1593 -2569 -8148 4306 -3610 -5774 4454 7976 -1965 2040 9158 -2189 -9297 7790 7378 8416 -2928 -7450 -8256 -9419 -8837 2087 9957 9236 5714 6133 -3419 6633 6939 3507 -4098 4522 -7178 -616 -6325 -3857 7525 2968 4988 -8587 -2638 7825 3125 -4080 -9609 -7828 -7276 -5857 2343 8959 -8321 8830 -6885 5961 6452 -5760 7318 3502 4250 -8645 9231 -4510 2878 -3130 -236 -864 -4311 8601 1658 1059 -482 -1888 3928 275 5912 -505 -3429 3563 -2057 4201 -6023 -1459 7903 8148 7350 -8370 3236 3880 -9094 -8676 5239 -229 -7320 1759 1220 9440 -884 -9090 8341 3938 -7540 4440 -2961 1165 5351 1133 9147 5989 4945 -6458 -5550 1636 855 7791 -8279 -4681 2811 -6803 7047 6527 4401 6032 819 -9191 -8416 -3401 6666 -2668 -7440 5768 -6461 -5743 -7895 -1211 -4001 2484 2190 -2388 4386 7424 6975 -5572 4094 8001 -4411 -4972 -645 -1216 9264 -8208 -5151 -257 3007 2884 -3856 -9173 9061 7624 -7906 -5 -2955 1905 2873 9149 -36 -6991 8799 -478 4153 -8244 7721 2331 4582 -4887 1349 3421 -793 797 -8761 -3382 -5480 -3032 -1969 -7603 3327 2278 -8737 -3869 5114 8107 -173 889 -6401 9478 -487 -5669 7708 9684 8382 -3961 9299 8677 9076 -1776 -9004 3015 -4068 1793 -1654 6517 470 796 -1798 9616 3116 -902 -3197 -9207 3067 2791 8221 9579 8005 -2396 579 8100 6497 2515 3053 -1498 diff --git a/longest-increasing-subsequence/input/61 b/longest-increasing-subsequence/input/61 new file mode 100644 index 0000000..92fb586 --- /dev/null +++ b/longest-increasing-subsequence/input/61 @@ -0,0 +1,2 @@ +70 +-9681 -3317 424 -7477 -8185 -2217 -2060 8455 -4806 -8576 9164 -4143 5879 9271 -9690 2488 212 5319 5530 9084 5876 -4269 5171 -1994 -1145 -8779 2862 -1434 9427 880 1788 9000 -1860 -9090 1314 -890 7800 6160 8748 -1612 -3778 4216 9337 -1487 -5102 151 7766 6907 113 9884 6952 -6754 8506 -9739 -3212 -6247 -2199 7718 -5439 1051 3895 1566 -7323 -9689 3074 1334 -6643 -3496 7869 2359 diff --git a/longest-increasing-subsequence/input/62 b/longest-increasing-subsequence/input/62 new file mode 100644 index 0000000..a4e6a56 --- /dev/null +++ b/longest-increasing-subsequence/input/62 @@ -0,0 +1,2 @@ +113 +5914 2645 -5874 -88 4740 9939 9614 -2813 6179 7505 -9599 -4642 -7215 7033 8967 4063 -6054 -3739 9561 -9569 7722 1258 1863 3320 -6085 6000 651 1747 6694 702 8053 -2228 -3982 -6807 7795 195 -4000 -6267 -7985 -7587 -1507 -5625 -7613 7540 -8339 -1804 8279 8179 3088 -1327 9982 2041 -4025 7907 6021 -9786 3754 766 350 6905 -591 -156 -7378 -9726 6826 -2316 4534 1885 4968 8524 4002 9739 -6868 7038 4773 -8775 6634 -5232 8757 4049 -8599 -358 -1113 3587 -251 8869 429 7222 9313 1264 -9197 7705 -2219 9345 1554 -5697 3939 2159 -3636 7578 -2245 2605 -1439 6553 707 -5509 -2904 2632 7899 -2400 -2603 -4667 -8065 diff --git a/longest-increasing-subsequence/input/63 b/longest-increasing-subsequence/input/63 new file mode 100644 index 0000000..2e13606 --- /dev/null +++ b/longest-increasing-subsequence/input/63 @@ -0,0 +1,2 @@ +374 +3705 9206 -5232 -571 2111 -7135 -6238 -8454 6054 4653 5749 -1452 440 5958 -1950 -6346 1581 5127 5445 -5472 -2923 2596 -3912 1423 3445 1749 2533 8771 692 -5780 113 -7223 -2928 -5771 -7646 8434 567 -286 -8273 6360 -8897 -3501 5458 6835 -8354 4046 4644 4443 -90 3874 9409 3339 1497 5270 2646 5973 5002 -9351 1620 -8827 -4784 -2053 -7675 8761 -8856 -4934 -804 -6405 -7176 -873 -9710 1026 4690 -8246 3224 1629 -4845 1441 8397 9066 7438 -742 -6332 5173 -1433 -2617 -1083 -2916 -5182 -499 -1005 -5343 2771 -826 5726 1495 -7579 8547 6807 -4138 -1335 -6991 7596 7626 6866 -5296 2060 -6386 5536 2339 8704 -5356 -7815 -5006 4868 5384 -724 4480 -1964 -6899 -4997 529 -9965 -633 -3444 3272 -6869 -566 -1984 8593 -3764 1527 30 -5482 9559 -9109 3730 -1049 6273 4210 -2336 1415 -3654 6731 -9714 -178 3793 7468 4398 -36 -6021 5130 -1783 -1154 -7158 -4260 -7304 7097 9951 4304 1148 -3248 -140 -9546 4511 8031 -6581 -4413 -3484 -5201 -3527 1134 -5172 -5998 6879 2170 2048 468 1475 -7070 -6078 1963 -1982 -76 9340 -3587 8649 1960 -5022 -4682 4218 7460 -1529 240 -4570 8067 -5304 -9449 -2877 -4808 9466 -8876 -6575 6603 1529 -6177 -9379 9530 1388 1360 -829 7651 -2977 -5303 -1166 9192 -1442 -6470 4363 4727 -5951 7472 6132 -9000 1048 2230 -417 8936 -5112 -5498 -8073 -8993 9920 -6045 61 3609 7358 4401 -495 3402 4757 6516 9217 8767 -606 7836 -6449 -7216 1616 9583 2316 7964 -3549 3876 5704 8934 7634 -6112 -2387 -7605 5856 8099 2792 5789 -5696 -1779 -6875 -9933 -7281 -8966 -4958 -3916 3917 -4887 -6952 -2822 2020 -1235 -823 6701 5749 -6607 -1285 -4515 7569 -3756 -8636 -3366 -6917 381 -7837 5845 -3097 -7279 -3777 -8468 1732 5563 -5859 8129 7166 8989 8023 3358 -2764 9662 632 -8965 -221 -9957 -1504 -2192 -9173 -3166 5993 -8030 -3101 6466 -925 -312 7118 -2222 4183 2846 -3529 -2044 6621 7518 -6755 6669 -582 3326 7386 -364 -3 6290 -2348 -1695 3000 3416 -5872 1014 -9732 -4931 -2671 -1969 6627 -3588 -7793 -3021 4456 8159 -3346 446 -8570 7982 8958 -8792 -9996 7857 4067 4983 -2296 9019 -9759 -3132 -7140 8867 -5448 -8597 -8490 -7033 -9121 -1354 diff --git a/longest-increasing-subsequence/input/64 b/longest-increasing-subsequence/input/64 new file mode 100644 index 0000000..95348c4 --- /dev/null +++ b/longest-increasing-subsequence/input/64 @@ -0,0 +1,2 @@ +728 +9146 800 3311 -884 808 -3011 152 -7076 2412 356 6806 2424 -1886 -6941 1556 9778 -1481 4860 -3457 7398 5227 -7870 -709 -6990 3836 5498 7266 -6586 2353 5743 6050 9638 -6438 -4396 -3700 4005 -1134 3260 2575 1497 9281 5475 9414 3336 -6871 -7358 8534 6521 7568 4507 -6550 -1057 398 5111 -1198 1107 -1205 -1665 645 6292 -6944 -9035 476 -3693 -985 -1737 5402 4629 5110 -7232 9088 -5333 -4974 -2953 -6010 8595 1542 -5281 -5147 -3392 -6690 -9387 -1835 -798 432 -8562 8422 -4010 -5769 8937 7048 -429 -9508 -7451 -6986 8007 -9399 -2858 -4601 5797 -890 1390 -8100 -1722 -6700 -2221 6401 -482 -4543 2353 -5641 7009 547 -9336 -5813 516 3768 1728 4332 9925 -2584 -4430 -9732 -3105 848 -8537 6162 -6255 -3097 8122 -1847 -6816 -9390 -6679 6275 -7637 -6250 -4134 4674 -4672 3455 -9336 992 -3068 2651 983 9812 4114 6663 -3970 8297 -8378 -2244 391 6469 6792 -5839 -5018 -8365 -6430 -6313 -1664 -8195 -5896 8819 -9774 9180 -5568 -9116 9823 -8203 5779 9773 4559 1569 1503 -3556 3074 -6432 1502 -8800 4556 156 -4532 -5855 -6187 4561 7123 -2592 -1993 -870 3747 5260 -6560 -5822 -2406 8720 3480 324 -6862 -2510 -727 670 -8553 -1755 7586 -9717 -2312 2855 -5108 2330 6743 -6878 -8633 -8484 4787 -689 -6029 6005 7615 7057 9107 5726 8087 3413 6830 -5836 3596 6434 4197 7485 -6347 -3346 6151 -4184 -362 9601 1699 7374 7740 -1895 886 3358 -4776 5618 -1265 -9433 -1371 -9871 -4014 -8791 -2792 2443 5177 1557 815 9537 -7619 -9459 -4167 8755 -2556 -3783 9719 -2189 5263 6493 -1993 1648 4922 -894 8805 1377 -9714 -7122 8322 2682 5476 -8651 7772 9481 -9483 -3241 -1438 -7750 1823 -6851 799 -6725 -5544 -8227 9566 -8997 1668 6445 -1922 -5362 -4588 1385 5708 8590 -2828 5308 4589 -3865 -6307 -7223 1441 -3993 1901 -9158 -1590 -6003 7089 5987 -3944 -1448 5463 -7573 3354 6431 7828 -433 -4874 606 -7089 -4314 -2992 -5905 -2349 4269 -9293 2049 6745 1911 9071 2074 -1067 7750 -6301 9296 -5356 -748 -5826 5334 -8262 -8797 6069 -1000 -3494 -5558 2807 -8389 3946 5586 8696 4903 -7952 2591 8500 -6041 2775 -2599 2294 7159 -173 -4965 -7313 5247 7157 500 -2674 -9147 -8390 -8986 3509 -9832 -4763 -6265 5929 2468 -2773 -4803 -3442 -296 7771 -3027 -333 -3862 651 5418 -1256 727 -7283 1700 9288 -9078 -6952 6680 43 -1114 24 4140 -2719 5001 8284 2773 5375 9512 5254 3409 -1932 -8337 4291 -975 -9260 -8368 -3710 -6108 6704 830 -1830 -5559 -587 2332 8177 2578 6005 -2116 7223 7444 3227 1738 6262 -6436 3940 -4448 -2965 87 2710 -6645 4629 5198 7837 -7832 3896 5090 9766 2183 9882 9167 5533 1547 -2433 1551 -4568 5097 7092 -2732 7911 -689 -3790 3526 4412 -7533 1174 7325 1985 -1824 1518 2615 2650 -8781 -136 -1466 -1689 8372 -1782 6501 9712 2064 3152 -4843 4698 8639 530 -3108 -3220 1749 -8155 -7559 -2251 -2196 -4160 4680 3757 -8920 -779 6747 -5048 -4396 4127 4220 6234 2113 6941 -8373 7820 3169 4245 -3962 -3913 1088 -2211 8822 4358 7814 1381 3402 -4998 7350 -2851 -2576 -5214 7074 -7656 -507 3962 4403 -6248 4932 9169 3388 107 -427 -9218 7036 1426 -2965 -734 -2880 -9712 7765 4961 1703 -8091 4665 -8060 1675 799 -8572 -1158 -5471 -1802 6756 508 -355 879 7034 -4981 -4172 8764 -5903 -2598 -8822 5178 6232 4230 -7730 -7500 2753 3071 -2575 9336 4715 -6368 -4899 2851 3960 1699 5511 3712 -6497 7051 4646 1593 8526 9413 -5752 -1825 987 8831 1403 -3336 4108 -1883 -4508 4352 3620 -6895 3506 4197 6547 -2372 -839 -6406 -4191 -312 1417 -7647 -385 8341 8663 6604 -5801 -2588 3663 1951 -9910 -3312 -9687 6478 -179 5919 -3046 -3424 -2516 2678 -3154 -795 8437 -9742 5777 -1701 377 9814 3671 5827 -6641 -2257 -7742 -699 5497 4096 -3682 -2696 3952 -5919 -5060 3768 -7050 1722 5779 -347 519 8560 3623 -1343 4125 -511 -1535 -7000 -7725 -2103 -256 2124 -9387 4181 4618 6750 107 9561 -5281 -1124 -9886 550 8268 7649 -7932 -245 4442 -9044 -3556 2576 9025 6764 -4315 2193 -1829 9536 -5459 -3023 1924 -6393 -6128 -7658 -2715 -244 -5031 7696 -110 3276 4105 -2358 -2338 187 -6072 8933 -7645 9109 9483 -4000 8105 2816 7279 -1578 -702 4847 -4313 9929 -1858 -3070 403 524 6283 -9515 8924 -8834 diff --git a/longest-increasing-subsequence/input/65 b/longest-increasing-subsequence/input/65 new file mode 100644 index 0000000..69349b7 --- /dev/null +++ b/longest-increasing-subsequence/input/65 @@ -0,0 +1,2 @@ +757 +6377 567 -1172 7058 4120 5461 2145 -9276 1745 8795 9032 9372 -4015 1399 -5539 -3175 -1439 -2802 2707 5199 -5248 8853 5557 -2892 35 1162 3190 1040 -8541 -9203 6343 1928 8371 9745 422 -6218 -5945 -4436 7011 -3263 -5570 -9009 -1655 -221 1271 119 -2040 4 -7471 -4982 -9465 -4305 -9235 515 -6877 8950 -7479 -6407 4068 4978 2 -2396 6507 -7290 -9552 7053 -8648 5011 -9516 16 -7272 -5043 -3262 3408 174 -5801 -4906 -8995 8141 -6249 8108 -1647 3308 6293 667 -8214 -2809 -3522 -4928 -150 -84 -471 1604 1303 -5676 -7326 -1566 -9056 3279 5763 1785 9710 -9735 624 4360 -6734 -7531 -814 -3833 -1701 -6884 5866 -6826 -6633 -9717 647 8873 2757 1058 -6176 1539 5152 -9483 8335 -2885 5375 2334 -2201 -3140 -2850 973 -5787 910 1608 -2551 -8648 4996 8360 7649 -5802 -1974 6724 468 5997 3027 8484 -1366 2671 -4937 6583 2485 2678 -4957 2213 -4678 -9026 -7076 3735 8761 -6119 -5085 2095 -3420 -3196 8566 -1243 -9719 3593 9560 -346 9125 -5004 7096 6948 128 -4495 -2343 -3841 9460 5363 -9282 -241 6974 -5629 -6047 1250 4164 -2370 -7057 -2833 -95 8024 -8164 7036 4536 5081 9299 -7444 4335 5513 -1410 6939 -8044 -5822 6776 -4639 -7027 -4399 -1808 -7468 8868 3812 -7140 -5218 1543 -7146 3174 9469 7885 -4312 2111 6231 -2191 -8727 -9532 -4464 4030 1867 5266 -3963 9085 6305 5719 6833 -4788 7206 9623 -1439 -8788 -2427 -7489 -9005 -5005 3595 -1905 -1370 -2011 -3107 -5423 -7138 -877 3627 -9305 -3573 -7481 178 3561 3615 -9104 -7846 3529 1436 -4144 -4252 -8717 -666 0 9249 9169 7130 -2360 -1471 8404 -4235 5988 -4729 -551 5252 721 2210 1513 -9245 3696 -6859 5610 -4537 -781 -3202 7613 -4806 5436 -721 6128 -9149 3419 3991 7226 2978 4862 -8860 -8257 7861 1542 -8070 -7300 -9896 2807 -8816 -3945 -1061 7336 1240 -2188 8849 1222 7513 -5783 6750 5075 865 -8860 8024 -7965 -5625 6646 -8858 9550 -270 6955 2737 -5539 9151 4017 5262 3498 -9998 -2705 -174 -9466 2989 8756 4650 209 -8355 -630 -4269 5250 7886 -7371 -538 1553 -1934 3107 -998 2112 9407 720 -653 5505 1141 1432 -8201 9631 2304 584 -4241 8136 -3835 9991 6400 3797 4930 -2059 3779 644 3397 6376 3546 -3274 3434 758 9718 -5647 7377 -6430 -8931 -1442 -6247 -559 -3443 6744 1131 4100 -8213 2472 3644 -3665 -9910 6360 4893 -9532 6765 336 -769 -8665 -1535 -5738 -2784 -8564 6576 575 1320 -4159 -3830 -3503 -7559 3952 7388 297 2368 4090 4545 5448 -4829 -7564 -9217 -4065 -4474 588 2024 9549 -4371 -8269 8933 2744 -8294 2331 -8356 9439 -719 -7654 -4565 9036 9129 -9816 -7739 6190 -9125 -524 -4453 -74 -5018 -1289 1716 -5432 6920 5871 -2993 -1911 3442 3505 9331 -6320 -4260 8981 -7837 -229 2440 7120 -366 7234 -440 -2885 -9951 -9506 1131 4981 1515 4602 4931 3724 -7522 71 5688 -3971 -7001 637 5922 8512 7903 -6762 -8390 -7214 -6245 6568 385 716 -9759 5971 2219 -2995 7360 -7038 -1892 -4164 -1806 6886 -9875 5968 -4736 -3113 -3916 4527 4239 -4030 1257 -26 4439 -7232 -9854 -1613 9896 -5583 485 -6527 9543 -7904 -1857 4744 -7980 520 1382 7266 4046 4760 3111 8350 -864 7993 -159 6175 -8892 6337 -7969 -352 7838 8546 7023 3846 7198 2608 -8644 -427 4920 -7047 -5853 -704 8348 -2767 235 8203 -6631 -9991 8753 -6313 -4727 -666 -6978 5504 1211 7359 5389 -4427 -1752 4739 6202 1718 9062 5685 -272 7558 6603 -8814 -9971 -1490 -9591 6679 835 4072 9262 -1056 3652 -8793 1066 -1667 5304 -1600 1298 -499 1554 1041 -8521 9389 5504 -7905 -840 6829 -5964 -9878 -8097 670 612 9666 -5040 3044 -5869 -6355 7256 -6161 7540 -5988 3826 -1258 8 5190 -1923 -6164 -9707 -5912 -8268 5359 5960 8111 -85 -2299 3946 -2173 -4763 -9821 7755 -7944 -3180 5120 6295 -6536 -7549 -434 3903 -5704 -4489 6065 3758 -1769 3624 -1446 4692 9473 1367 -7414 1353 -9947 2897 -9243 -5954 -9215 -7848 2408 -4393 -9074 6429 -9637 -8213 2748 -4546 6710 -8862 -7451 8692 -3206 -4894 835 -149 -4211 -7195 -4375 -3567 9253 1490 -3371 6540 -3882 578 -6126 723 3342 -6304 -9355 -6565 8166 9403 1576 9743 2324 -8523 -1825 -1051 2295 -5426 -1722 6311 4842 -2327 -5321 3788 -5294 -2402 5092 4342 1692 -1774 -4881 -3412 1855 6812 -1573 -8795 5834 -5877 -3741 1669 4674 6640 -5684 7159 -5826 4816 2561 9575 -4614 778 -9857 -6483 -902 4436 3957 -7493 8740 5474 -7886 -3787 -6176 -8792 -7891 7496 546 -8454 5980 diff --git a/longest-increasing-subsequence/input/66 b/longest-increasing-subsequence/input/66 new file mode 100644 index 0000000..f9d25f6 --- /dev/null +++ b/longest-increasing-subsequence/input/66 @@ -0,0 +1,2 @@ +641 +-4281 84 -9992 9878 5796 8727 -2961 -6401 -7263 -1111 -2126 -9052 7784 -2752 9911 5782 6183 8405 1769 -524 -9455 -2927 2126 -4786 -953 3301 7165 -9096 -2180 2591 -6759 -3840 5829 -5377 790 5260 7257 8524 -3354 7934 -6823 1316 -9044 -1699 -2049 438 1927 5538 -7938 -4338 2978 340 2880 3421 -4028 6986 2845 -3288 -6238 -1580 7411 4789 -9297 -6414 800 -8135 -4343 5108 -8815 -3499 -9989 707 3045 -8195 2321 -4775 -5265 -7230 1248 -8517 3720 8716 5704 6135 -2408 5400 3565 -9080 -2247 -3992 -3444 -1860 -4274 8979 963 4475 155 -9182 8237 748 4054 2753 -6847 8247 9358 -3842 1427 -1993 -7604 -872 6271 -8736 293 -3770 -2682 3274 -9880 1433 -1540 -4515 3618 -4579 -9607 -1814 5738 6294 1338 -3750 -9336 6329 -764 7376 -2486 1650 7911 -981 -2836 9086 -5228 2314 8270 3314 -3738 -2143 -7615 -458 6722 6798 -628 -3707 7757 1694 -1722 -4210 8232 -1049 3044 -3246 6409 -4498 969 -9022 -1741 -1338 3852 3266 -9246 -3452 -4146 8374 -9022 -761 -7218 -7063 -827 -908 5867 966 -4773 -6533 -6641 5762 -7791 5095 4501 6454 5983 -937 2126 7322 -2216 4391 -9153 1937 4133 4793 3846 -6122 3747 -2504 3670 -4918 -3253 5151 -2347 8738 -8938 -9055 -9886 -3745 -5403 4961 -4977 -4629 1553 -5033 -4887 -248 -9738 1338 -9419 2992 -504 -8303 1012 1304 -8580 7384 1971 2966 -3063 2849 2292 9332 7898 -5415 6401 -1068 5474 5042 3908 8382 -2185 5115 -4261 -7263 430 -9772 -884 -6904 2931 2174 3047 -507 2354 -7020 8342 -1326 -4901 4117 4933 -1629 -9738 -833 2847 -756 -4144 -2098 4371 -8965 -1729 4442 -5927 7742 -9956 5279 -6195 9594 -2635 4047 -7119 -5991 504 6514 -3432 985 7072 -6052 2334 1012 4933 6817 -8149 -9333 3205 -6492 9228 -8754 -6600 -7986 -156 -4385 -6805 8168 2274 8433 639 -3919 -6571 -2324 -7410 -4946 1325 -4834 5371 -9912 -3749 906 -1435 1154 9623 5686 3890 8587 4652 1181 -3064 -5077 -4040 1105 -9097 3525 -6765 1925 8735 -8903 -3959 5904 8750 -2409 -882 8798 8445 -2216 -9996 1347 7103 5975 -3425 2896 1997 -3509 2225 1540 9782 7357 -2171 2735 5997 7948 -9970 -8691 -2496 6140 -971 -4956 4635 6594 3842 5605 -6568 7408 4947 5389 -7023 8536 -8305 4768 -3773 5609 4020 -3119 -3290 4271 -451 -5817 3276 167 -5098 2718 -7302 9808 6662 -2658 851 -1749 -9244 6637 -169 -5280 9664 2548 2888 -847 8841 -6652 5939 -3367 7371 -6482 8826 4916 -2045 -1624 -8489 1303 219 2839 8920 4686 -8290 -9615 -7739 2551 -2716 -9041 -5109 -4466 9418 -8742 3254 -6431 1672 8467 3074 -8671 -5298 7719 -50 7740 3369 7684 2198 -9199 3921 1550 -4557 -322 2175 3552 8758 8149 6123 -2574 135 7033 -3563 -2416 -7948 -7776 -8926 4254 4614 9083 3042 7270 -8115 995 -6892 4169 -712 2321 -4003 6996 7674 -6768 5118 3935 -3905 -1519 -620 2875 6639 -1854 -9735 9549 9206 2192 -6694 5196 4242 8889 -4423 8003 -5925 -2017 7683 1850 2361 -1310 537 -8797 156 -338 3946 -3710 -8116 -3387 8423 1460 -8066 -3626 -1953 -7068 7590 -4022 9708 7283 -6978 -7451 7685 6417 9135 -1948 -2755 1670 -4399 7064 -516 -9165 -56 3961 9879 -1496 8706 1941 -2884 8954 -6808 -1472 5996 -7613 4605 -375 -7298 -3890 -9534 -9345 -4682 -1003 3900 2539 5128 8229 4632 -5062 -2653 9292 4070 5585 8209 4394 5469 -6739 -7126 -2595 6656 3528 7606 7553 8925 9216 7253 4546 -5651 -4948 -7124 -9815 -889 3140 -8081 -3653 1432 -5458 1668 -7240 6217 3459 4786 9348 -7928 5870 -610 5269 -8552 -5953 7477 2749 8484 9652 -1645 -8034 9296 -4622 -1490 6407 -1148 -7427 -1187 3609 479 -302 -1579 -7950 -2264 -4328 2912 -732 -556 -2330 1426 -7750 5001 -9600 -5476 7681 -223 8334 -1203 -2472 8479 3262 -628 9620 3157 3743 -6006 934 -4070 9873 -2249 diff --git a/longest-increasing-subsequence/input/67 b/longest-increasing-subsequence/input/67 new file mode 100644 index 0000000..8887b92 --- /dev/null +++ b/longest-increasing-subsequence/input/67 @@ -0,0 +1,2 @@ +235 +-8669 4416 -906 2536 1220 -574 8854 -1157 2186 -161 2492 -1804 -5068 4090 8508 -8248 -4662 -8867 -6804 222 -1182 -5304 4774 9027 6032 -1004 -9866 -2454 4282 2630 -9963 8726 4224 -5552 9650 -292 -3070 -9680 1314 -2718 -5504 9701 -5255 4650 6905 -5239 -1644 -8064 3462 5086 9648 -5630 4840 1405 8835 2157 7753 4253 2056 -5822 8135 5568 7567 -9605 8712 8317 -2077 6460 -1463 5502 1080 -8702 2347 6810 6285 -5270 9239 70 5937 -6599 9554 2049 -703 -6231 9184 4823 8199 -7245 1881 -909 8344 -749 -7299 9685 -4525 4878 -9795 -3128 1741 -2171 -3512 -4970 -3824 9834 -3165 -7874 -88 5655 -199 -7796 72 6951 3093 -2444 -7390 3838 8440 6405 -9568 9 -466 7295 -6998 6051 -3023 3738 -8519 4516 -1081 4443 -8436 -1988 -7456 3662 8933 -3665 3991 -4290 -5881 1344 1391 -9777 8336 -6730 4410 2878 4821 4843 3302 1809 -8702 4311 6950 8282 2498 4161 -2996 -8891 -1764 -1910 -5343 -3350 5736 1755 8706 -4990 -1623 -4977 5954 -8764 4665 1167 8843 5123 -1399 -5377 -8231 -3679 -9129 347 1282 -7285 5268 -8120 -5559 -6821 -2826 3190 -3896 1822 9086 -253 -3858 9293 3184 -4421 4967 -7159 -6150 1252 -4343 6779 -6228 -5552 -6786 8412 7879 -9231 -7374 -9520 2597 -392 1332 -1489 6077 5157 -3959 -4642 5135 6823 1405 2926 -7195 -7560 -2004 1515 -8403 -8365 2892 2272 -7616 7005 1162 -6096 9339 diff --git a/longest-increasing-subsequence/input/68 b/longest-increasing-subsequence/input/68 new file mode 100644 index 0000000..7436ef6 --- /dev/null +++ b/longest-increasing-subsequence/input/68 @@ -0,0 +1,2 @@ +843 +-2245 1474 -6208 -8980 -670 -4213 8418 -8558 -1957 7087 -6108 -1193 -7020 1626 -1510 -9468 8317 7888 -6054 -5091 -1308 -5782 -5486 -1734 6928 9035 -2010 3703 9678 -1769 -2309 3959 5263 2652 -1400 4139 7050 6400 4574 -4522 3709 -7340 -2515 6370 5658 -1526 -3300 -6924 -7352 2101 4060 -6146 5224 1209 -7515 933 -1421 3709 6585 4893 -5411 5298 9411 -7227 6364 -183 5497 -6507 3587 9705 -4816 2054 -3777 -9735 -8726 3204 -6104 -949 9429 -8949 9006 -3381 -2782 8483 7127 -1324 -8406 9162 7249 9982 9030 -7191 -3744 56 3812 9900 3593 1813 9767 -56 3368 1009 -9447 7153 9939 -3933 -5595 -8097 1300 -6370 -4525 2649 -3513 -3173 8506 6920 -7847 3543 1992 6271 -5051 -5175 4930 -8752 -7816 -9349 7025 -6945 -8412 -4285 6289 -643 7977 6564 -9143 6873 -8036 -6359 2378 -1895 6583 -3653 9451 -7724 -3281 8894 -8684 3530 -4994 8956 1602 -2788 6186 -4732 -4926 -385 -5249 -3689 -7742 7007 1878 -3028 4307 -8367 2168 8248 4883 5233 -483 -887 109 -5661 -3211 5075 -1798 -4262 -2405 -4874 -7182 -4235 -8482 -9089 -5109 4911 9631 900 -2076 9620 -8102 6724 8347 6408 -9186 -7984 -1242 -2543 2553 524 850 7748 -6883 -1373 6959 -3793 -3338 5531 9272 -9255 6896 -9513 182 6239 -2081 -4525 -4731 -8035 6054 -130 -8741 -8361 -620 -6863 -5931 8112 6448 -6710 -6750 -5786 -7095 -9101 5856 -5295 -9211 -5152 -5863 -320 -7600 -7878 7209 -5518 -3488 -3083 -2063 -8168 8838 6174 3375 -3183 7781 -7016 5109 -1498 -1037 -7383 4196 -1932 -7950 -4625 -4327 -7371 -4130 -2293 6822 -7751 -5417 -4967 -2596 1503 3046 3108 -3988 5309 8206 9393 -8350 -4698 -6125 -4973 8171 8904 -2598 -7955 2565 -1007 9246 -76 8564 -830 5313 -3574 -5303 -7020 -2255 -1157 3998 -2867 5265 4673 -4686 -4873 -8077 620 -6641 4426 -9848 -8333 -5911 8970 -3967 -2914 -8699 412 -7346 -9217 -9375 -3197 -6210 -5015 -5625 -2213 6814 3787 -9569 249 6265 8719 -1143 9479 -761 -8723 9119 1647 5766 -5305 -9982 9489 -1518 8884 -3176 3578 9596 3368 3193 -6770 -9584 7543 -8394 -4816 -3706 718 -9723 6979 -2874 4406 9507 -2283 -4519 -7524 8082 -6879 -8419 9213 8153 3706 4188 -6179 -5451 -7535 6553 -9548 8463 2105 -5203 -8774 -1408 -373 -1198 -1282 2250 -7265 -3597 9144 -6049 -1144 -8096 7705 -5644 -925 4577 -4927 3066 6881 -3280 -7178 5392 -2072 -5533 -2680 7885 -4792 -9702 3562 -4937 -7018 -5530 -9321 -8165 -6101 -9922 -3453 -206 913 -7386 570 5127 2433 8914 8921 -6045 5119 5304 -5807 8125 2000 -1469 3830 5396 -3501 719 -4720 -5340 -7089 8648 -5432 -4534 6927 -9388 -6173 -6177 2581 -3610 -8453 -6729 -4469 57 900 9484 -7155 5747 901 2571 -3307 5556 -68 5065 7739 -697 -3688 4274 9000 9931 7497 875 -2289 6835 -9765 -3847 -979 -6772 2134 5789 -164 -9577 -940 -5005 -3698 -6311 -8714 400 -8905 -4805 5600 -5223 -4270 -6893 -5276 8051 2879 5674 4859 666 3815 -6129 4833 -8769 -4214 -25 9198 -2335 8186 -5003 2453 92 2439 8858 248 3714 -3694 5313 -6695 6087 3452 -7170 3965 3918 2419 -2703 3685 -1168 -8031 -5093 1759 -7988 -9324 -2852 -6899 6510 -1370 -5644 -6335 -7332 -7357 -6960 -6646 -7500 -9366 2977 4953 1985 -9597 -6808 -9189 7041 -1477 5959 -8870 -2650 -8575 6692 8530 1914 -9784 3391 6773 5236 705 77 4895 -7910 -3128 -8693 -3932 8683 7421 1436 -3076 -5893 6274 -380 -7540 2948 -3032 1751 -7523 -9081 -7335 -3211 4275 5039 -4394 7540 -2983 -9747 -7464 -5599 1031 -1505 8715 -9103 7820 1880 8051 -3704 -5484 -2785 2383 2979 -1516 7962 3081 7443 4293 -9485 8321 -7445 4389 6781 6752 5441 2163 1810 -1459 -7235 -5627 4300 5643 9163 -4615 -9562 8906 -7015 554 1353 8281 6357 -5444 4830 2758 -4651 -174 -5085 -8066 495 5210 -5171 -7244 3180 723 4297 -4130 7099 -6225 7141 -9496 -1 7793 5849 -8916 6340 9848 993 4915 3628 7675 -8759 -3129 -6761 -5959 7698 3669 -3336 4394 5431 3453 -2130 -9288 -7258 -1024 -9481 1816 -2593 145 -9268 -2984 -9362 8146 -8247 6790 -298 -2363 5292 8423 -9849 3479 932 -4503 5166 -6458 370 -9103 -1629 6257 9086 -4112 -5705 -7620 4785 4227 -3204 -1119 -8454 9140 -1353 -149 -6244 1454 1096 6833 5191 2820 -2484 8032 808 6757 -4388 -7779 1284 2485 8434 8981 5572 -9986 -1622 -2974 4741 -4705 110 -4108 -8791 -4202 2186 -5794 -1521 803 -3088 155 -1933 2620 -9982 -4150 5089 8741 6013 -986 -7619 8057 -176 6779 -8495 -1637 5678 8608 -4468 -710 -4531 3727 7301 2451 7211 -599 5936 9223 2344 2829 3101 7892 4453 -8889 -9285 7845 -6876 -4770 -8885 2177 358 -6382 5955 -7493 434 1372 3807 -6417 4537 8557 -2608 1937 -4559 -7254 -1269 7131 4785 -4829 5854 -1235 2457 4030 2060 -9600 8228 7720 5420 5859 1421 -7094 2455 9805 7360 8913 -8411 -1855 -7425 -9484 -7052 454 -3387 -6516 8268 -4852 -8894 -6736 1766 2997 7441 -6404 -3076 6962 -4061 -3405 -8883 7434 -2280 5373 -6698 3099 2346 -2338 7702 251 7787 -1868 1470 -3659 -1593 diff --git a/longest-increasing-subsequence/input/69 b/longest-increasing-subsequence/input/69 new file mode 100644 index 0000000..6323ffd --- /dev/null +++ b/longest-increasing-subsequence/input/69 @@ -0,0 +1,2 @@ +229 +-9285 2964 -670 -4297 -5361 -5461 -522 6236 7494 -9653 4853 4246 2213 9419 9678 -5458 -5862 4861 5100 7721 9093 -5198 -633 -3219 4556 3420 -9846 6832 -8146 -7748 -2308 -7958 -4608 -3632 -623 -7961 -5858 -8431 -9506 -1851 4973 7384 8873 1855 -837 -6973 5326 -6370 627 4746 -2007 3142 1106 -5358 3003 2381 8393 -1475 7034 -5749 3099 -6769 -5233 -9976 -768 223 6762 468 -8141 -646 -7518 7322 -8031 3084 8128 2490 7755 9125 2461 -5373 -6373 2946 -7099 -2175 2915 -2985 4338 -1599 -2672 -6830 -9791 405 -7319 5582 1381 -8770 7201 6243 -3573 186 1679 -8548 3446 4264 -8876 -336 -2381 -6299 3609 -6415 -6481 4532 8282 7944 4409 -6315 -7928 5904 -9539 400 -770 251 6211 369 1361 4930 7427 212 3081 9913 4137 8960 2361 6310 7118 -4518 5036 -5333 1067 8307 3052 7661 -2643 4135 9197 5112 6342 9297 -110 8704 8518 -2220 -1480 -397 282 6677 -3984 4181 -7426 6174 7386 -5345 -4643 -1629 6229 4619 -4623 6209 -8530 -9783 -4909 6093 2647 7616 3668 2558 -588 -6535 -641 6552 -2765 -2458 8212 -532 4368 2037 1910 3719 4269 -6181 -7745 2726 843 -8353 -9982 6949 -2460 8287 -511 -9589 -8036 9574 4943 4571 -5085 -994 -4014 -3984 -8121 6766 -2815 477 -3960 -9296 -4591 4417 1779 2060 523 1797 -8768 -132 4879 8990 4930 -5348 4658 7672 -2457 diff --git a/longest-increasing-subsequence/input/7 b/longest-increasing-subsequence/input/7 new file mode 100644 index 0000000..d729a3e --- /dev/null +++ b/longest-increasing-subsequence/input/7 @@ -0,0 +1,2 @@ +112 +4346 -2944 3959 -2780 1099 -9402 -7238 -8548 -2917 -3821 295 2713 -8661 -856 3945 7651 -543 -8216 5024 5798 -3384 8583 5955 -1208 -385 3068 2968 340 -272 6559 5075 4537 4343 5126 8281 639 2572 1700 9317 819 -1316 -9854 -1137 -3421 718 9368 2294 -8164 -6369 7513 6565 9525 -1352 5554 -1609 -9745 -9663 6735 2511 -8215 -9994 2080 3296 629 -4812 3474 -6283 -1688 5290 -3518 2625 -6421 2867 -7497 -7999 1083 4777 4105 2020 -3780 3144 6817 5035 -8028 5857 -9678 5723 -3602 -2861 6115 -8199 8109 -9929 4601 -6350 3819 5575 -1173 -9608 -2422 -9939 7026 2756 -4668 5423 -2597 -6125 -9578 819 -9810 5083 2252 diff --git a/longest-increasing-subsequence/input/70 b/longest-increasing-subsequence/input/70 new file mode 100644 index 0000000..7527c45 --- /dev/null +++ b/longest-increasing-subsequence/input/70 @@ -0,0 +1,2 @@ +286 +9301 6314 -3572 -7075 2142 -8802 -8981 -417 -3109 -1339 2711 -6508 6926 -9768 -8592 7420 -17 276 6525 -1653 1020 56 2364 -6282 -2420 -7499 2196 8644 -9304 -5447 -5353 5618 -2661 3189 -6274 -5688 -5203 7542 -6667 -7665 3991 -614 2903 7881 -5590 6838 567 9646 -1127 -9870 -3072 2045 -5951 9744 6406 499 -1076 6038 -4683 -3106 6710 -5691 7459 -9539 -3896 1888 7462 -9197 -5358 -5591 -1640 -1732 -6438 2544 -6994 -2892 -6496 -2906 -8554 6722 7702 4972 -6252 -2984 3805 -4814 5188 -3828 2020 -554 6044 -3131 -8833 -2655 8268 539 -7894 8049 3999 -5992 8780 233 2225 -8000 8938 -73 9499 -8035 -8318 -3872 -7691 -5398 6193 7007 -3217 997 2582 -8839 2591 7626 7232 -9127 7710 -2871 -3403 1161 -3255 -4709 4 9541 3313 8125 -951 -7115 -9274 3603 8351 -111 5405 -4537 9878 7033 21 -8771 5217 8067 8441 4943 7450 -1670 1073 3107 -1313 5923 2098 9661 -9815 971 -8824 -7491 -7644 8300 5633 3937 -816 9354 -9809 -109 -656 -4490 6609 -1469 8290 -6232 -3780 -1801 -9335 1016 7254 -6578 -4298 8350 -5855 4629 5677 -5768 1473 8735 6524 -880 4054 -6326 9474 -9428 -261 628 -7909 2205 211 -2943 5786 -4855 -9432 -3309 3207 -8195 -8147 -8153 962 8932 1444 1279 -8005 -9502 -4065 498 3325 -3750 9073 1753 -1856 -6849 -9722 -6259 2092 -5535 -3251 6508 1718 2723 -6172 3917 -2611 6302 5191 -6438 7329 -6516 3155 1766 2188 -2118 1547 -3360 -8393 -1309 -5035 5270 7450 7149 6031 3349 -80 8969 2990 -9098 -3131 -8685 -5331 2534 -2056 7535 1417 8466 6733 -2016 -1380 2428 9812 1080 -5296 9213 5898 8609 -4531 6515 1560 -5530 -1692 -6175 5292 4296 -9507 -446 -1096 -3419 diff --git a/longest-increasing-subsequence/input/71 b/longest-increasing-subsequence/input/71 new file mode 100644 index 0000000..acd031c --- /dev/null +++ b/longest-increasing-subsequence/input/71 @@ -0,0 +1,2 @@ +342 +-4523 -2961 -6396 6749 4595 6490 -9853 -1345 3819 7648 8191 9351 8831 -3300 -6939 9859 3415 -635 -1175 -3900 -2877 -5588 9147 6316 505 -4278 8743 -399 -588 34 647 1367 428 -6009 -3440 5745 9779 -9825 4431 -1311 -7925 -7468 -2610 792 6729 3956 3237 -3388 9988 -5009 3181 4239 -813 7417 -951 -3649 -7841 340 -5468 930 3435 6560 -5685 5069 -5789 8143 6312 9722 -9929 7455 -234 6592 -9380 -443 -5279 -2681 -3191 8485 -1395 -5831 -4309 3900 7815 551 9883 5724 4633 -3249 -5988 2721 -2616 -3509 -1706 -1864 -2549 1072 -2952 -1434 -1006 -4173 -1484 -4649 -1949 -4198 3071 6882 208 9093 -7359 9374 -7978 -8352 4400 -8173 -9448 -1158 8411 -5009 2387 -7482 4683 9042 -141 7576 -4181 -660 -4709 118 -2419 9215 625 -6335 4930 722 -9185 4743 -310 -9020 3282 5900 1551 8391 -1436 -1595 3353 -799 2073 698 -7810 -8877 1509 1909 6205 -3859 9840 -8999 -5572 -6335 -8149 -5949 1477 -8469 -991 2745 -2942 575 9142 3727 -2328 6290 -3340 5654 -899 6866 -4608 8758 5734 -876 -7221 3410 -8466 -6277 9207 -9073 1798 -722 -6499 -9956 -9748 -6005 -2546 4744 4265 2810 8435 -5025 -1553 -471 -8157 8361 -5644 -6471 4940 9198 -1281 6084 1213 -6865 4536 8036 -5863 -4618 832 5958 -3102 3368 5583 -4090 -5304 -2772 -3389 765 -6201 4913 -8800 -4526 9435 -7227 4715 -2309 3006 -3431 3943 2498 -4626 6846 2620 -3759 6146 9417 -9622 -9148 4648 6605 -3433 -8432 -9262 8107 6184 -6839 8086 -3092 -3374 -302 -9641 4962 -3949 2581 3367 879 -3530 -8802 -7259 -6866 2907 -6739 -1396 -5514 753 -1076 -2813 -3963 497 9475 6427 -1338 3499 218 -619 -200 2580 5109 8654 999 -8565 -9430 -2213 2262 3452 5079 6824 -9797 1601 -7454 2810 5768 -7274 7811 -3594 -5234 -8318 941 -1317 -4409 5302 968 5176 7584 -5296 2535 3733 -1495 -1104 -1836 -9208 2682 1748 -2327 -2297 -1006 675 -4120 -472 -8046 2912 -3503 -6677 4282 2139 8636 -5913 1534 1952 1096 -4768 -5450 -9591 -535 -453 9440 -7538 7132 diff --git a/longest-increasing-subsequence/input/72 b/longest-increasing-subsequence/input/72 new file mode 100644 index 0000000..04a4986 --- /dev/null +++ b/longest-increasing-subsequence/input/72 @@ -0,0 +1,2 @@ +350 +8754 -161 1750 -9925 -8768 8911 -5647 6102 8334 227 1041 -7732 7020 3432 6342 3672 1558 1602 -7602 -574 1136 4336 3722 -232 -2549 -608 -2625 7190 6354 4959 -9176 7403 5314 -6185 7203 3169 -4864 3606 3544 8556 43 -708 -1389 -319 -5321 3451 767 -3982 -2466 2454 -3147 2744 -7838 3760 -3484 -7161 5730 628 -6040 -3385 -6419 -6162 3924 4741 2861 -7278 -1855 5982 9366 6619 -3240 -5187 -9727 1552 6170 2035 6747 1618 -3088 -9266 -3587 4100 -1859 8106 5314 -9929 7894 694 -2075 -5008 -7210 6163 -1616 4963 -3233 9485 4836 2144 523 -7843 -8839 -3356 -1551 -2900 -7298 802 1226 -4944 7537 9949 -218 -632 4177 -1809 -9908 2326 3322 -1331 -8042 -3480 -2632 -2773 -3602 -1580 -2419 -6722 -1066 9783 784 -8862 8692 4539 -5480 7363 1757 5542 -1132 2594 1021 3844 -8312 -1931 4541 9614 -3143 -6878 5158 -2766 -2275 1178 -2470 9658 9176 -5226 -4671 -5756 5357 1905 -1894 3516 -5018 -3508 -3782 7717 -8553 -8381 -6813 -4000 5493 -9597 -1421 -3552 7240 -1764 -5802 1229 4063 -9471 5959 -1551 -9126 1744 1380 3747 -7108 -271 3696 -5480 8306 9634 763 -1111 -2760 1842 -8432 9493 6154 2663 5273 6860 -3029 -3973 -2252 1071 -7391 704 -4840 5134 -2986 6105 -7632 1033 7169 746 2742 4580 -6540 -1729 2280 -4585 6516 1670 -1871 268 -4865 -569 -1168 8075 2788 1475 -5379 3643 8934 6169 7166 -8231 6810 2435 -8635 3016 2608 -3972 -5576 -5961 -123 -1361 -890 19 -7566 -592 -9673 9902 5586 -2623 6579 8073 1797 4356 7348 -8008 5110 3559 -1720 -6033 -4563 1644 5965 6432 3946 -2286 -7787 4396 6567 -9830 -2686 -6512 1672 2236 -9862 -836 8358 -9524 -3067 -7395 8764 -8860 -1550 -811 8318 2928 -1496 -7242 5785 1851 -3873 -2494 -6925 9384 -4358 -6968 7577 -3870 9071 -9413 -5890 7799 -2487 -5285 4310 2652 -6244 -2244 6488 4456 3963 7031 -5484 277 1030 1392 3315 -9457 -8404 -9728 4970 -6128 634 4576 3755 -9491 948 -9964 8376 -7577 6894 4556 1982 972 7539 8566 5216 3022 5237 2632 -4395 7668 -5068 -8515 9435 -1767 diff --git a/longest-increasing-subsequence/input/73 b/longest-increasing-subsequence/input/73 new file mode 100644 index 0000000..60b7df8 --- /dev/null +++ b/longest-increasing-subsequence/input/73 @@ -0,0 +1,2 @@ +589 +-5354 2192 -7028 -1553 -9164 7999 -2565 -5634 -3183 5288 1735 2652 -3717 1175 -4869 2943 -6553 1071 5839 -3164 2355 -5497 3459 -1870 2009 9936 4598 -1289 -2561 -213 528 3894 7963 -502 531 6573 -3165 -4232 -7028 2967 6555 -5399 2015 925 -3602 -6309 -5185 -288 5654 7619 -3445 6002 11 1323 2887 -4995 -3986 1081 4161 -1835 5918 5324 1043 -5797 8632 -1388 5562 -6499 -2258 -8832 5325 -5978 3425 -4895 -3360 -692 -5096 5004 7945 -6420 -1831 -4226 -4716 -9114 -717 -6456 -8387 -3821 -4818 6014 -4345 -668 -7523 -6614 -9177 2206 5557 8257 -4101 -7308 6220 -8515 -9241 583 3326 6509 -5721 -1924 5311 3083 -8258 -2077 3578 1778 -2212 -5324 -9144 -9752 6735 -1270 4442 -1351 -8723 5892 -5218 517 -3013 9203 -204 2183 1624 3380 -7720 6029 7158 7296 4330 -6978 -8555 7624 -3441 3692 8237 7300 -8467 6995 -9504 8955 -3946 -6327 -1954 8923 6487 -1268 2972 -3195 9247 1496 2897 -2687 -8763 3500 9428 5420 6652 -461 -6109 -725 -5739 -7656 -9632 3259 -2173 -485 -9043 -8844 2828 -5046 -90 -4216 7318 4258 -1501 4903 6599 4305 -3332 4472 6294 -7437 8559 2753 8183 -9113 6930 -2590 -6613 6316 7359 -2356 -532 6360 366 8642 2340 1629 8629 3615 -6578 2182 -9552 2704 -6484 -866 7139 320 7746 4225 6040 -618 2296 -4950 7035 5572 6281 9418 547 -8758 6686 -3344 -1627 9827 7519 -9456 2327 5642 7967 -4114 -1053 -2773 -286 -6316 -665 5160 -4855 34 -7637 -3571 4747 8658 6258 3591 4653 -8144 -6341 5835 2468 4573 5945 -1383 -131 -4864 3412 -2517 9422 -4266 7865 7239 -2133 3369 -2186 -9075 541 -1265 -7536 -8551 1294 2443 8847 -8881 7300 -4343 -2660 8691 2895 -6825 1145 1354 -9264 204 -637 -6857 -9045 1889 -4080 -4992 3762 1695 376 3690 -937 -7913 -1472 5744 -701 -8768 -524 -1934 1093 4859 2158 9661 -6352 -6678 -9 -6965 3353 3633 -733 6897 -6011 -898 9843 5792 -9202 105 6500 7405 -5970 -2292 3391 -344 3989 -3002 -6782 2696 -79 -5767 -9419 -6788 447 6168 3793 8777 1896 1487 -408 -1771 968 -6114 -9730 -5586 -8331 9813 -5452 7825 8428 -4599 -366 -5677 4484 -6011 -5374 7577 8690 4566 8943 9695 9898 -3316 -1898 3158 628 -9791 -9097 2581 3026 7998 -7888 -4129 6229 5752 -6502 -9588 4399 -8021 -1918 3158 -7423 3035 8384 6445 -492 -343 2009 -2887 -3538 -9589 4899 -2527 4533 7953 585 -6625 -774 -135 -6399 7545 -5421 8777 -4103 -5948 -4330 3631 7222 8851 6430 6499 -8099 9862 5296 -5124 -7385 -2744 7151 3142 -7752 -3386 -5428 -5783 5303 -9814 -577 -84 2247 -3731 8507 5913 -3896 5802 -307 2275 6975 -1509 1903 5577 470 -1898 -9953 -1832 -9937 4116 4977 7111 1375 3723 4496 4085 -9317 6497 1042 -9704 -7151 -8198 6317 -3265 -5539 -1274 -3866 2134 2609 2985 -5043 6376 -8372 -8460 -1360 -9620 -4716 -3585 3444 6626 9549 -8149 -8972 -4036 -6873 8069 9534 884 315 -4770 -6252 -9766 -6020 -6257 4830 6342 9388 4619 5423 4579 1076 -1273 -4133 4438 925 -8226 1914 -706 -5386 2967 -9172 8279 -7583 5549 1485 4438 -8464 -5318 -2461 4023 -3101 -4245 787 6917 6326 -8323 2048 3545 -6476 9975 935 -5587 -7225 -3298 866 -9918 -9637 -1590 4511 -6287 -8168 -6721 5422 1771 7753 -2210 5489 -6125 875 8821 5393 6777 -6132 -3296 7006 -2001 5868 -2421 -9871 -5496 3429 -2203 8511 6648 1964 -6840 1937 4764 6205 6133 -792 3326 8103 6996 8732 3306 -296 -7303 6717 -7274 7821 -1678 -9545 7409 8091 4237 6512 diff --git a/longest-increasing-subsequence/input/74 b/longest-increasing-subsequence/input/74 new file mode 100644 index 0000000..64e43cf --- /dev/null +++ b/longest-increasing-subsequence/input/74 @@ -0,0 +1,2 @@ +606 +9644 207 -7408 -4522 4279 -8790 6278 8693 5327 -8146 7021 -3864 2487 -2270 7198 -4960 2596 -3855 7896 -4145 -7539 4896 6652 8350 2223 56 -893 -8465 8465 -2453 3616 -1057 -6572 -1543 -5303 -7517 -4663 9711 8299 1364 -2109 -3144 -2841 -9256 -1507 4340 7340 -818 -2272 -2667 -3731 4791 -3414 -8200 -2118 -4529 -8188 7053 -198 3854 3649 -5610 -9130 8140 9019 9725 -3650 8321 -8198 -1973 3460 1181 -3663 8853 -6078 4585 -6199 2956 3151 -5996 -4677 -2134 -2700 -1847 3200 2033 2429 1382 7853 -3028 -5425 -8183 -3790 -1152 -1714 7608 -4619 -9080 -8712 6448 5382 -7631 -5306 -8700 -4899 9155 5887 9321 -2585 -5876 9979 -9415 6668 -280 3416 -4196 7160 6278 -9287 2206 1155 -7367 4417 5096 -6702 373 1848 -3123 5807 -308 1482 -2757 9897 -6962 -2954 1867 7534 2000 -4234 8252 5503 -3106 -9026 1558 -4706 7623 8985 -7743 544 -3224 -1142 -6499 -7201 -2385 5132 -7772 6348 2385 -8575 -1713 -7965 3657 -2259 -8184 -5345 9787 2968 -2749 -3950 4524 -6622 9608 3788 423 -2333 -5778 -1253 5957 7897 4326 6234 -4853 -5195 -671 5072 1145 -8720 -1992 7237 3212 9224 -1563 -9947 -2550 5183 -1076 8625 7880 -5159 6403 -4621 -291 -4657 2886 6248 9599 4977 2020 5300 4749 -7994 -549 3844 4141 5080 -3095 -6907 9877 1981 -7140 -1555 -2918 -1409 -1239 -9966 -9581 -370 8660 1009 1660 405 9125 -1696 4809 8337 -2974 -6183 2065 -2078 5256 4720 9550 -5334 7620 625 4742 4599 -3203 -1503 -5128 2824 4998 -8217 -1788 -4139 4771 -2678 9739 737 -5086 7383 981 1988 -4039 -8768 -5642 4567 307 -9006 913 -9733 -4622 563 -9010 4947 4815 2212 9533 -9897 -7003 6877 -6087 -9636 2063 6355 4359 -10 -6581 2800 -1837 -9514 425 9444 -56 4854 3940 3690 2650 325 8651 -4791 -1146 -1038 5815 -7326 6987 -3551 -7912 2223 -9067 -4207 -1708 -489 -6939 7971 -7443 -3327 6796 -6664 -6404 -18 -1607 -6668 -4512 -6666 8622 -5747 -5699 4719 8702 -1633 -9069 -1218 -3551 -4350 4469 738 -968 -3218 -5768 5208 9025 -7099 -9416 -983 6948 -4869 -3516 -6864 -8632 4150 -5267 -9961 1009 6480 5161 8039 8533 7319 6944 5771 -4420 -3887 9010 -5407 1347 2536 -2591 4556 -373 4111 -8996 -2798 -7896 -5277 532 -7546 -6803 -3178 -7276 -1460 8899 4067 -5963 4376 7285 -5381 7541 -3916 -8017 -2619 713 4303 -7845 7598 6135 5796 -8676 -923 -7967 -6725 -3630 252 -3910 7053 3681 -707 7392 -1775 4498 -1302 6584 3062 -1933 -5509 737 5230 875 6092 -5035 -3372 31 -1391 -2219 9825 4269 -5698 -7074 -7095 -8912 6589 7167 8693 -6681 -2642 185 8311 -8034 5604 6294 7685 4325 3728 -330 3881 -9054 -5390 170 -5673 -8419 -9635 -3898 -4661 8623 -4739 1970 -5477 -3811 490 5968 7201 1745 -2374 -6798 -9271 -1638 -6555 -3566 -4947 3819 -2359 -8227 -8612 6831 185 6312 2777 225 2299 -5067 2960 -8258 3549 -292 2185 8401 7824 -548 -8848 -6610 -1310 8712 4365 -5496 7730 8752 7943 8200 -3488 7742 -9131 -7597 3298 813 3685 -7684 240 -5977 6645 -613 3571 4626 867 5471 4370 -7695 -2029 -4341 1171 -8415 -8666 -4207 -1048 2525 1100 -7526 -673 -2385 -755 5125 7933 9782 -1734 -8036 -5408 -1002 -3842 -7052 6054 9396 -7825 -2445 5797 6759 7677 -309 -6260 104 8567 8588 -8741 1096 833 6015 7780 2124 -5279 1809 7408 -8543 -398 8077 -9854 -1535 -3145 -9760 9135 7187 -2600 9793 3960 -2334 6071 -1230 4604 -5528 1621 3916 -9431 -1649 844 -3337 7149 -6876 6783 6186 7996 6778 3458 -4603 -4130 -5549 -4264 9064 -3341 6420 -8469 9912 -5236 5041 4977 9119 1810 -4907 -3601 5303 diff --git a/longest-increasing-subsequence/input/75 b/longest-increasing-subsequence/input/75 new file mode 100644 index 0000000..ec97b97 --- /dev/null +++ b/longest-increasing-subsequence/input/75 @@ -0,0 +1,2 @@ +788 +-8561 8947 7226 7976 7699 -1725 -1601 -7191 -3349 44 4889 -372 -4959 -8474 980 -1089 -2260 -8477 -6320 9725 1112 -2863 -3332 6066 -4732 -3096 1400 -8032 5023 -5892 -3568 8542 -960 -4274 6327 -5956 3387 -3368 -8438 -2514 -3923 6723 -1143 670 6506 -1097 -633 3727 -9966 9651 -6160 -5302 -8268 -2827 -1779 3466 -9760 -6903 9282 -1944 -4569 -8410 172 3689 8714 5606 -4492 3293 -5764 9581 4380 -5591 -6585 -3409 4080 7012 4785 253 9930 -5936 2009 -8277 6272 6470 -830 -2537 455 8575 5642 2495 7415 565 -7381 -27 4902 -2109 -2123 -1842 -7926 4973 -29 -9064 5982 -4085 2024 -7477 -1545 2254 109 -4344 2330 4171 -3805 5804 2625 5895 8849 6762 -5758 -1131 9648 -1448 5791 4446 -3270 -4771 -9274 107 435 2880 -9527 -2786 877 7988 -7205 -4691 -8765 -3041 4555 2874 -1677 744 8566 127 7030 2240 6072 -2639 -725 -4229 9101 -3105 -3140 -3028 6765 -3563 -3256 -1243 -1920 -5325 -2839 -3753 707 -3293 2798 3456 1619 -5024 -6933 7946 8596 2682 -5927 8420 -4470 -4169 1746 6144 7361 8318 888 2224 8156 4904 5307 6245 7558 -2525 9881 8903 4442 255 -2664 2127 484 8551 -5465 7397 -2702 -2541 -7797 -2803 -1682 -3384 -5076 1676 8181 1657 922 -4346 -6921 4339 -3141 -1953 -642 8518 -6603 -7413 -3422 8958 3007 4626 2878 6354 4373 -9083 3528 279 -1740 3439 5643 -3632 917 8290 -602 -2056 -9140 -5634 1341 6266 8168 -9145 6060 8291 -2335 1056 -800 -8938 -9697 -2374 -6828 -8364 -7001 7036 -9931 -5118 7392 5985 53 528 3221 2115 1869 2995 3233 -1643 5117 9849 -7613 9562 -8396 -3012 2271 4830 -6060 7727 7365 3545 -8332 -741 -2593 2443 9490 4210 -3571 490 5031 6759 3692 1240 7157 3060 -9321 1089 -6958 -3015 4366 -636 4908 -9099 5980 557 7772 8312 8453 -7783 2961 2921 -9041 -8279 -5954 9222 -8061 434 8272 -3747 5037 5323 7079 710 3780 -2239 4296 3 5059 9148 7292 -3232 -7271 1365 -6744 6960 5709 -9410 -1526 1303 -1819 -1633 9081 1932 7892 -7732 -9675 545 -2712 3387 5948 -3841 -2021 2635 -9021 -8808 5563 -709 5163 -8697 -9330 -7154 -8571 -1095 5816 -3197 5983 6562 6651 -3993 9155 8401 5844 1889 7555 -4145 9324 6306 4749 -2636 -6680 8199 3424 9554 1650 8919 -5739 8624 4739 -1803 977 -3403 -7863 8837 -1255 2698 6257 144 -7754 -3948 -2106 8937 -8884 8625 -3766 1176 -7739 -1900 7360 -4224 -7270 1006 -9683 5696 -3626 -1646 437 -2706 5228 8842 3629 -5221 -1234 -4338 -2675 4628 5187 9715 -9397 -9847 -7159 8305 -6553 -3165 -3993 576 6178 -4405 -5259 -5774 726 1031 -5975 1051 -8388 -8416 -6896 -3964 -7740 -9965 1980 6923 206 9846 3360 -4998 -4984 -1476 845 -9051 5339 5173 -9826 5106 -8217 -1910 -4118 4785 6003 -4894 6153 5516 -4472 -4445 2234 -4209 -7649 3470 3897 5925 1946 -7335 -8428 -1646 7337 5912 -4683 1692 9030 -6219 -7841 -4117 8460 -2802 -6816 -5835 1286 9167 -7079 -1797 -4383 -4569 -5252 -4891 5639 4920 -8581 6315 696 -5500 8464 -3968 -3001 2858 1953 -8099 -5278 2942 -6254 7873 -2071 -7944 -6847 -4112 5117 9643 -1030 4757 1334 6754 4379 -3207 701 -1665 -8346 6166 3392 141 -403 9827 6120 -1405 -1923 4557 -978 -7912 -6683 -3138 9644 -4084 -764 9598 -264 958 -7007 7213 -136 -7558 4321 4084 -712 -3521 8490 -7958 -753 -6717 2927 8244 -855 6031 6553 4454 3642 -3063 -9891 201 908 7574 -7335 6454 -872 506 2504 -1045 3892 9462 -3832 1593 -2410 -4660 6524 -8692 644 -7039 -1663 9197 -3553 -4840 83 -272 -2019 572 -6492 7792 8126 -2138 5946 4985 -8344 4926 -3712 -3791 -7280 8621 3709 -7098 2466 455 1044 -4152 1432 -2425 827 8088 -4122 8284 1703 -4424 -6920 3966 -5745 -6610 1167 3509 175 -5307 5727 2978 5814 5821 706 -5608 3438 5995 6021 1824 -2070 -6870 -1454 5620 6778 403 -5655 -3520 -3029 6531 -4632 -4853 -5247 -4292 -2104 3960 2429 -281 6739 -6779 -4981 8143 2117 -6930 -4435 -4108 9360 -7216 1486 -3620 1490 6642 -4685 -8786 7321 -6063 -4432 5791 9945 -6655 3268 -2948 5957 -5558 -3065 1485 3800 2464 -6801 8111 5421 -3259 -4126 -3452 -7439 -2022 -1705 -3353 -5714 5852 2630 -1667 3776 -423 -1045 7580 8288 -3505 863 -3349 3009 -2921 -5819 9366 -7847 3418 5575 -8360 -9346 -5573 -7098 -5499 -7670 -8612 9737 -7447 -8423 6716 -843 -7783 -286 5092 -7194 2447 9266 1120 1740 7780 -1999 836 2600 3528 5602 3648 -1169 -9776 3439 -5152 9334 5189 159 -4728 710 -7981 2734 4255 -2873 -330 -9384 -2289 9837 -6631 3556 9349 116 -8146 6829 5585 5135 631 4773 -8876 -4950 -3307 4257 6816 2498 -3206 8851 3709 5304 -113 9716 48 9816 643 diff --git a/longest-increasing-subsequence/input/76 b/longest-increasing-subsequence/input/76 new file mode 100644 index 0000000..3f21fd7 --- /dev/null +++ b/longest-increasing-subsequence/input/76 @@ -0,0 +1,2 @@ +863 +1101 9869 3339 1839 -4584 -9721 -1649 -4986 9309 6838 -3196 -7631 -7574 -8787 2239 7622 -5249 695 6220 7825 -6167 -656 7718 9695 -7447 6581 1914 4811 9071 -3294 -4832 8939 840 -2598 -5455 2417 -2488 1373 8223 -6366 -1567 2793 -7536 5765 6268 -2789 -3322 -7783 1491 2888 6929 7746 3389 1789 6499 -8416 -7423 -3797 1969 7944 5110 -5522 -4715 -4214 -6699 3141 2713 8106 9426 -9640 2099 8802 -9029 -5856 -494 2197 1490 1959 -2656 4410 3078 4609 -5281 5007 6108 -6668 3810 -9463 -6124 5787 -4050 -6374 -9303 -8946 8016 -9560 -6993 789 808 5947 947 -1765 -7760 -315 2360 -615 2738 338 -7088 -876 -7894 -8819 -4475 5953 8953 6788 6255 -1574 2786 4843 9798 -7972 -3763 2784 -8547 -6318 -2457 -3419 -4150 -5501 7233 -6076 -1155 -5502 -4986 7672 2295 -4497 -3425 -5410 -9020 8535 -3150 6313 4058 -273 2893 -6947 -6689 -9182 -9801 -5578 1526 -7683 1707 4187 3799 5530 9678 7004 -6700 4482 -5577 1871 -7712 3650 -1153 6169 -8032 3988 7366 6829 9757 6137 -4841 7713 -1062 8170 8465 470 46 3785 -1346 -9199 2389 -4255 -4245 6413 308 -5330 799 -3012 -5436 8645 5931 2792 8021 3111 6965 -3142 8997 7110 9983 -4395 4206 -806 3645 -1871 -7993 -3543 -5442 9710 -9068 6277 3721 9388 -4824 1817 9044 8678 9274 8649 -7090 3502 -2504 5711 6102 -4208 2329 -9864 8318 1528 2511 2009 9384 -1566 -1522 -1317 -1293 -603 4894 -515 -1066 2810 8964 1238 -2745 -5570 -8441 -7045 7514 479 -4351 -5470 -1768 7977 9934 -8681 -6253 8058 9202 -3019 2474 -2642 9270 5381 -1425 697 -4012 5149 2822 -4173 1271 5318 9546 4596 5638 -5736 3168 9344 4064 3741 -4434 -9530 -8789 -5638 7776 5980 8483 -1958 -9002 -9411 8418 -9318 5659 -9809 1076 -8088 -9901 -4573 -9143 4255 -8522 -74 -8748 604 -8896 -5497 9185 600 3005 2621 2858 -5149 -4984 -2840 7166 8319 160 -477 6260 -8807 7755 -2448 3176 5849 -9298 -654 1130 1997 2939 3819 -1052 3644 4342 -4910 5137 6213 -8724 3175 -6934 -8695 1652 -2206 -2739 9498 -9580 474 -3311 -309 -1479 -2669 -2367 9143 3146 6354 -7946 3956 -3041 7726 5490 -4720 -4572 5077 845 1537 7973 -2904 -2965 7072 9812 7440 9089 -51 7032 5366 -6760 8140 3683 -3315 2725 -5125 694 -1786 6452 5136 6955 1292 -8727 -1538 -3922 -6345 3055 5654 2752 6384 -4430 5491 8420 4344 -8118 1727 4971 -4284 2443 -6871 30 -9858 6637 5221 -6566 9075 -8535 8534 7314 -8960 -5651 6718 -3680 -894 -9527 -9527 -3430 -4900 -8861 8790 4386 4360 1013 2959 -9349 -3151 7698 -5326 -9602 6812 4587 -5522 9843 6387 -6284 1978 5825 958 -5745 5075 -3716 5911 -7871 7543 6907 5884 -8650 3738 5952 7517 -858 4674 9267 569 -9865 -7033 -1576 -1179 3558 -9014 -2737 -2783 1076 -530 6054 3724 -2341 497 7415 4267 309 -9509 -3704 -3313 452 -4259 -6451 2981 7528 4184 5 -5442 9412 -2935 -4979 6666 2065 5549 -3668 4191 3687 -2731 4578 9314 -2035 4497 6713 -3787 -2385 4796 -5454 8884 -9788 9363 -7040 -1405 -7237 -2074 -4649 -764 158 1339 -4421 9669 -920 -3800 -1978 4127 -3195 -5153 1213 -1170 1807 -6144 2780 2015 -7268 -2324 -8158 -5070 -3185 -6958 -3836 1216 2634 9137 4410 1533 -5265 -4709 -9156 4372 -700 5843 -2702 -2012 5811 -3778 -3226 3446 -8791 -3601 -1091 8770 1537 -1092 8865 -3248 -8256 -1358 3372 2331 -3620 1006 -6748 152 8779 -3221 -6611 9567 -8038 -6363 -9113 5560 2475 -6328 7202 -7534 -24 6887 -1057 -6133 -7194 789 5080 -4739 8427 -4321 8535 1575 -5243 -8087 -656 -994 4867 950 -4952 1046 -2395 5613 -7149 -5512 1051 -4221 7761 6902 9629 8822 9960 -5126 -3327 -266 -7585 5732 2370 -6703 -665 6579 9456 4944 2530 1549 7451 -8426 -1865 -2381 -9363 5977 1100 -6434 -6624 -4286 -5047 -2609 -8499 -6527 2108 -9789 -336 -6930 -6227 -1945 28 -8482 -7374 4442 -6234 -6427 694 6647 -7201 -3455 -2415 3625 2160 -4000 -6906 -2594 -7759 2781 3365 -9900 1839 7307 -3701 734 -6012 1969 7148 -614 -4137 2118 -4774 7577 8609 5500 -4415 -7969 -8362 -6555 1365 5412 -271 -8768 9069 6137 6793 -7758 6097 -5514 4315 -4113 -3869 -5264 4547 -3674 3773 8558 3321 -6158 -6407 8855 -7973 2425 1620 -9216 -7226 4403 4367 -2623 5836 -2763 -7204 -385 7930 7984 -9491 2372 4670 4335 3549 -2341 -4379 6887 -7418 4982 -2572 -9082 -2649 -9196 6300 4617 534 -8360 5975 -7164 9864 -2505 -8970 -6925 -419 4859 -7206 1724 6659 789 2043 -9337 7901 5665 9976 49 2927 -9490 2565 4622 -6123 -4527 4690 -1271 -6747 7162 991 6540 5117 3127 -8120 -2336 3275 1780 -1367 7098 -8724 335 -8021 2940 4526 7031 -4984 9268 -4631 5275 2255 1284 -8726 68 5946 2462 -2484 8425 5720 -8869 6986 -4737 8934 8013 -1166 -6733 6573 -6810 4650 5466 -4929 7887 12 -1557 -4450 -116 -1970 4987 -1719 -3890 7327 -7615 -4807 1488 -8550 -8844 -6138 7722 -7175 -5157 1378 -5183 5554 -9286 -8816 5934 -8678 -5486 -8253 -1797 2334 -500 4341 7967 8397 -6664 -8056 9660 556 -5318 -511 7968 8719 -1458 577 6454 -3608 5601 -8680 8807 -5659 4625 3322 6544 -6593 diff --git a/longest-increasing-subsequence/input/77 b/longest-increasing-subsequence/input/77 new file mode 100644 index 0000000..a0cd0f8 --- /dev/null +++ b/longest-increasing-subsequence/input/77 @@ -0,0 +1,2 @@ +832 +-4282 -1295 -6858 10000 5268 -5590 -1525 -8263 -9243 -3206 1921 -1762 1546 4513 -3194 -4474 8867 2969 -3295 2478 -8289 -7906 4776 -9843 -6912 8982 3248 -2774 6917 -2349 -9209 -7678 -8618 -8151 -2462 2225 4749 6511 -2816 -4558 2328 -5699 -6572 2254 -9125 -9282 5692 9848 -8406 -888 -7119 -8888 -3325 495 -6742 2664 1033 -1067 -8181 -2155 2056 4401 -6317 5971 -6545 9706 9303 -3697 2013 -6324 9504 9998 -2780 2008 -4463 1126 -9845 807 -767 5805 -7854 8064 -7970 -105 1621 -9651 7239 -6505 791 5656 6953 9986 -6860 9525 -8161 -4041 -7880 -6752 5107 -7002 8691 -3170 -3780 -6902 -3463 -2943 -7682 6236 482 -4399 -2223 -6353 5234 -7284 -8753 -7220 -8961 7121 -1343 45 -1314 8829 -6227 -2352 5622 7014 2721 -3406 470 -3935 866 7672 8665 1252 -2289 566 6914 44 -1132 4697 -6114 5720 7528 -9276 -4677 -2103 9300 -5573 5062 -2228 -7659 7228 -3502 -7866 7917 461 -3961 5639 -6173 2106 2264 6590 -6491 244 6758 -549 -1878 1633 -517 1373 -2798 -9416 -8365 -1314 6237 -8806 3776 -6659 -3489 -7201 1267 -6278 8148 -3993 6823 -5717 -9084 -1446 -135 1603 -9921 7876 -8408 -1521 -2133 2336 -198 5092 -1627 1501 -6091 8792 -9460 9773 2932 4594 -7474 -3083 4728 5295 -931 9202 5850 -5502 1368 7052 -2562 9736 7376 1546 7155 7351 1562 227 -8224 -1089 -9658 -498 6771 -4438 -8471 6505 -8786 354 -97 -6341 2914 -2265 7826 -6158 -2881 319 -6198 -3996 7284 -9597 -1276 3259 55 -8484 1122 -1632 -8315 1125 -818 4860 7948 -6382 6098 2186 4719 8869 8062 7505 3350 9931 -9274 -2469 -7814 -3559 280 1407 6458 1115 5199 2059 -2111 4673 6577 5066 -9800 2940 4166 -9527 -5716 -1064 -9311 -4657 7842 7380 -3822 5321 5399 7226 -2832 3145 2214 -1855 708 6007 2434 -7141 9236 5828 4648 -5853 5676 8792 -8085 490 980 -6067 -1211 -7186 9701 -6611 -1885 -7074 -9022 -8640 1589 -943 1008 -8439 -9621 7946 6097 562 -720 -620 -1438 1930 -8674 -2325 9463 -2820 -1094 3443 7248 -9263 -1763 1127 -9659 5640 4202 -6232 -1555 -1148 200 2568 -1127 2971 9650 -7921 312 938 -560 -5908 3479 -7241 -5022 1517 796 -495 6570 -2968 -5201 2456 -1340 7550 7137 4689 7775 -7939 -1606 6482 -2159 -6413 4022 2317 -8994 4092 1487 -1075 -6264 680 9233 4557 -7230 8004 5734 -4499 1886 -1642 -2992 -3600 3908 6722 5999 2873 -4339 74 1479 -9073 -5944 -1366 -1413 -3297 -2895 -5443 3462 3003 7395 5377 6123 -7707 5581 7527 -3480 -9365 -9498 -1274 6419 -4057 3641 -8013 -6721 9434 7551 171 7367 -5985 -3101 -1221 1460 4403 -5565 -9878 8722 749 4208 5029 8667 3254 7310 -4190 -9956 -7533 9644 6127 3747 2549 6694 3933 -4450 6834 -7348 -3676 7469 2939 -3020 -2130 -9221 7086 6077 9864 2263 -3205 9423 -4091 -2335 5080 -9395 -2717 -1075 3103 7098 7052 9826 2044 -6754 5746 2730 2647 4448 -1271 -567 -5678 -4979 -5397 2475 -3294 -899 -8382 -3918 9089 3194 5406 -5792 4062 9247 -2108 -312 7732 -2418 8019 -2268 -9830 -5246 -6033 -9056 8404 7262 4277 1223 9598 -2827 4643 7238 -2894 6299 -8800 5480 6194 8505 1555 -6320 -6450 -9212 6208 4076 2498 -5452 5881 943 7781 -3080 -1223 -5750 2566 8548 6178 -9607 -4163 2915 -774 -363 -2076 1669 -3998 2969 653 -3899 8342 8163 -8815 5635 -2559 -3938 2852 -7919 2335 6013 7283 4508 -5831 5401 6575 2348 6437 4868 -1519 -5251 -5120 1403 1410 -5633 5477 -4352 -7221 8133 -6852 -1877 -2630 -7922 -8743 -2338 4271 -1055 2715 -4431 -8848 4487 -3803 -6140 -3600 -9141 9787 9135 -4163 8456 1006 6521 -5189 4685 -7990 6825 -4759 -9890 1197 -2649 7994 -7462 -2379 -4492 7311 -7663 6324 -2178 -2871 -6869 646 154 -1683 3060 -4470 5584 2584 6979 -9437 -8324 -219 -290 -1254 -6754 4958 -6687 2069 -1212 8275 -3496 9607 8172 7341 -25 -3441 -4966 6555 3985 -9380 -5455 5676 -9480 6137 -7370 174 -9698 5230 1006 4910 8911 5111 4276 -9161 6888 -8308 4208 2458 8130 1587 -8679 -6730 -8933 -56 -9516 -8301 -2017 -5860 -3106 8939 4840 5073 -940 -7890 7448 4667 -4765 -9946 4561 4015 -1500 -5206 -4410 6537 6146 -7934 5945 4995 -4093 1815 -9838 -8944 1552 9479 5722 -6138 -7380 3288 9758 -7647 -9550 -5932 -4389 3239 -2906 -1595 -6317 -5182 2346 714 -4808 -9617 -9229 2702 2386 1886 -7633 6393 4463 9127 9838 5288 -6448 -2852 -8512 9713 3301 3020 -3830 -4085 416 -8758 -5213 -2144 -2803 -2165 -9353 -1769 1734 4477 3666 -5660 -1904 -1157 5223 -5919 -4889 6166 8227 -3599 -2514 9892 5193 -6223 5051 -2564 -3523 5130 2751 -426 -5885 5360 -9440 2477 -12 -8800 1976 -7316 -3428 5749 1314 -578 -4670 1718 -7094 8554 4627 2213 -5295 -1142 1341 1855 1046 2850 -5460 -8469 2232 2847 8022 5877 1061 -2005 -6140 4375 325 -5524 -2974 9024 -4489 6154 5250 5381 1583 3824 -3868 -553 -4689 -8774 -4827 6042 5356 6278 6003 -7135 9369 7483 -130 1381 -7368 7393 -2844 7314 diff --git a/longest-increasing-subsequence/input/78 b/longest-increasing-subsequence/input/78 new file mode 100644 index 0000000..06fb489 --- /dev/null +++ b/longest-increasing-subsequence/input/78 @@ -0,0 +1,2 @@ +881 +3251 -4946 -3719 -3414 -2167 -9230 5270 -9664 -6437 1067 2759 -2668 -6286 -9109 -8868 -7597 4045 9694 4455 8578 4110 786 -1922 -7795 -4992 -7444 -7995 -233 8349 -6957 -5192 4481 1777 -8743 -6926 5284 9415 -4644 2233 7900 6343 -5316 7228 -3426 -9131 6857 6565 -1969 9894 -1613 1325 -3902 -7983 9130 -3584 -4863 4699 -8756 -4874 -6072 6895 2071 -4499 -3985 2044 -6877 6388 -3523 3207 8553 -516 -7820 -6795 -4239 -3230 4773 -4613 -1377 -7094 1537 7596 -8364 -9157 -4804 -8701 9207 3704 -9099 9013 -30 5159 6415 -7614 -5229 5070 7049 710 -473 -3085 -5232 -3970 -3400 3622 429 -8633 751 -181 9872 -9702 -8978 -9214 -2244 4049 3047 -2185 -2708 9029 5109 -6051 4033 -6935 -9193 -4609 2548 -9386 9151 3775 -5880 9136 1642 7227 -5640 8194 -6001 232 -6963 -3402 7253 -6562 -1744 -4622 6061 -7971 -5130 1123 6310 -4870 5189 8444 9040 -3975 -9602 -1667 5745 5498 6834 -7387 4219 -1061 4756 1624 3938 2305 -3982 3861 2927 -8090 -535 3498 -3021 -3014 -3386 -3894 3316 -4020 -6145 -6124 -1449 2749 -3691 3081 1298 8217 -4095 6474 2542 -921 -860 -3818 -436 -9009 -1983 5504 2384 5050 -1549 -7465 5288 -8764 -4757 5885 9083 8153 -5547 166 -7237 6413 -6811 -462 5930 -9411 8513 -1514 3074 -5871 1968 6653 -4412 3443 8858 8682 9174 -6012 -3864 -6285 1148 -5201 8657 -8553 -2690 -3408 -2628 -7675 -3943 -1829 -646 -274 5768 -4354 6280 -8159 -5809 8051 5888 -9547 5240 -5249 -5117 3121 3850 2983 -9292 -7563 -7787 -2692 3767 -9270 8780 -8909 3361 -5216 8144 1504 3821 -6932 9911 6963 5088 -3244 9997 -7537 -5567 4123 351 1483 3139 -2084 375 6190 -3345 -17 662 5314 8850 3591 -2686 -6691 -8659 -9568 -9437 8385 3599 894 1006 9096 -9650 450 -9547 9480 8644 -5233 2250 6590 4057 -6934 8528 -44 3642 8996 -1901 -3322 4893 7341 5831 -4922 6729 5903 84 5110 -1990 -6301 5057 -1492 -3560 4013 3560 -6902 -8492 -8389 -371 -8320 6742 4552 406 -9342 3908 3220 3184 -7501 -392 2572 -5580 1227 -3909 -6263 -6536 -8132 -3932 -8308 8642 5304 6597 -6982 8179 -9737 7614 -8941 2398 1103 -3443 2160 -5925 4075 2400 7468 3333 5394 -6041 9850 7462 -2385 2336 -1193 6957 1117 1056 -2214 -738 159 -8388 -8832 9456 4641 4178 9711 -6576 -9669 4599 7287 1815 7370 -8641 4678 -119 3123 -2500 -7099 210 -4840 95 8401 -3882 3020 -8100 -9943 -1269 1715 9138 -7126 2326 -1053 -8298 7544 1878 150 4645 3893 7033 5484 9075 -9009 -8976 8335 -2002 2203 7590 2691 -9929 9417 -8134 -8343 1009 -6462 2792 -9724 -6098 4191 -8015 829 -1161 4734 4113 -6153 -301 7664 9273 -9585 7189 -3883 8029 -1327 8695 -6131 -8674 4819 5474 1190 -2988 -8721 6566 -1127 -9827 9161 2606 6048 -1700 -2784 -264 -6939 -1963 -9781 -5220 -8004 4304 58 -1454 -7692 1826 -9143 -4623 8997 -8351 5238 -2065 6267 4160 -6144 507 -1012 6211 -3713 -2881 -8011 7115 -1243 4001 2600 7363 1611 -5991 -8519 5609 -3727 3255 5658 9218 7237 -5311 -5374 -7384 6909 -7718 -1749 -656 9822 9100 -8545 1301 2622 7113 -1109 -3970 -7638 1209 -2359 -7376 -9678 4247 -2422 -7084 -3478 8077 3613 4092 -6759 -4799 -1505 8978 -6795 -3011 -8872 -6187 -38 -669 8913 -8348 9716 9819 2073 8819 7406 -1168 5815 9666 -6592 -8685 -4860 2895 7455 -7381 9218 8557 -2935 -164 -6811 4784 -6143 -1991 4845 5763 -9341 5580 5614 8470 -9451 4409 2084 5283 2911 -1522 -8686 -6017 4921 1394 7368 -3102 -5612 2214 2768 9934 5709 1292 5781 753 1228 -4987 3362 -6972 -5643 2186 -5703 -7065 7535 1 -9717 -1625 -4592 -312 -2772 2442 -154 -5436 -693 8401 -994 -401 1320 -4307 642 6292 -2805 7254 -8000 -1691 -7532 -9169 7179 6059 -944 2778 -7884 1490 -6505 -3859 -1327 -1816 6924 -7178 -3915 343 752 5215 -3256 -4007 4593 -9902 -5429 -9551 7670 1244 3277 -6435 5107 -2529 -8484 -1301 -8952 -9363 9199 -2882 9566 2841 -8308 -8075 -7900 -8984 -2938 952 -4779 -9076 8198 9630 5872 9717 3071 5902 6225 -9058 8518 -440 -2921 -7065 -4438 -2533 7036 -4634 1778 617 6527 -4477 -5182 -226 4771 4848 9475 9722 4286 9700 2002 -4293 -7420 8411 -7214 3493 -1364 2565 420 2163 6982 -9078 4505 -7734 3232 1011 1115 814 -9177 -1296 -159 9430 1835 9542 -9380 2970 -1900 -4559 8668 9031 2976 -2293 8918 4144 8922 7750 -7877 7379 -379 -1877 -5272 -4690 5449 -316 6034 1106 6333 -9148 -4172 -3695 -799 5817 5759 2598 -3176 -671 3730 1006 -1015 4002 -8922 -3189 -1753 9855 -2306 1049 4541 -6311 1173 7979 -1574 -2348 5818 3538 -6771 -6629 -5224 4718 -6744 9287 -4888 1890 5943 6124 4310 -4794 -1269 -7380 5596 -7797 -2149 4850 -4877 -6510 440 9743 6844 -9635 -1638 -2101 4953 9211 -1013 8927 -1885 1689 7266 -1345 2759 9326 -5558 -2736 3020 7094 3614 -5373 317 8582 1938 8454 3461 -9218 2328 139 -3377 -7740 -4660 -5505 6122 -5487 6555 9821 6904 8250 6396 -6208 2993 1197 -9144 -6738 -248 -1243 8869 7296 -6525 -9407 -7353 2660 -5773 -3873 -2391 -7412 -55 -4594 9254 -8058 -4390 8613 -986 -3261 -2164 4445 7767 -7032 7022 -3606 -3493 2422 1345 2170 566 9302 9612 -4437 5888 -1909 -4346 -4108 -2700 -415 -1135 1885 8030 diff --git a/longest-increasing-subsequence/input/79 b/longest-increasing-subsequence/input/79 new file mode 100644 index 0000000..9dccc0c --- /dev/null +++ b/longest-increasing-subsequence/input/79 @@ -0,0 +1,2 @@ +150 +9862 8851 5303 2114 -4307 -7636 -926 121 6848 9862 -7126 -6300 -8283 9549 5778 975 -8130 9645 6814 3195 2430 -2809 4121 2534 5864 -7420 -1461 4326 6332 -5305 1137 2917 4075 -7496 7790 3470 3667 9044 4556 -6570 -3478 -8771 6929 4180 92 -2507 2494 9156 -4385 -6058 -8551 -4340 5714 7623 9607 -2437 -2915 -3050 5067 -8063 -6566 3073 6148 -3074 -8794 4014 414 -8008 -7258 6440 -420 7479 -2104 -7975 6170 6205 -7433 -8789 -2615 -9586 2295 -8260 -8506 4983 -4625 2296 1846 -3040 4971 285 9350 8951 -3668 1034 -8563 7870 7573 6426 -2711 8467 -1181 -6042 9415 1137 -1637 151 7719 -875 240 -6478 -934 2301 5896 6791 1538 -2466 -7468 5288 -4902 1476 3330 -4996 5918 -2137 -6600 -7031 -9351 5969 -1002 2082 -9653 5931 -439 -5342 -1051 4039 4893 7385 1652 9606 4525 -8644 5018 7509 -6245 -9904 9796 3609 6218 -7196 diff --git a/longest-increasing-subsequence/input/8 b/longest-increasing-subsequence/input/8 new file mode 100644 index 0000000..3a3dd86 --- /dev/null +++ b/longest-increasing-subsequence/input/8 @@ -0,0 +1,2 @@ +54 +-423 -9109 6674 1439 2799 -307 3189 -4905 -9883 -9920 4118 6636 -8587 -1840 -572 -9335 -5787 -7658 -9104 9827 1203 5281 -5086 3803 -3228 8907 -3682 -3723 -8849 5506 9469 307 -204 -5806 -970 -4160 1667 -8941 9572 3222 -2248 913 8819 2417 62 7449 8190 162 2591 6652 -6165 5222 9681 5275 diff --git a/longest-increasing-subsequence/input/80 b/longest-increasing-subsequence/input/80 new file mode 100644 index 0000000..e6706ce --- /dev/null +++ b/longest-increasing-subsequence/input/80 @@ -0,0 +1,2 @@ +650 +-2907 -9570 3194 2321 9259 6552 6615 9301 3312 -3116 4323 -5796 -9513 6373 -344 3834 1851 -5798 -3847 -5863 -147 9262 -886 5299 7498 -9157 -8835 4202 1855 -3933 -9401 -1046 9432 -7842 8703 3562 -121 -1504 6796 -5754 8371 -9971 -1471 4152 6532 3121 8564 5611 1473 1932 8982 -7039 5647 -8056 -1185 8111 -7349 -5155 807 -2128 8637 -562 7463 -7496 -9705 9214 -7062 -3477 3849 -334 9290 -6984 9666 -8829 -8750 -2660 3298 5375 9841 8324 6961 -8615 4791 -2184 3735 -3798 -5479 4344 -9712 -3707 5541 -9036 -4618 -2935 8421 4888 -1379 2893 -4827 -2589 -8481 -6976 -8586 184 -7098 -2802 2458 -2082 1926 6682 5454 1395 9616 -4445 -643 -4771 4389 -8170 8128 821 4420 -3859 -1929 9545 915 -5641 -9283 5156 -4645 -6713 -7970 -1729 4439 -7219 6072 7770 1890 4439 -2305 -2159 -4076 -2364 6481 4514 -7413 -4661 3158 -1220 3145 1856 2198 5792 -6779 3872 9671 8269 5769 7895 8209 -6752 -6191 -3080 1544 -5850 -3646 -9240 9358 -525 2475 9299 8068 -5592 -737 6136 2582 1097 8294 -5110 7193 -8037 9073 5725 5690 7006 -144 7333 5599 -7528 -362 1158 2460 5750 5672 -1727 -1109 -5048 2513 5393 -4089 9241 2373 2590 -5151 8446 9339 8124 -8413 5678 338 -4324 2191 -3510 -4443 9458 -7441 -2026 -2371 -2486 9682 9062 -6867 9675 1725 -3659 7067 -6500 2006 -1261 1615 7504 -606 6004 2977 4161 407 -7624 -8103 -7815 9279 3516 -9009 3488 2650 4554 1560 6346 -2035 6096 -7467 8385 -4488 -4789 8392 7424 -3669 7519 3215 -3531 5694 -224 2626 7754 -8902 -941 1740 7879 2874 -5520 9427 -6014 9503 6057 -8612 -1851 -9909 -954 6082 2816 -2833 7333 3117 3570 1564 2650 -5551 -9599 -6094 -2893 2097 -1739 766 9506 5176 -199 -4028 -9099 9337 -9287 9099 6664 1319 3424 5142 -5580 -7970 3218 -9388 -9483 -7549 5610 3290 -2110 -7163 -1850 -1905 6714 9714 5662 -2556 3250 -3983 7128 -6905 -97 9648 2454 -9485 6337 3837 4406 -8720 1517 -123 -9808 8007 -8818 7827 -9254 -8287 5194 2622 5692 -5639 -1169 -2864 5291 3705 9741 4948 -4292 6359 5698 -4360 8233 -4519 2829 -9159 -3238 1824 508 3522 1985 7720 -156 5598 -9291 7642 -7466 5181 -4672 6748 -7591 9795 4658 16 1996 9904 6728 5152 6905 6034 -4723 7536 6444 -2631 1835 9865 -8518 5641 5541 -7826 -3790 1953 7878 -8944 -4535 8112 -7224 -5561 -9210 -1172 -7809 -9553 5547 2521 -9762 -4329 441 -4750 -4431 -7590 9440 -2675 -9623 128 -239 -6176 -7164 1813 663 -2805 2848 5136 -9913 6195 -9489 9916 3513 -1074 1675 5656 -5845 -1250 4223 -4309 -5059 5796 5273 -4283 5016 -8523 9008 5587 7848 7973 896 9054 -7870 7165 -5674 1306 6121 8480 3452 -3888 4939 9992 6467 -8807 -3514 -5153 6196 1315 9669 6584 5483 -2758 9592 3070 -3808 -1650 2419 -848 8497 -8422 7982 -8881 -3394 -5868 2807 -126 9100 -2544 -7441 -473 -9126 -4519 1323 -6232 5275 -922 8738 -1599 3372 -8341 2539 2836 -8804 9416 730 5075 -94 -9511 3498 -2120 -9630 -2650 6581 -1446 8111 -1238 -7501 -1389 -6092 788 6450 -1103 4302 -7598 -4523 -2909 3046 3361 -7708 2882 4863 -1538 3371 261 8059 -724 -8323 -7260 -7416 -3757 8044 -6453 -2781 4166 -3909 9126 7547 7338 1501 -3282 7472 -1810 -9432 2271 9252 -1736 3530 -6680 -6721 -8164 7347 9947 1731 -2940 -4627 -3568 9587 -5285 4094 7317 -3157 6226 5225 -5153 3621 -8608 -9671 2162 -5769 -666 9496 701 3713 2341 2833 -5955 5845 -1721 2752 -78 4764 -7337 -7994 -3170 -8675 9468 8596 -2408 3736 -9837 4146 8004 -9242 5009 4325 -6670 3899 -5512 3890 -3590 -3729 -9648 176 -9892 7451 -9589 -8870 2123 9412 -8815 -9102 -5989 -9625 -8877 60 3403 -3362 -1996 2261 -9427 8742 6866 6078 -4538 4518 -7705 7637 -2693 -1384 -4180 9944 4826 10000 4376 4266 867 -9209 3489 -6417 4909 8953 -44 -1540 108 9796 diff --git a/longest-increasing-subsequence/input/81 b/longest-increasing-subsequence/input/81 new file mode 100644 index 0000000..1c5ae52 --- /dev/null +++ b/longest-increasing-subsequence/input/81 @@ -0,0 +1,2 @@ +475 +6903 6390 3048 1023 -9212 -9788 -8326 426 464 -2879 7547 4355 9405 3804 -9397 -6623 6308 -5534 -4838 -1568 2648 -8774 -1245 7780 -6976 7664 5597 -9349 9622 -2534 5574 -1697 758 -6412 -811 1668 -6137 -7291 124 -4082 -7641 95 9240 1611 914 -5752 -4727 392 -8708 8835 7822 1393 -5074 744 7761 -8999 -659 5150 9628 7426 -3654 -9729 3757 7503 4321 8206 5946 9013 -6533 -6311 -1207 9895 -6282 -5356 -7828 -795 4209 -8036 1346 -2915 3163 -6619 6598 7586 1006 5052 9755 7210 -865 -9286 -695 7097 -6009 -1823 490 1125 1693 -3005 531 -1271 -5331 7520 1289 -6300 4229 9477 -1092 -8819 5271 8456 9679 -6901 -8909 6112 -7282 9502 243 -4756 -7338 8376 2760 4541 -1268 -8954 -1992 -573 -383 -2766 7163 -6287 -2302 9040 3492 3876 -6553 9006 8014 -453 -9443 -5378 6956 1006 -8217 -713 4568 344 -7426 -3111 -4887 5991 3809 -7105 -8454 -1555 6061 7419 6036 -5869 -1150 67 -9812 760 -7030 -2718 -4159 -2217 -6655 -4603 -5236 -7384 -7836 -5336 -7222 -8993 4966 -8894 -7186 4316 920 0 -3146 -1927 -6063 -3658 -5752 1980 8817 3903 -2834 7671 -9942 9171 7861 -3738 170 -2053 -5324 1769 9205 1034 -5112 9727 8702 4352 6932 -8752 3824 5881 666 -5460 9385 -1256 857 -8630 -146 -5977 8252 1874 -5275 3455 8155 4112 -1104 -7166 6665 74 9237 3346 -7079 -405 4876 -3211 4993 3065 8490 191 6989 2335 149 3579 793 -4361 -9972 -140 -6806 -5439 -5005 -9291 -298 -4120 -5423 -3342 -7684 -7901 6923 -3204 -4089 1681 3978 -3706 -3481 8600 -6063 -3042 -531 6923 7415 5151 -4991 -1913 1028 -275 -7799 4832 8672 7497 -585 4632 6536 228 -1818 5660 -734 -3926 3415 -9525 3083 -7203 -6824 4243 9841 -4873 8372 8357 -9286 7394 -5646 2101 4666 6901 -6616 7249 -9292 4279 7626 1179 -4996 -7226 -2922 -852 -6121 -9753 2845 6888 -2833 1526 639 4293 8984 -1386 -3094 2372 4167 -293 663 -3465 -5143 -4980 7788 -3006 -2460 5987 2018 1503 9597 6808 -4267 5311 9901 1138 9434 3574 -7750 -8667 9346 -8525 4511 -9967 -6688 6149 -2074 8373 2326 7789 4604 -8371 1431 3035 920 9960 249 -5572 -1376 -9976 3524 -7636 3263 7621 -3815 -1931 -6972 6754 -8720 242 -4059 -4874 -9428 -7021 1390 4922 -5243 2077 -3915 -8118 -3866 -9328 -7178 -3409 -4720 4895 5097 -5731 7874 -5761 5109 -5262 -2702 4607 -2306 -1931 3862 2077 1890 -6635 1410 1826 -5710 4232 -722 -4095 1898 -1996 6031 4728 1777 134 3010 488 7927 -8976 -7674 -4333 2950 -2474 -5183 6718 -5454 7964 -6467 242 4004 -9096 -9457 2598 -6763 8333 6846 9650 -1319 -6326 6263 -4428 1205 -6246 -5198 -2225 4549 154 -8100 8895 -7390 -9452 1300 1094 -5885 -6346 9383 9708 1371 -6099 -8955 -2576 7805 5333 9363 3621 -2457 -5313 3087 -1118 3283 -5943 1512 473 -7158 diff --git a/longest-increasing-subsequence/input/82 b/longest-increasing-subsequence/input/82 new file mode 100644 index 0000000..44c76c7 --- /dev/null +++ b/longest-increasing-subsequence/input/82 @@ -0,0 +1,2 @@ +166 +2186 1351 2546 9494 -1089 4314 4546 -259 2300 -2649 -1335 6684 -6351 8603 333 -4177 -980 3296 339 65 -8927 -9379 4506 -7097 4370 2328 7755 -1508 -6675 1998 3575 -9181 119 -4315 -8457 -631 4186 2223 -3358 -4281 2867 8285 -2401 -7591 -6424 -6265 -1266 4420 5377 8012 -6677 -3122 -3224 159 -9618 -623 -449 7820 4125 -9297 9713 -5157 -567 -8198 -4893 -6437 -3639 -5377 6992 8475 -7335 -5781 -3788 -4279 -7774 -4187 -9220 7117 1282 -796 9643 140 -2706 7521 6505 -9681 9639 -5010 7320 -4475 1342 -5005 -1130 8162 946 -8498 -6656 -9904 -7311 -6427 8021 4169 -1971 1391 8557 8025 -5877 4506 6508 7242 -1947 4600 2514 6173 5191 9856 -2025 7226 8631 7164 -5424 -3833 -5235 -6786 4690 -5763 -6545 -4806 1828 -7506 4579 -5399 -6467 -9598 -712 4882 -8254 -9359 242 -5698 2879 -7729 3926 -5096 -7350 -6401 7079 -2865 -2938 -2572 7506 -9926 3374 -3448 7689 -2060 643 -8031 -862 179 3486 8415 5967 3794 6803 8266 diff --git a/longest-increasing-subsequence/input/83 b/longest-increasing-subsequence/input/83 new file mode 100644 index 0000000..7b76587 --- /dev/null +++ b/longest-increasing-subsequence/input/83 @@ -0,0 +1,2 @@ +155 +4074 178 -7963 -2561 -309 4360 -5036 -8046 3898 -7683 -5302 -1392 8188 -3089 9539 5960 9463 8462 465 7854 9753 -806 -8808 5414 5951 7759 3060 -3386 7545 -7307 5672 -2123 5994 4735 -8318 2470 1915 1440 8163 -52 -9835 -9278 -2107 9067 392 -9493 8655 6100 -9539 -2916 3066 1758 223 -6501 8487 -8505 -3842 -1425 -5577 -4513 -3086 8930 4964 -1942 -9145 -9939 8076 9613 -3189 -1818 6523 -436 -6275 -1837 -4712 1575 4206 -6717 1735 -4363 -6472 4496 -7028 3628 -2949 5391 -9338 -7563 -9204 7505 -688 -4672 531 -7026 1545 -4349 -1029 756 -3331 -9637 -9371 846 150 8295 -2872 990 4028 -3031 8935 -9602 4288 6996 -3132 -2477 -1845 -3732 2303 -8118 5095 -8702 -5281 -7208 -9845 -468 -9431 641 1953 892 9215 7528 6697 -7751 -2057 8402 -9088 -1135 -9052 1207 -1348 -6431 1550 3698 -2591 8186 2956 -7433 -3895 -7239 -7531 -4866 -8457 2707 -4694 2637 4588 diff --git a/longest-increasing-subsequence/input/84 b/longest-increasing-subsequence/input/84 new file mode 100644 index 0000000..8886ba5 --- /dev/null +++ b/longest-increasing-subsequence/input/84 @@ -0,0 +1,2 @@ +181 +-1381 -7932 4040 -7212 -6390 -9241 -1670 6804 -2302 -9916 5369 152 -6066 -4146 -6118 6789 -8317 5347 3343 -1179 -1064 -2740 -625 4592 -2926 8778 -7877 -1468 -8259 -7196 6597 6877 -9476 2661 4984 -9621 -1583 715 -3712 6948 -72 4250 296 -9265 5828 5535 8175 2474 -6523 3615 -4495 5400 1714 3539 -618 -6117 9920 6385 -8534 7823 3346 1438 6122 5449 3754 4114 4034 7588 -5629 -2587 9684 4961 3961 5925 -9136 1851 -7792 -3235 -8683 5258 -486 6321 -675 -7809 -5328 -50 -5088 -5096 5733 9697 3659 -3653 -6029 4834 5080 7494 7656 5891 3376 4251 -6456 1310 6329 7246 -2737 2979 -5201 -8169 465 -5015 8822 9279 -1683 -9039 1977 6108 5612 4957 -9416 -1369 7475 -7008 -3031 6829 7412 1726 2307 -2550 -3464 9895 -5376 -4395 -8151 2759 3250 -8469 -6053 9753 -8450 5369 7863 4746 1908 -4001 -1663 3940 2752 9081 1978 5734 -9175 -1987 -3914 8643 -3844 -1696 4779 -1136 1618 -1100 -8717 -7958 -2863 -2748 7261 -4335 9325 1272 -5957 -3856 -14 4804 7517 -9541 9209 9342 -1149 -8005 1892 8225 -3983 diff --git a/longest-increasing-subsequence/input/85 b/longest-increasing-subsequence/input/85 new file mode 100644 index 0000000..1d221be --- /dev/null +++ b/longest-increasing-subsequence/input/85 @@ -0,0 +1,2 @@ +42 +-437 -7306 902 -2455 6367 -4289 9793 -823 -4019 5673 5362 -9061 4080 -6850 -5825 -8708 489 6604 8416 9388 1903 5578 74 9580 -3253 -4067 6866 -9041 -2488 7 8263 -5337 -3032 7810 -8775 7404 -5516 -9390 4791 -1572 -3124 7497 diff --git a/longest-increasing-subsequence/input/86 b/longest-increasing-subsequence/input/86 new file mode 100644 index 0000000..a2fd46a --- /dev/null +++ b/longest-increasing-subsequence/input/86 @@ -0,0 +1,2 @@ +820 +-5016 7538 3858 -8489 -7194 -5765 -9528 7512 -6731 -4162 6738 -9108 8338 3468 9650 9319 -7700 6749 9809 -4741 6263 4020 4713 -5333 -1639 3561 952 6543 1107 -7420 4200 5866 -7591 -2750 -6431 -8891 5405 8029 1850 6043 -3020 -3638 7892 4342 -9899 3475 -5396 7490 -3295 -530 -8193 3108 729 -581 -3983 -267 -8011 4232 2217 4361 -8332 3415 5817 2959 2618 -5346 8424 6669 -2134 7542 430 -6311 -8824 6592 -2371 9723 2905 -3100 632 9557 5506 1519 -1389 9646 -8 -8700 9187 9940 4473 -8242 633 9835 7814 -4187 6146 8936 -204 -5826 2047 8765 -46 -5334 9550 4073 -6252 -3013 3793 -2879 -6843 5020 -1920 -6840 -3124 5850 -3279 9727 -660 -3298 80 -4804 1618 1080 -3302 6597 1785 4174 3092 -8756 3890 3822 7373 2703 3607 -5019 -9050 6881 -207 8591 4716 8686 -1410 8378 7390 8018 -1371 -658 -2876 -7300 9835 -6235 -6420 2845 2089 5945 -3145 -3492 5307 -5738 -7133 -5564 -8170 9162 -1620 -6109 -3355 8728 4179 -8565 1504 635 -6647 -99 -7969 -6499 -4870 1647 -1000 -7296 -4358 -5353 7531 -8451 -1563 4745 9276 6089 -379 2681 7194 3707 3444 -6112 3227 6043 6191 -1320 -9423 361 3967 -3746 2366 2581 -347 -2537 -9403 -2948 8540 -4566 -6041 8046 -8932 -2646 -366 7118 8136 1707 -2389 -1179 9292 -7901 -270 -9188 1611 -9285 -5862 951 -3287 1575 7101 -5052 9639 -6021 -3915 -1896 9869 -4327 7205 -6579 1006 4215 680 -1878 1428 -2547 -4442 -3104 -4436 -9716 7656 -3860 1185 -2905 -2305 -1253 2482 2513 1287 -5737 2207 7862 -5227 -7995 -1794 2433 -453 823 584 -7042 7443 6027 -589 9380 -8000 8154 -6823 -87 7926 -2070 7272 120 2366 9709 219 -4539 -6985 9242 -9863 -4884 -1550 -3682 -8102 -3944 -197 6240 8950 -450 -4037 1378 -410 -7520 -1474 -8838 -322 -4168 -8874 -8342 2279 3436 9376 -1528 4686 1571 -4382 6067 738 -8360 6057 814 -6789 -4215 6017 3592 8376 -7976 -907 -1360 1806 6629 -2887 -2263 -2240 7455 -379 7270 -6849 -5034 -9433 8112 2578 -3431 9349 6307 -1334 -5280 211 -9405 -9549 -4654 636 -4250 -1214 9428 4897 -4406 7731 8982 -5938 1102 9219 7141 -2129 1514 1110 -5777 6511 331 8821 -7054 7674 5387 1460 597 -7017 6564 7632 1952 -6233 -4829 -1942 -6602 2992 -9236 -8199 -2325 1247 5511 -8465 905 -6911 3228 1673 -7582 285 2728 -2669 -9166 -3028 -367 -5721 -1558 7200 9078 -8561 -9582 9496 2228 -3665 -6199 -4337 6950 7713 4072 1604 -3752 683 -4597 1692 -8794 1578 -8659 -1082 -6332 1503 9324 -1839 6184 -9662 -7269 -1864 -3509 918 -4210 9220 2388 9385 1062 -3907 1415 3930 3959 3473 -7790 8090 -9171 8803 -870 -5948 6120 -7843 -2340 -3218 3664 -8133 -622 8127 -2861 -3734 523 6509 -9436 -2130 -6356 2518 460 -5804 1932 -9870 7321 -5039 -5133 3225 6985 -6481 2640 -4882 1612 7720 -1511 -5834 -6992 -2151 5756 -3856 -119 -5983 2011 -4987 9823 4315 9118 -6423 -3106 -844 -7267 2405 438 -5948 -9399 -7026 -4312 7972 -6974 3752 -6928 6970 9834 9914 8582 -3005 -1579 5355 7827 7631 -5397 7394 4878 6005 -8309 -9903 1697 -7987 4008 8775 367 409 -9227 -2083 -5691 -1816 -9186 5227 -6200 3070 3358 -5293 151 6453 9370 4135 9319 -5964 -3019 -9385 7306 4467 3724 -5200 -1258 9647 977 4946 1369 2021 8052 8448 5808 7289 2934 -1172 -151 1204 -181 -6545 -4580 -2338 -6021 -5316 -6334 -7785 8958 -2443 -5039 2344 3396 5396 5209 -5309 -9640 1829 -9117 -17 9112 2435 -4409 7082 -5377 7196 -6120 700 -7121 7470 -878 4252 6748 27 -2507 -1889 383 -8595 -7393 6538 7558 9442 -2655 -1592 -6324 743 -2406 -1726 -7191 6029 3549 4685 -334 4965 -2370 2695 9651 4406 -2571 7244 4948 1488 7429 -6666 3636 -4219 909 -216 3711 9553 -4170 2628 845 -8716 9415 9683 -9733 -3617 -3097 -1804 -5310 5553 588 7225 1229 4694 -6307 -3434 -4333 1422 9349 -6309 4681 7369 -1287 5339 -3591 -1535 -3640 -6781 8541 5491 -9831 883 -6553 -6157 5810 -6852 7659 1774 -3677 7629 -8104 3341 -877 7835 43 5863 -4422 8891 -3845 -9958 5055 57 3673 2834 3308 -1787 -7666 8627 -5429 -715 7178 2364 1588 -1504 -5254 -4341 7029 7812 -7009 8824 5906 5979 9381 7619 -4727 -5169 4977 -9905 9784 5019 4725 3083 -9936 -5020 -9837 -4638 -641 -3379 -3769 1508 -3548 -7207 2327 5059 -7310 -7018 5227 -3302 3111 -6909 8986 7061 6268 -8584 8281 -7483 6902 752 -8573 -996 6353 -2226 -124 5498 -8250 -147 -7480 -8918 8010 -5546 -6235 -3206 1225 4206 7690 -2143 -115 3981 -7478 -6713 7198 -5290 -8485 -7929 -2840 7999 77 411 -4887 9989 -4914 -8834 -6675 6598 -6661 -3873 6800 511 7743 9003 5189 7088 -2278 7549 -7572 -5624 5096 894 2621 -8627 -7061 -6690 -7793 7305 8190 1427 -5802 -1326 -6514 -9069 391 4930 -5049 -4548 7204 4211 8652 3517 7425 -2080 -3329 -9802 4875 -1350 1114 -6957 -2296 diff --git a/longest-increasing-subsequence/input/87 b/longest-increasing-subsequence/input/87 new file mode 100644 index 0000000..962e34b --- /dev/null +++ b/longest-increasing-subsequence/input/87 @@ -0,0 +1,2 @@ +470 +2068 9108 7096 -3689 355 1151 -3478 -8493 -9553 -7939 7959 -5224 -6433 9259 6123 -4989 -5757 -6716 -7835 4632 5028 -3273 -5684 -8885 7077 2587 8520 6608 -2965 -6413 4799 -6005 -2765 6864 -148 100 4596 7340 -1299 -5998 7446 -4696 -5101 9402 4201 -9147 685 -8326 1444 841 -7514 5493 3326 -1000 -6563 -9621 -9637 5941 -6336 -6626 -7409 3184 8438 3249 8957 -6608 -7757 949 9135 3624 -3307 -4270 -5784 -330 -1188 -7101 3436 2661 1265 -9062 -5029 5429 1815 -5905 -331 -1668 1180 8340 3695 -6013 4721 -9395 958 -5639 3290 -2320 -1166 -5812 2367 9760 670 1490 -7526 3616 7163 -4574 981 -6598 5872 7955 -3093 -1185 4389 -9352 -5233 3172 -5371 900 -1938 6247 -3238 7633 1489 8120 -1998 760 -1480 -4055 -8587 -1102 2689 1389 -5381 -8673 -3314 -4258 9007 4393 2528 -3334 5018 -1077 -646 -35 4013 4624 -4821 -1089 -5817 -9613 -7477 -7314 -6981 -5319 8852 1412 -9423 4592 -499 -639 2573 8907 3344 4501 220 7145 2076 9259 -9170 -9475 -3464 -2464 -9746 9664 -3320 -6290 3588 -1440 -1513 -9293 6912 -495 -9193 -7106 4780 -6456 8567 7246 824 -1072 -8577 -5082 -481 8087 -3272 1033 7591 -5451 6893 -5043 -295 -4205 9498 -1451 3846 1558 7894 2794 -2516 7823 -3241 6389 -3784 -5262 7891 9612 -5905 -2828 163 -9853 -2909 -1159 -1684 -4565 5429 9542 -8732 -5853 -39 -314 -722 6209 -8324 5351 -3945 8478 -5385 -5506 3707 7628 1513 -6404 -472 -8692 6982 -5059 -8506 9776 -7201 9749 6530 8062 5911 1209 -2267 -7771 -1386 -6490 1967 3948 3235 3824 417 -7480 -6966 6426 7602 -1556 -4678 8841 -8855 8373 9729 -2524 7342 -2914 890 -1290 -1112 1634 4149 4488 -719 -8901 8932 -1125 5910 2409 -1350 -1613 -524 1318 -9985 -6281 -5527 1376 -4804 4103 6718 -5149 -7884 3396 -8905 5199 -4398 2233 2337 3796 -1268 -3036 -7907 8637 975 -6631 -2792 1320 -1357 222 -3869 5707 -4581 -6854 -4832 -4447 -4294 9726 2750 80 6454 -6798 -9111 6757 1010 -4662 -3040 -1716 -6359 3184 -3479 -9860 -3265 -1646 3504 -2923 2376 466 6041 -3178 -9631 -2022 3539 2429 6428 2488 -456 -8239 -4607 -6057 2487 -972 2818 -8638 -8172 9464 -4743 -8431 -6235 -9842 1989 4801 -5286 509 -2304 358 -7362 -1139 6986 -6901 -7800 1935 -3909 391 5520 4213 9074 7993 2485 1714 -4336 6781 3176 3604 -2987 326 -1642 6819 5573 -4128 -3731 7788 1551 6604 -6289 -24 -8607 7538 -2951 8551 4442 -8857 6785 -9207 6378 9506 -1110 -8723 -8712 2738 -7440 882 7741 -5713 5470 -9812 -2456 -2277 551 -6435 488 -1307 -3413 1578 1555 7438 4527 2862 -6350 -8425 7115 712 -3925 7328 7066 -9334 1049 5251 -9827 3280 3565 -8374 3289 -3199 -6656 -5485 -3934 9314 4479 -935 4348 1278 -4142 -8966 -2644 5624 -6007 -888 -652 -9789 -6103 -7978 diff --git a/longest-increasing-subsequence/input/88 b/longest-increasing-subsequence/input/88 new file mode 100644 index 0000000..f82f973 --- /dev/null +++ b/longest-increasing-subsequence/input/88 @@ -0,0 +1,2 @@ +113 +-112 -1108 7729 1899 -946 -2217 -7539 -4065 -207 -8429 -1744 657 -6164 -5330 3016 -5518 -3815 -9052 9351 2236 -9832 -7883 135 -7307 9438 72 -3243 4798 7826 1245 -1639 -1882 -5874 -3262 4469 300 -8576 -5083 7063 8830 3481 6211 -9871 -2814 -602 5738 -9063 -4450 -5328 6018 4764 8764 -2483 9806 4843 -3873 9463 -7797 2860 9710 1188 3239 3076 7653 -7317 6233 1084 -3910 -5040 2735 -2933 -1758 807 6827 4575 -7232 2888 3666 -5329 7389 -6621 8626 -5250 6398 -2707 -8300 1233 -7439 -6943 9926 -222 3 -7939 -917 -1760 6798 5647 -8711 9920 156 -3868 -2605 -3023 9662 -8765 7458 -1576 7380 4942 8357 3421 2048 6878 diff --git a/longest-increasing-subsequence/input/89 b/longest-increasing-subsequence/input/89 new file mode 100644 index 0000000..9a297c0 --- /dev/null +++ b/longest-increasing-subsequence/input/89 @@ -0,0 +1,2 @@ +403 +-8421 2344 2556 3098 -6296 2519 -2383 6836 -2596 -1455 3354 -9823 -285 -9663 -7907 -3528 6429 7592 6705 3289 4619 -8603 7631 -4119 4935 -7492 5247 3901 2364 6519 -4938 -5954 -6808 -645 -4972 1159 -8693 6370 -4469 5615 5439 -5868 655 -7018 -1085 4714 9779 5381 -6830 -6817 172 -7484 4288 -1167 -9061 1760 -5990 -9589 -3276 6406 -9841 -1329 1227 -1375 5023 9977 -720 -6117 5805 -5359 -8671 -5097 229 -6330 3658 -1102 -6978 -2733 -8956 1231 -8435 -1093 2659 -8008 2822 -8447 -9773 -2879 -4149 -5050 -4153 2776 -1645 -3630 6481 -8971 883 -6085 2835 -8239 9425 -8 -8603 6411 -6247 -1285 3341 9873 -3013 -9501 9208 4273 5522 9520 -7031 3819 -6496 -8167 9693 -4777 8191 249 9084 6416 685 7931 2467 -1438 -6343 7400 -9942 8366 3102 5309 4819 5776 -4824 4976 -5716 7094 948 3510 -9613 -7394 4319 -6418 9806 -6117 1072 2542 -1837 1977 7096 -3227 -7384 -7155 -7282 4854 4345 5207 -6914 -292 5948 -1983 -6177 -981 -7028 7592 64 1893 -342 1647 5323 3641 6313 558 2679 5655 7124 -5331 2472 8594 3781 6603 8783 -4957 -5311 6413 -5998 5936 -4754 9189 -2823 -5730 6469 -9227 7676 -494 -7248 -9389 1406 -4108 -5467 -5000 9363 2622 2450 -8773 -9939 6955 7108 -2871 -5048 9080 4874 9426 -2615 -5365 -6822 -7719 3497 4392 -577 9544 644 -6541 1309 -1385 -7860 826 -6570 -546 -4916 -1175 -1311 6506 -3700 -5901 4400 6460 -9492 -9820 -8092 3964 -556 9276 -8092 3532 4625 -2172 1028 8623 -8939 6548 -4296 9750 -6479 -3999 -2913 247 4326 6645 -8997 2168 1419 -5141 1872 492 -711 -4141 5535 2671 -2650 -6375 7269 -6173 7162 1974 5437 6387 -1526 -2227 7102 -8603 9186 9631 -6275 2815 78 -9481 -3468 -3247 2526 4241 -3874 4329 -8459 -6081 -3693 2510 5717 -5034 -1660 -4111 -7785 -9254 -6161 8119 4003 -9069 13 2853 7699 7325 1798 4519 7178 -9012 -9510 9553 2311 4197 -7897 6524 -9752 -727 6562 125 2452 7326 -6845 -54 6831 -1009 3482 6967 8020 -1664 4390 -5301 653 2624 5361 -2897 6249 5716 -1749 1552 -3912 6118 2376 5498 4340 -9569 -7025 -1308 1878 -3025 -9836 5423 2370 -791 4426 -4233 6338 -949 -282 -453 -7750 3068 5525 285 8773 -7820 223 5711 -1309 2567 4504 -9019 5048 3363 8294 2470 4110 -8828 9783 4564 4545 8602 2217 -7920 7355 -6000 328 -4507 2956 9315 -6735 -4716 9130 -4527 -7003 diff --git a/longest-increasing-subsequence/input/9 b/longest-increasing-subsequence/input/9 new file mode 100644 index 0000000..4d3862b --- /dev/null +++ b/longest-increasing-subsequence/input/9 @@ -0,0 +1,2 @@ +316 +-1220 4079 -606 -529 6198 7263 -465 -1101 3235 9080 2353 70 5332 1965 1482 -2570 9221 -7122 3697 1676 976 6114 8524 6168 -8769 3231 2183 -2930 -284 5124 7574 2620 7438 -7842 2155 6396 -6542 -6652 6203 -4002 6196 9060 -647 8574 6648 4495 9821 -3379 -1635 -2053 -8160 1428 1898 -2293 -5325 1589 3117 9331 7713 685 -4582 9690 2260 5913 -7246 -2311 7878 -1558 -3933 3591 -8663 -2729 -5126 -4522 -7024 1010 -220 9648 4260 -2969 2719 8393 -5846 8295 -3242 -8826 8973 -6536 -597 9818 4874 1345 1669 -7319 9381 -8277 2944 -6999 -6995 -9951 -3624 9101 -1270 -7097 -6503 8924 1644 -8166 2788 9026 -8243 2952 -6411 5666 4688 9173 -4435 838 45 -5096 1265 -4467 -841 -8041 6681 -1200 -9731 -4982 -4304 1810 -7582 -7227 1768 7070 820 -1725 -2756 -4284 -339 -4384 5789 -7531 9219 -823 -7770 -765 1212 3531 -2219 5152 -2630 -522 -4795 -2188 5777 -22 466 7485 -8030 -7531 -7304 -3025 -3797 -7832 1016 5891 -3666 4200 -4115 -7967 6100 7513 -656 -547 -4312 6817 -5966 -2995 6547 -8308 1851 7046 -2343 -7139 772 8851 2020 1170 9697 681 -2990 5256 5223 2782 -1960 4729 1276 -9244 -8484 3091 7972 -2415 -9191 9935 -604 -2111 -2554 8499 -9112 -296 -1778 9612 -494 -105 4352 1102 -6471 -4728 804 4939 -8585 -3838 7101 -2671 -4115 -6469 5494 -7246 -2756 -9810 7887 2411 8293 -4471 9431 -3422 5180 7193 -3076 9655 -7125 5881 9639 -2495 -7089 -8055 7538 -4217 -9841 -6919 2265 8988 3360 906 3396 -7073 459 761 -9758 -6447 -650 3563 9958 -9050 7536 2384 -3509 -9900 -5843 -4871 2334 9084 3359 817 -5812 -611 -5619 3620 -4959 8828 9473 -7512 -5567 -6422 -2031 1136 7697 1447 -7277 -1077 -5862 9950 3196 -1787 -1594 8124 8085 -8371 3454 -1812 4757 -5801 -5560 8030 1111 -3426 -2462 4636 2760 -920 -3917 -2691 -7446 -722 491 -9348 diff --git a/longest-increasing-subsequence/input/90 b/longest-increasing-subsequence/input/90 new file mode 100644 index 0000000..8491e2d --- /dev/null +++ b/longest-increasing-subsequence/input/90 @@ -0,0 +1,2 @@ +423 +-7945 207 4727 621 3638 -5432 5004 -3445 1976 1643 -8422 2101 -4775 5127 -4998 6048 7618 -8278 -6644 8755 -559 -5137 -5257 4820 -6471 5761 -9794 5254 7657 -1468 -554 -3073 6052 -32 -3806 -2044 5794 -3374 -5866 -4720 -7658 335 8092 7867 6526 -3953 -6830 8575 3074 6201 -2089 -5099 -2157 3507 -6095 -8826 1527 -1408 -2887 -365 -1527 -8766 -8940 5725 886 -4836 -9626 -2631 -9959 -1219 -191 -5265 3105 5209 -7007 -6806 -9199 -8001 4429 -1604 8381 -1295 -8102 4687 -5992 9221 -8735 2643 -7443 -2381 -9172 -9686 -8682 -1000 -4378 7266 8877 7346 2672 7025 -9730 -3413 -2168 -4711 -9201 -6512 -1284 -5607 7059 5446 -515 -3131 3843 3509 4576 -2634 -6184 -1324 -3650 -7792 9333 4176 -669 5513 -5678 -8163 4657 789 116 -2551 -9129 -5914 -6065 -2567 -2015 2596 -6116 -5025 8476 -3323 9063 -6658 -4444 -1281 7203 3380 3389 -904 3954 4609 7194 -7068 4696 3834 -3007 -9166 -4725 9933 3426 9568 -9670 2079 -1736 6670 -4578 1391 -655 -5301 7377 5314 3524 5253 -5979 2640 5317 -7798 3128 -6534 2564 -6387 3456 -9734 -3489 8727 -850 -4298 -507 -267 6465 -9256 7073 -973 -3844 -6519 6439 2836 9219 3974 6909 -9896 -6298 8009 -5777 6397 -3390 -1882 -6931 -9708 -4686 8208 -5403 -9278 1209 -2745 1036 -3311 6077 1922 2705 -6989 -7632 1617 -2780 9688 -9205 8881 -8744 -4301 -5457 -7425 8937 -4680 4543 -9685 6936 1581 -1514 8717 7452 -7723 -3132 -6518 -385 -589 2076 -2990 6862 6273 -6391 3700 1293 9047 -166 -5394 9785 4498 -7305 8369 -1792 6647 -3211 -2972 -6255 -6840 2209 -5934 5039 -675 2076 796 -4418 4402 -4198 -2785 3474 -452 -2739 186 -3242 -1133 3374 -3908 -6254 -8378 -6290 -9121 -94 -3049 776 -2443 -8155 -1218 421 -6216 -5083 -3771 -1063 -9939 -6613 867 -3065 -6015 -2748 -7526 5177 -5494 43 480 -1831 8972 7769 -9209 -7462 -9415 2870 -9894 -3634 4300 890 -4068 800 778 -4113 -7775 9057 -7409 -5956 -3809 -3698 2417 1214 7258 -7354 -1458 6689 -9090 -6048 1207 -5346 4869 -972 -3586 5672 609 9924 6321 3974 -3864 -3888 -2933 -8292 6027 2970 9160 8790 -9763 -2658 9673 -4720 -9356 8133 -3052 -1674 -8957 -2505 3723 -8899 -6032 8265 4589 -6471 -1460 7072 -6031 677 -3718 4196 4270 3939 5231 -893 -9079 -2112 -430 -5092 -6074 -489 4041 -2232 -6429 3391 9167 -8813 7534 -6147 8650 6488 -3033 -8930 -5924 4422 3462 -6096 -267 7646 -7864 -3118 6961 2474 4472 3389 5209 -8361 2085 5692 5834 -1512 -5633 7360 3354 1952 -3821 2990 diff --git a/longest-increasing-subsequence/input/91 b/longest-increasing-subsequence/input/91 new file mode 100644 index 0000000..d79733b --- /dev/null +++ b/longest-increasing-subsequence/input/91 @@ -0,0 +1,2 @@ +179 +-4320 -978 -5196 9630 6638 -2846 5517 6518 5707 4206 -129 -5626 -2922 2656 -5361 1142 9180 3369 5287 -6496 8480 -9167 8363 5566 -9638 -8560 3179 5256 -352 -2127 5598 -6611 -7736 682 9160 -5531 9207 5518 -4691 9312 3715 -6607 -3085 -5211 3976 -3952 -1418 -9278 8203 7356 76 -953 -8004 -5512 4583 -8096 944 8998 -803 2874 -4195 -2352 9046 -8855 8042 -8151 -6563 5199 -1795 1519 -6819 6349 3080 1247 -1173 -1401 -408 -2860 6475 -5307 -4781 -5072 -5895 4331 7463 1991 -9262 -4420 -8222 8952 7648 9904 -2083 -8947 3100 3159 -4491 -3915 -4110 -7342 4005 -2484 -5708 -7317 -8097 4988 814 -6553 -9145 3498 1653 6887 -859 8804 9410 -3175 -5845 -7217 -4314 -8223 9585 7017 -6756 2817 98 5202 7634 8007 7134 -8827 -8733 -5208 -2149 -2458 1445 3873 6899 -6219 2244 -7131 -6303 -2734 -9379 -692 -1349 -7275 -6619 7350 3630 -4930 9859 4377 -2924 -4324 -2847 -7545 1085 -5787 4011 8835 -2304 -4994 5520 -1969 9221 6210 9046 -4994 9964 3627 7848 6372 7171 -4139 -2493 -4641 -8785 8863 7484 diff --git a/longest-increasing-subsequence/input/92 b/longest-increasing-subsequence/input/92 new file mode 100644 index 0000000..b8f8978 --- /dev/null +++ b/longest-increasing-subsequence/input/92 @@ -0,0 +1,2 @@ +870 +9981 -4705 7712 -7291 -4662 -5612 -7372 6415 -8523 9871 -73 2203 -2437 -3651 1616 2000 -4543 -843 -6331 -7876 -9419 -5851 9156 9817 4094 8691 -6480 6033 6647 -7272 -3256 4793 2236 3614 6299 -2299 1200 8858 -427 588 -7494 -4419 9666 -6343 -7725 5135 3953 -5051 3421 1891 5822 -7184 2746 -2514 4275 -3535 939 1775 -9679 -5142 -2990 -7411 314 9767 7817 6988 9139 -9948 1334 3335 -5301 538 7679 308 4949 -8608 5954 6328 -2371 -2835 -6902 3443 -7229 6374 755 4414 -6686 2417 -7358 4526 -8964 109 9105 2241 7624 -7106 -3690 4665 2242 9832 -2167 591 5917 -2687 6849 8713 -3440 -9842 5169 -7825 3512 1034 2412 -4612 -5471 3191 3287 -4682 -7323 8846 3447 -5869 -599 -9779 -3950 -3079 2930 -776 1980 4553 -3524 8056 -9277 -2501 -9890 6333 -6904 -9728 -1346 5760 8836 8332 -9760 -2273 -4344 3079 -937 2734 -4144 -1405 -638 -308 -4231 -5462 582 -8459 -7803 -9765 -72 -3428 -806 -3455 -9793 -1333 912 -9044 5496 -4534 9955 -577 -8137 -7596 -7563 -8344 -3560 8522 -3833 7745 -7723 -4746 7024 -7262 1690 9391 -8561 6314 3376 7970 434 7991 -7448 2414 9885 8604 5718 -2047 7215 2274 1786 -5558 6143 -7649 -3646 -1953 -2970 6869 -906 6357 -7458 4205 -8339 -6615 6108 6767 -8377 -6650 -2991 2403 -1059 1625 -584 9592 -9169 7849 -7095 -1228 50 -4768 5087 6323 -6613 6093 -3034 -6256 9050 8881 8709 -7446 -4004 6443 7687 4538 -983 4394 7658 8269 2233 4545 8628 -2771 -1893 3618 8851 5499 -4149 1403 -6430 -8500 2926 -8090 6811 -4385 4609 -2223 -6133 9901 2036 -1878 -1449 -7529 1867 4195 -5437 6317 4 8510 8802 -4979 9546 8357 9124 6673 -958 6259 -6901 -4531 3063 70 -2762 5904 9479 1630 9030 1120 -5947 7221 3740 4872 4668 9085 7631 9826 -8973 -2618 2492 9674 9118 452 -9299 -129 -841 4446 5090 -1276 -6091 -9613 -6525 606 5396 -4332 8789 -9935 269 -2338 3524 697 -2596 2206 3961 663 4534 5329 6783 7384 -5512 -5287 3616 1248 3951 -9086 -9589 6647 -3445 -7085 8310 7860 6657 -2241 4709 5881 -2133 -9696 -4207 1744 -5622 -3976 -1789 7577 8996 3195 9437 9147 -3297 -8167 -7439 -2468 -9833 -7362 1701 3574 4088 4001 -5404 6169 8961 6653 9087 -8299 9539 -860 -6618 -9256 -6851 8612 -9498 1583 -4821 -6939 -2208 9343 9009 -71 -9201 -7969 7917 -2658 -5128 4941 -2453 4042 6285 4508 8407 -2440 -4320 -4152 -8292 6303 300 1368 9786 -6637 4331 4522 1825 2674 -9682 -1159 3920 1953 7495 -3771 -3753 -3270 -5757 -3069 -315 -2437 4529 1447 -981 6306 695 -119 -428 -4674 7050 7557 6423 6722 1263 -5873 8216 1382 8355 -7801 1406 1653 -4916 907 -4504 4160 -7171 3728 -6229 5827 -5166 8594 4868 5853 -3937 506 5015 -9112 -5222 5081 439 3100 -2283 -6430 -5827 6466 1420 1778 -2437 -7480 -5181 -4836 8858 7365 -1893 -8310 3037 3553 -1616 -3385 902 323 7676 -6224 9886 -5084 -2028 -5433 4352 9840 -2329 -6053 8429 8378 9545 9693 -5106 -8308 4152 3208 786 -5817 9372 -9546 2998 -3832 -9480 4490 3206 4883 -4739 4994 5406 -2275 3578 4731 -6087 2085 5338 72 1549 -2236 4581 3745 -3600 -3048 9347 1026 5965 4160 -6082 -4212 9104 8709 940 -8739 -5997 -1830 3491 -7949 -2964 4758 -5357 53 3768 9559 5173 8433 -7541 4465 -1531 2146 -9663 4885 7065 -2187 -1436 5935 -6799 8654 -6592 2627 -7551 -3850 -7365 7358 -8176 1295 -7713 9835 -6046 -3797 -1547 7073 9087 4107 591 -995 3483 1729 1974 -72 -3046 -8327 -1878 -7010 1163 -9221 -9945 -6788 9806 -2028 -649 -3136 7433 8025 -8721 -1703 -8093 2368 2818 8778 8383 -9751 1586 3270 -4502 6047 -6383 -8576 -680 -1992 7778 -3810 4253 -4461 3765 1356 -8915 128 -6917 9640 7813 5732 -897 4709 7695 -9922 1605 -1972 416 2874 144 3282 7553 -4185 5010 -376 -7202 -3209 7175 -6186 6055 -4201 -9899 8769 3770 9408 8666 9303 -5821 3684 8758 7538 4074 -2695 7910 64 -2101 -4032 2918 -6040 7202 -9876 9727 -3502 -5401 9976 4534 -6316 2277 3922 6679 7500 -2558 8008 5401 -2263 3216 -5550 -4024 5744 9626 7967 7061 -2049 -3485 7593 -1195 8584 -5322 6050 -4723 -472 -3468 -6581 6185 9409 8126 3613 -5713 257 8412 8019 -4843 7815 1520 438 -4509 5321 -3968 3176 4105 -3909 1853 4895 1639 9503 1064 8815 -1833 4548 -4141 3018 -1581 -4676 -3229 6505 4565 6523 -7249 6581 3799 1644 8628 3175 -6232 3934 -7102 -5970 6431 3912 6583 7030 -1615 8174 -7674 -6404 -3199 4278 894 3277 13 -8705 -4895 1124 -4811 7390 4342 6166 3459 -6759 8656 -1218 3300 -3087 1321 6928 -6548 -533 -3578 -9613 6394 -1583 -6269 -2471 6606 -4192 8570 -3837 3686 -4027 9963 8603 -7447 5375 4120 7167 -130 -8507 -5164 -8938 -7935 -8866 -8597 -1438 -3359 4520 -2479 -5907 4903 5002 -8162 -2768 6587 -9353 6976 -6298 3881 3404 -6206 7196 4040 2973 -9527 2097 -5423 2332 -8550 -6540 -3676 -4896 -5823 -7887 8359 -8442 -5118 3839 -4055 9296 6409 5204 -7751 -6586 -1524 2806 9180 774 8782 8379 7006 -4982 7125 1339 5670 2868 -2106 5684 1051 -4628 9574 1510 -6724 -5457 8247 -1119 -4993 4327 8761 -8426 -8103 -686 1040 3094 diff --git a/longest-increasing-subsequence/input/93 b/longest-increasing-subsequence/input/93 new file mode 100644 index 0000000..99af255 --- /dev/null +++ b/longest-increasing-subsequence/input/93 @@ -0,0 +1,2 @@ +104 +7536 -8601 7809 -9883 -7516 -5652 3424 6337 5380 -9340 -1508 -4491 309 -4733 6643 1052 -1874 6150 -3837 -2900 -8471 9761 -4445 3574 3582 5042 1398 -6002 -4088 3436 -3608 -5284 9379 1856 7604 -1210 8675 -2435 1649 -3604 7048 5957 4198 -8562 4962 -2127 3442 -1572 3015 7166 -7380 8594 -3655 -5440 1803 -9812 -4298 -1504 -9027 -9327 5730 7811 -269 4712 -5521 -494 -5319 -8445 644 -9931 -8746 9916 -7374 1377 7701 -7209 -7787 -6991 925 7766 2455 8554 -5722 -5724 100 -2165 -9882 2836 889 4599 9507 8159 -9565 -3148 7427 5670 -960 7395 8015 -7947 1827 2923 -4762 -9737 diff --git a/longest-increasing-subsequence/input/94 b/longest-increasing-subsequence/input/94 new file mode 100644 index 0000000..6302cb0 --- /dev/null +++ b/longest-increasing-subsequence/input/94 @@ -0,0 +1,2 @@ +865 +-761 2645 -6450 8591 7347 -686 4456 5390 227 6827 9177 -2468 -3636 -7668 -9505 -6201 8761 -945 6443 -4389 2262 2379 4351 -9421 5612 2070 -19 -273 9823 4717 -6705 -516 -6957 6027 -2874 -7019 6217 580 9530 -2459 9424 968 -3068 -7211 6889 8447 -238 8948 -1205 5072 -8042 5423 -8291 930 -5418 -4571 5429 2833 -799 9231 4497 -6256 5197 2071 5207 1380 3610 -4431 -3786 8043 -3967 5078 990 -6940 9550 -326 9651 -1917 3814 -1212 6939 -448 5317 -9515 -9806 -124 -3477 -8111 9204 -9261 -812 -2066 -7025 4363 -5665 367 -5044 -4229 1461 -1053 -868 4405 -5301 942 5551 -907 -2022 8786 9334 -6930 -6984 -4045 6728 -5740 -3323 9802 -3069 8345 7236 2483 -6607 7176 4690 7850 -2661 9698 -8340 -2682 -8942 3290 -3408 4536 -8726 -8408 -3433 -4459 -4969 -1639 2467 4015 3607 -1166 -1049 3541 -6998 1193 3293 4037 -9399 -8304 3710 -924 -3804 -8412 -1397 -159 9480 6676 9102 331 -1534 -2252 3891 -9330 -6286 8018 5266 4688 2422 3691 6350 -3043 -9525 432 -2059 -3429 -7302 1048 3583 563 -3890 -2590 8669 -754 -7177 -4877 444 1816 5514 -1045 7243 8965 -4854 -3593 9152 7828 8571 -2184 -8580 -7044 -5 4404 8839 7629 -5654 -5989 -578 5733 2359 2194 -7883 179 5420 5586 -4565 200 -5727 -7869 -9887 -3627 -9451 -4470 3522 -7973 -2571 -9280 -9456 4513 -9432 -6400 6778 -7771 -760 -9597 -228 1971 -5265 988 477 8198 3748 -5970 -5612 -4394 -3048 -1548 -8695 -7231 -8530 5663 -2495 -2601 -9406 4786 -5978 -5626 5699 2383 2633 -1866 8199 9846 -3231 -2508 7716 -6754 4068 -3619 -7906 6710 3733 -3715 7964 -1130 -3417 -6072 -741 -9298 6697 9735 1849 -201 -9512 -1046 7928 -6466 4301 9658 156 -7425 -5919 -2916 1952 3687 -9774 -753 -4950 -8411 -3769 6291 -4248 3040 -6139 -5225 -5842 -4296 1644 -8134 3346 6084 5008 7016 -7006 870 -6493 1866 2946 9809 -6993 5758 -449 -3407 -5221 9835 2199 -9542 -9416 -6767 -3242 2259 9698 -2173 -6221 5994 5472 -3220 4830 3414 1602 844 9026 -9122 -7406 1465 4004 -815 -8773 -4333 -4462 -1788 -254 2412 1168 8868 8188 -6564 -4244 -4573 -3281 8208 -7905 -7688 4606 -978 -4300 -1314 4499 -3242 -4386 -4470 3772 5473 8248 7879 6736 2000 5318 1968 455 8152 -140 1812 835 4262 3788 677 8401 -8574 74 -9710 -6675 2087 7631 -2220 -9287 -9417 -4729 6938 2038 -4257 2374 8393 -3661 8794 9555 6246 3649 6561 -1949 1717 3311 -6614 -6681 5299 1576 -24 6299 1491 4820 -645 -3046 6871 558 -7184 -1990 9781 4047 7087 4678 -6041 3543 -642 -1279 -3788 7546 -6673 -7525 -2564 1438 7822 1091 -940 648 -4742 8861 8544 -8344 7022 5246 -5944 3493 -1113 3578 -6614 9886 -9642 6093 2601 -4837 -5628 -6256 3691 -6870 -180 2683 9169 -1642 -3563 7161 4712 -5812 2420 3697 3443 6518 1433 9953 7721 9673 -3798 -2332 -5093 -8503 -4484 5330 -8707 5405 7266 -699 1362 -6517 8108 1572 -3089 7654 5568 8937 5304 -1511 1309 -4074 -1587 -3051 3805 -6443 -8894 -6672 -5824 -5524 -5642 -6158 -1606 729 2964 -2551 6848 -3712 9998 -8588 -5717 2546 9154 9666 652 4556 1070 -8323 -8815 6013 7270 3484 1130 -5091 8374 -9053 -9374 -6269 -5298 2145 6206 -88 144 4316 -4840 -3541 -4358 -6744 -3503 -8183 9789 -7646 8966 6442 -9066 9337 -8714 -7092 -9798 881 -8808 -9517 -6082 -8617 1797 -2431 4679 3690 -9804 -606 3172 -5212 -7658 3870 6509 -5753 9105 -3137 -5648 -5072 4934 2923 8922 8019 -6028 4385 4016 823 -855 -9069 188 -2131 9077 -5232 1262 2560 3594 8016 8179 2453 3117 -2007 229 -4586 -2242 6190 2948 8479 5692 -1271 4295 -9591 7729 9257 -1309 6461 9706 9161 883 2339 -6311 -3301 -3137 -5786 -525 -4159 7064 4057 -4972 5528 -9058 6177 -7376 1836 -2239 107 2948 -4920 -6015 -1758 -4616 -1400 8304 9727 8885 -4553 1182 -5812 -4577 -1226 6876 7812 5610 -231 8194 1977 6017 4059 -9171 -646 -2990 251 -7868 -2008 6856 9484 -3197 -4830 -7065 5867 -5657 -5046 -9015 -4075 1221 8536 4040 -8821 2236 -9356 3841 -3123 4574 3413 -15 8012 -4390 -6809 -838 6863 -5951 5040 -1882 8973 -117 3784 -9253 4413 4095 4705 -970 587 -4403 3621 3298 957 3912 -2498 -7697 -6406 -4108 7137 -1638 -1179 -7231 9570 -9849 -164 -9666 -9578 9280 -9014 -2175 -4777 8836 -8823 5809 1511 -5938 9869 -1529 -4967 6603 -9441 8562 -338 -1111 -6988 4314 2029 6602 3628 4491 -7429 -1004 7743 8306 -1423 1588 -6888 -1237 5489 -991 -4302 954 -1095 9740 -6552 -1453 2322 9552 -2417 -258 7695 9760 -403 2203 -842 -1817 -2350 3179 5094 -8475 -5582 956 2386 7810 9081 5340 242 895 -4088 3683 7463 -3953 -2967 717 -1553 4119 8925 7203 2019 -3361 8994 5621 -6852 -8678 37 5127 1750 840 8870 9044 2756 2012 1629 7671 -7033 -5396 5635 -4848 4180 -2405 6006 4707 6797 144 -4985 6141 6830 279 -7298 -7204 9673 9986 7831 -7610 -394 1844 8805 -326 -2271 -7630 3077 8857 -2477 -6609 -3854 -9050 829 7118 7865 9239 4819 9490 -8437 3363 2979 -2801 -7110 4203 9562 -4051 -1853 5703 9807 4257 6816 571 5906 4473 -7091 -2604 -6497 -4661 5438 diff --git a/longest-increasing-subsequence/input/95 b/longest-increasing-subsequence/input/95 new file mode 100644 index 0000000..848751c --- /dev/null +++ b/longest-increasing-subsequence/input/95 @@ -0,0 +1,2 @@ +22 +6058 2093 -5240 -5499 4584 -2931 1207 -6372 -5765 -7271 -7267 1386 9009 -5931 -7261 -3752 -3891 8727 -2231 6031 -5840 -6306 diff --git a/longest-increasing-subsequence/input/96 b/longest-increasing-subsequence/input/96 new file mode 100644 index 0000000..eeaf405 --- /dev/null +++ b/longest-increasing-subsequence/input/96 @@ -0,0 +1,2 @@ +412 +6193 -3174 5042 9146 5411 -9655 3786 5462 -9928 -3579 1172 2143 -1281 7217 -8745 -3325 4113 -9220 -3425 2635 4971 1613 7230 -3731 -3011 3772 -8906 -3093 5933 3455 -6212 -1434 3426 -8325 -2181 236 -4071 -5200 375 -6236 -7586 -5174 6964 -5550 -6093 1397 -5618 -2599 -6917 4234 10 6851 -8600 4302 -444 2205 8489 3041 -1704 -3833 3929 -1548 -6290 2403 -6294 5681 2144 -5763 1479 7376 -8888 -1926 -5545 1383 1816 -6258 -1854 9066 4432 7627 8376 -8420 -574 6986 -6937 726 -6192 -5128 398 -8350 4912 -6746 9699 3083 9647 9424 3608 2267 -2882 4315 -6762 8668 -4578 1897 1263 -3788 2046 -9492 -6390 -6766 -9314 -6584 6065 7110 -6490 -17 9906 -1487 8033 3684 8360 9162 4272 -5790 -2238 -7654 -6993 -5536 -2877 -7048 9303 7971 485 6146 6682 7725 -1113 1547 -8067 9815 9906 1452 -2032 8426 -4615 -5096 4317 1378 -1603 -6059 -344 8443 310 6255 3599 918 425 2589 -3976 9261 -4626 -4828 -4915 -2712 5363 -2470 -6318 -8052 2477 8210 -2915 -572 1826 95 -5414 8551 -8252 -2418 -5521 -981 -182 6180 3381 4898 648 -7833 -669 9294 -567 4879 -4332 5759 5390 3774 6549 9485 7688 -334 -3844 6047 2809 -1988 -2462 4119 4949 -3655 -3645 9007 7697 -6938 7988 8233 -961 -2320 3012 -3336 -9287 3161 -781 -5770 -8765 2899 2408 2264 -4595 8010 -7199 1186 -1719 -9397 -3766 -8083 8042 7074 4283 -7056 -4056 1472 4004 -255 6207 -3831 -4931 -2197 7455 7710 -5224 -2510 -2758 1616 8833 7024 9837 -8135 -5939 -9498 490 6843 -8662 2854 -505 1431 5170 -7719 -3878 -7430 -5082 -5550 1632 -5284 -4068 9619 4494 -9419 8153 7575 7245 -8217 8077 -2112 4513 2475 -7101 -3504 -1925 8675 2656 9581 -7986 2066 -1160 -1514 5028 -2535 -6098 -8977 9350 -6096 7089 -985 5298 -5159 -326 2688 -7251 -4815 -8901 -1690 3047 -4562 8452 -7176 6479 -3844 -3202 3931 -6565 8206 -4038 -603 -7568 -1379 -2358 -8299 -6447 9441 -990 5026 7790 2737 -1649 5892 -7406 2713 -4682 -105 -644 -753 3903 6005 6047 5449 -9409 480 5000 1480 -8288 8418 -5363 15 2850 -3845 -6783 3056 7366 84 -2838 5700 3679 4745 -8008 6709 2251 1152 1554 -3047 233 -5529 -2624 -2362 -4321 5862 773 8483 528 -2135 484 -9997 3270 -710 -7136 9045 -2549 -2428 8801 -9597 -272 1445 -729 1362 -5021 560 7068 2511 3295 -694 -6636 -7052 -7030 9201 -2026 3379 -7478 9702 3639 -894 5431 5472 -7864 7888 -2478 9150 diff --git a/longest-increasing-subsequence/input/97 b/longest-increasing-subsequence/input/97 new file mode 100644 index 0000000..3b2cc29 --- /dev/null +++ b/longest-increasing-subsequence/input/97 @@ -0,0 +1,2 @@ +585 +5650 4881 8260 9572 9311 -4470 6865 -9007 2900 7264 -3659 1582 5735 4155 9643 -3625 -8636 363 -3100 -6127 2632 -5228 5588 7310 -9838 -7830 9439 -3654 8504 -7851 4808 -3995 6004 -9316 -4473 -8475 3894 -182 -850 8563 4922 -788 5731 35 3058 950 -6552 -3966 2449 -7375 5829 -2999 5162 4047 -8868 -2786 -4049 1878 3099 -5982 2444 9047 4130 -1971 -2028 -1114 -8915 -3531 -3546 4890 3915 4286 1355 -686 -8342 -6580 -8572 -4679 8375 7765 3537 -7401 5584 9624 -5970 3603 -510 -1523 -9645 9393 4269 1873 -2536 1773 7209 -6366 8467 -471 -7150 9356 3249 -4073 -6012 -4712 -1999 -8937 5312 -5798 6624 2581 -6002 -3746 -6709 4117 2040 -1632 9391 -4045 7306 -496 7933 -9848 -3431 -5700 -9615 3857 -9884 8981 -1621 3454 -2816 -698 -3566 2930 -7718 -904 6230 7312 -5006 -2938 3869 2824 -9888 -9062 -9897 -7559 5145 -6974 -3312 1221 -67 -1317 -528 -6969 2351 -3246 1040 -6847 -4875 7441 -785 -2901 -1262 -2103 7992 -9359 2747 -6364 -789 7845 4192 1956 -220 -4193 6038 -9760 -1468 -6533 -901 4808 -3346 7661 8137 3148 -230 5199 -2525 3719 6779 -8787 -8342 -3810 3737 4299 -2192 -7047 3452 8455 -5928 -9147 9425 -847 9432 8977 4181 -7753 -9956 -1640 -9017 -8940 8604 9487 -9769 5064 -4071 -2559 -7474 -981 -2899 -2879 708 1754 -7413 4346 3029 7163 -117 9421 4464 1763 8680 1476 9655 -2698 -8854 4573 1681 -6493 -5558 -5074 -496 3106 1421 -1427 5408 6561 -7615 7699 6383 -7388 -136 2268 -1004 5022 2142 -2900 1890 -9516 9612 -3994 -7076 2165 2073 -4102 -6292 7530 -1393 -6287 6118 6773 2313 9954 7935 8256 2895 6629 8749 -3537 -7659 -4811 7039 2710 -5375 5890 594 -5638 8639 9103 7566 -9215 -1981 7583 3728 -2011 -6142 5655 -5134 8606 6272 -4350 1299 6650 -1915 -686 -932 4826 -5239 6184 2832 5522 6847 5320 -4758 2128 5948 9596 -9735 -7387 9836 4615 3308 5058 -901 2867 9082 3599 8056 2355 -149 -4607 -4979 959 8778 -8907 340 8090 6916 -4413 -7768 6241 9445 -6578 -6207 7251 932 -3640 546 -5546 -3791 -6578 -9051 1416 -7376 -359 9833 -8946 -4468 2176 7141 -1619 -7645 -9517 -3213 -508 -8726 4038 -2861 9149 8741 -4530 -3152 -1666 7912 824 1225 3672 6053 -4538 -5076 -8706 -4159 3720 2992 -7612 4099 -7769 -2637 820 1735 -2345 8007 9511 -9362 -3247 1143 6832 5270 -999 8837 9581 6269 -1624 2496 8953 -4867 7030 -8572 -7557 123 7671 -4258 -6438 -8796 -2164 6207 9728 2256 -5793 4503 -5441 6617 5236 -1231 -1945 8960 2924 8325 4094 8722 -9019 -9392 -4588 1341 -2791 -3113 6553 4749 538 -9220 8159 2815 8128 -4339 4590 2022 -8783 -5115 5093 -7521 -4137 533 -109 4044 -2215 -1065 -5833 -6055 -3516 4630 -6806 -400 -8603 8718 -5768 5456 5209 -6828 468 -1630 -8039 451 -2890 -9352 -5590 7768 -9441 -4851 -4078 -1093 -3091 -7630 -3528 5345 -2520 -8175 3615 -4151 3935 -7032 -4274 6571 1392 7358 -6038 -6544 5850 -4865 2523 889 -9989 3847 1349 2499 -8816 -782 5907 -1087 7010 8638 5337 8191 -7920 -6020 -5192 -5777 -4973 -9997 -5690 -7392 -7005 9808 836 -4022 1513 -8773 -9014 -4106 3686 9796 -8402 5189 -2095 -2372 3968 4029 -7175 7981 112 6649 5848 -8154 -2404 7756 -8269 -5066 103 5683 2774 -1748 -9408 -1980 -8878 -5663 6037 1654 -2076 -5806 6939 6105 -7618 -5874 -9640 -2510 8786 9108 -285 -999 4103 -4719 -122 -7744 -9411 -8537 -7973 2941 3510 -6542 -2717 -4882 6725 -3862 1531 -5247 8703 1934 diff --git a/longest-increasing-subsequence/input/98 b/longest-increasing-subsequence/input/98 new file mode 100644 index 0000000..34ae241 --- /dev/null +++ b/longest-increasing-subsequence/input/98 @@ -0,0 +1,2 @@ +608 +-9881 3062 7369 -8354 7966 -8182 6033 3784 -7201 -5043 900 -3785 -534 2155 46 4166 7677 -771 4480 3456 -8694 -8844 8966 6072 -1055 6110 9384 7192 9532 -7140 6449 -8876 9248 -7252 -7908 -4049 2322 -8314 -5743 8269 5125 -8258 -811 252 -1068 4094 -2958 1770 2075 835 6299 7168 8284 -9099 -2018 5386 9096 7978 8632 3788 -5794 3288 9361 -3538 8529 -1566 -3818 9603 7011 -397 -1488 6967 -4006 -5575 8657 8077 6628 -5358 -1724 7685 -8749 -4803 5605 2020 -8793 -1407 6397 724 -3682 7873 1263 -2471 -9000 -8598 -9620 1272 8650 6393 -7661 -5529 516 -3883 -4683 -7337 -1803 2950 -1516 -2930 8908 -2345 -5082 -8589 -1268 -7884 1875 -2691 -985 9323 5687 -8221 8362 -989 1752 -1951 5438 -196 -2030 -3025 -6567 -5879 1939 2630 -4083 1327 5938 -8030 5609 4335 -7604 7185 -3628 -9702 7459 1405 -1837 -2403 -9617 -8218 8670 5787 -2579 2910 -770 4627 -4191 4504 -1867 8823 -3809 8154 -7071 -586 -6193 9321 -5454 -2381 -2009 -4051 -6096 -8641 -6703 951 -4129 7426 3932 3579 -4831 5987 2736 8056 4664 8506 3544 -9005 3736 6313 805 5084 -5026 -4572 -421 9298 6482 -2691 2124 -2889 7010 -3342 -6504 -5095 -7719 2428 -5856 -9088 -1551 110 -1001 7635 2667 -6750 5922 -6355 -4188 -6806 7721 -4263 3069 -6854 6088 -7609 -8047 -8901 -1507 4510 -7098 -8405 -4397 -1253 -4219 -91 -3905 9179 -53 7983 -9735 -6492 -1500 -4923 -1325 -3227 1768 -4806 -8276 -9957 -5124 608 1864 3097 3507 -374 -1043 5093 3328 -5879 7448 2233 3006 1162 5462 -3525 4566 6104 4440 5492 -5778 2577 891 -4796 7126 2160 7138 -2880 7156 5018 -9 6539 -6797 -5851 -8162 2865 5205 -7888 7951 2473 -7660 1913 -4588 3290 4366 441 2406 -8489 -671 51 9362 -2257 8327 -8952 -2880 2681 7005 -2035 -4795 4328 -9928 -9422 -7009 -9284 -6786 2104 7609 -277 -462 -9549 2453 1615 6110 7736 4008 -3568 -5320 8186 8089 -6633 5467 9909 6552 9179 9952 -779 4284 -7404 -737 -8107 -4041 -3826 -7616 -4173 2910 7167 1141 -2851 -4989 -330 -271 -703 -2116 -7631 -2045 -5550 3759 -4267 -5200 1027 7478 -1289 -6939 6838 9843 -3473 -6116 -8844 -8595 -1322 -5526 4990 958 1653 -2041 -1225 5906 -9461 -4242 -8498 -7478 -1940 -5968 4985 -534 554 3117 2359 -907 605 -9496 -7408 9587 6656 -9645 9766 5456 -744 -3297 3538 6957 -1135 -52 -4809 8119 -8934 -6723 -3848 -2595 6882 1898 -7916 -6030 4416 -2813 1306 5111 5950 -1943 -4313 -3276 7053 9073 -9782 9370 3691 -9497 8795 -1927 2807 -7444 6737 2367 9606 6975 4263 -8017 -6058 -9452 6251 8064 1144 -8973 -3305 8706 4629 8494 5482 1853 4199 -5918 6333 8032 5671 7086 -3777 -1609 6768 3555 -5562 -2661 7020 6492 -1758 -2887 2403 -9614 9126 -721 845 572 2328 3348 -5110 1246 -9063 9008 4833 -8532 987 -9246 -5796 4390 -76 -409 -2693 -4001 -9499 709 -348 1775 4525 8350 2233 -2155 4022 -322 2335 -6173 -1091 5725 7295 -6707 5580 9080 9524 -1296 3100 8829 -6705 9961 6177 9958 -6647 -8257 -7514 -2013 -201 6116 2936 1643 6318 -6411 8561 1721 318 5961 7858 -9794 3362 -5924 1280 -2325 5059 6924 8479 9940 8217 870 6561 -4386 6376 134 -9368 1550 1890 4255 -8851 -3279 -7428 1565 8365 914 630 -9003 4879 7821 -6779 1798 8641 7284 4034 9066 1514 -547 1656 7184 2930 4011 9800 -5325 1612 -9719 4950 -32 9805 -1576 5815 4027 -8545 -466 4213 2320 903 -8402 -6996 -5360 1656 -2498 -9332 7086 7393 5839 -7076 -544 4072 -3642 6355 1716 980 7827 -9678 -7898 -7883 -7381 -9644 3806 3379 -1299 7210 -7668 -911 1957 -7285 diff --git a/longest-increasing-subsequence/input/99 b/longest-increasing-subsequence/input/99 new file mode 100644 index 0000000..f0b29f7 --- /dev/null +++ b/longest-increasing-subsequence/input/99 @@ -0,0 +1,2 @@ +497 +639 -7696 -4417 3121 21 7405 8233 -4590 9389 1893 -3935 -5782 -8757 -1018 -8362 -3228 -6485 -9991 -5014 9762 6909 -7596 3920 8159 -9909 9561 -9058 -8948 9211 -6265 8294 -7039 -9435 -7850 9950 4208 -8436 -5863 -30 3033 -15 -125 4345 5007 6218 -4454 -5736 -1709 9728 6995 3396 -2674 -3330 -1581 9570 3699 -5564 5947 3277 242 6627 -570 1906 -2020 -6713 -818 -9540 5514 -4697 3207 8578 -5151 4773 1111 -5609 -4038 -468 -2293 -2317 -2661 4429 -4299 -1605 -792 6600 -6083 7284 9876 -3279 1481 -6437 -2457 3231 1923 -7174 1808 -388 1724 -1300 767 8593 8211 -3338 4093 1596 6863 3053 1370 -912 -2275 3692 -5002 -7772 -1877 9232 -3147 -3552 1897 8036 5532 9046 -3906 -416 9677 5253 8243 8419 7728 6088 1086 491 3764 459 1729 7963 -8922 -3991 9905 -7900 7057 -7553 -923 6993 5718 -4788 -5628 7661 9582 -8973 -7054 -6753 -1416 9186 3135 3768 -9513 -2699 -1449 -6923 5241 2296 3320 -6021 -2804 1082 -5379 114 7252 4902 9354 2340 -4742 -6245 -294 1021 -7201 -7424 649 3845 -6149 1268 -4193 -325 3370 -1478 -3775 -9747 3570 -1505 8339 -1405 -4051 5702 985 7547 6784 -51 8600 -806 1614 -1440 6473 4332 -2315 1559 -3909 653 -514 -4896 5981 -8080 -906 6931 3854 6599 -9030 -1508 -7322 4806 9774 1017 -6996 -6593 3004 -2722 3946 -6877 4209 154 -5426 -8274 3410 -1724 -4794 3101 -4441 -9796 6660 351 7077 4748 -405 -5703 8538 -1509 -1417 9645 -6767 -7738 5122 5858 8934 3687 -9584 -3949 1739 -3930 -3143 -6905 -2501 2632 7721 5824 -7230 -5871 5793 1109 1561 -7519 -8417 -976 -4116 -440 -1685 3283 6696 7721 9951 -426 361 3148 5794 6457 5898 -9 -7975 8152 -4795 757 -1707 8796 -6932 -973 8436 5633 7682 5751 1188 418 7539 -3697 655 -4094 -9512 -9083 -9219 7004 -5880 7949 -6028 -143 5581 -8537 5323 1616 -3349 -4072 8058 -3766 4492 58 9297 -2652 -8425 -7297 4093 7125 113 7779 7880 3093 -1225 933 -2282 9580 8033 4574 -9269 -4689 7877 -8682 -7239 -6734 4814 -1637 4226 -941 -8267 6856 -4060 7131 1643 5309 4305 3256 8540 -8016 9567 -6570 3758 -6690 7961 2173 9910 -919 1535 -9235 4713 -8674 -8059 -9603 7360 7625 8919 -3302 2245 -2793 -9812 -5673 5985 2473 1863 9026 8925 -8486 -5782 7568 -6115 5084 5296 8011 9981 -1665 -1057 -3269 -2158 9911 7044 6582 -3003 -1854 1088 -4552 -4872 5251 7059 1948 -6318 5738 -484 3540 -3266 4028 3864 5500 9104 1063 -9225 -8156 2564 3462 1033 2318 -5928 -767 7134 -8955 7119 -9994 -966 -7324 -5874 -7837 -8086 -4268 -2219 4000 -616 5581 2661 -6177 8576 -137 5028 -2482 5453 2460 -8140 5015 -5553 -9101 2956 -9365 -748 5148 4587 1091 -7136 255 8187 4485 5197 -6915 -7874 7106 9294 -3878 -4937 -4804 1085 8286 -6737 -336 6257 -9971 5658 3215 -884 5407 4373 1455 -9401 -552 4347 -1026 7779 -9277 5969 5548 6548 4783 7135 4971 3774 -7339 -2969 9657 diff --git a/longest-increasing-subsequence/longest-increasing-subsequence.pdf b/longest-increasing-subsequence/longest-increasing-subsequence.pdf new file mode 100644 index 0000000..69b8801 Binary files /dev/null and b/longest-increasing-subsequence/longest-increasing-subsequence.pdf differ diff --git a/longest-increasing-subsequence/longest-increasing-subsequence.tex b/longest-increasing-subsequence/longest-increasing-subsequence.tex new file mode 100644 index 0000000..e0ee127 --- /dev/null +++ b/longest-increasing-subsequence/longest-increasing-subsequence.tex @@ -0,0 +1,41 @@ +\documentclass{maratona} + +\begin{document} +\begin{ProblemaAutor}{}{Maior subsequência Crescente}{1}{256}{} + +O problema consiste em determinar a maior subsequência crescente de uma sequência de números inteiros. +Uma subsequência é formada ao remover zero ou mais elementos da sequência original, sem alterar a ordem relativa dos elementos restantes. +A subsequência procurada deve conter pelo menos um elemento, e seus valores devem estar em ordem estritamente crescente, isto é, para todos os índices válidos \( i \) e \( j \) pertencentes à subsequência, se \( i < j \) então \( a_i < a_j \). +O objetivo é identificar essa subsequência de tamanho máximo e apresentar tanto o seu comprimento quanto os próprios elementos. + +\Entrada + +A entrada é composta por duas linhas. +A primeira linha contém um inteiro \( N \) (\( 1 \leq N \leq 1000 \)), representando o número de elementos da sequência. +A segunda linha contém \( N \) inteiros \( a_1, a_2, \ldots, a_N \) (\( -10^4 \leq a_i \leq 10^4 \)), separados por espaços, correspondentes aos elementos da sequência. + +\Saida + +A saída deve conter duas linhas. +A primeira linha deve conter um único inteiro representando o tamanho \( L \) da maior subsequência crescente. +A segunda linha deve conter \( L \) inteiros \( b_1, b_2, \ldots, b_L \), correspondentes aos elementos dessa subsequência, na mesma ordem em que aparecem na sequência original, separados por um espaço. + +\ExemploEntrada +\begin{Exemplo} +\texttt{5} & \texttt{5}\\ +\texttt{1~2~3~4~5} & \texttt{1~2~3~4~5}\\ +\rowcolor{gray!20}\texttt{4} & \texttt{3}\\ +\rowcolor{gray!20}\texttt{2~3~-1~4} & \texttt{2~3~4}\\ +\texttt{1} & \texttt{1}\\ +\texttt{0} & \texttt{0}\\ +\end{Exemplo} + + + +\Notas + +Para a sequência \( (1, 2, 3, 4, 5) \), toda a sequência já é estritamente crescente, portanto o tamanho da subsequência é \( L = 5 \) e ela contém os mesmos elementos. +Para a sequência \( (2, 3, -1, 4) \), uma das maiores subsequências crescentes possíveis é \( (2, 3, 4) \), com tamanho \( L = 3 \). +Para a sequência \( (0) \), há apenas um elemento, então a maior subsequência crescente é o próprio número \( 0 \), com tamanho \( L = 1 \). +\end{ProblemaAutor} +\end{document} diff --git a/longest-increasing-subsequence/maratona.cls b/longest-increasing-subsequence/maratona.cls new file mode 100644 index 0000000..e11d53d --- /dev/null +++ b/longest-increasing-subsequence/maratona.cls @@ -0,0 +1,188 @@ +\ProvidesPackage{maratona} +\LoadClass[11pt]{article} + +% remove page numbers +\pagenumbering{gobble} + +\RequirePackage{fancyhdr} + +\RequirePackage{tabularx,colortbl} + +%\RequirePackage{arial} +\RequirePackage{ifpdf} +\RequirePackage[T1]{fontenc} +\RequirePackage[utf8]{inputenc} +\RequirePackage[portuguese]{babel} +\RequirePackage{graphics} +\RequirePackage{graphicx} +\RequirePackage{amssymb,amsmath,wrapfig} +\RequirePackage{xcolor,colortbl} +\RequirePackage{xcolor} +\RequirePackage{ifthen} +\oddsidemargin 0cm +\evensidemargin -2cm +\topmargin -1cm +\textwidth 16cm +\textheight 23cm + +\ifpdf +\RequirePackage[pdftex]{hyperref} +\else +\RequirePackage[hypertex]{hyperref} +\fi + + +\newcommand{\var}[1]{\ensuremath{{#1}}} + + +\hypersetup{ + letterpaper, + colorlinks=true, + linkcolor=blue, + urlcolor=blue, + pdfpagemode=none, + pdftitle={IV Maratona de Programação do IFB \today}, + pdfauthor={}, + pdfsubject={Caderno de problemas da IV Maratona de Programação do IFB }, + pdfkeywords={maratona, programação, IFB} +} + + + +\DeclareGraphicsExtensions{png} + +\lhead{DS Contest Tools} +\pagestyle{fancy} + +% Capa +\newenvironment{Maratona}[3] +{ + \begin{titlepage} + \begin{center} + + \vspace{1cm} + \Large{\textbf{#1}} \\ + \vspace{1cm} + {\textbf{Caderno de Problemas}} \\ + \vspace{1cm} + \begin{small} + \textsl{#2} + \end{small} \\ + \begin{figure}[htp] + \begin{center} + \includegraphics[scale=1]{logos/logo-maratona.png} + \end{center} + \end{figure} + {(Este caderno contém {#3} problemas)} \\ + \vspace{1cm} + } + { + \vfill + \begin{small} + {QNM 40, Área Especial nº 01, + Taguatinga/DF, 72146-000 , + Brasil } \\ + {Telefone (61) 2103-2200 \\http://www.ifb.edu.br/taguatinga} \\ + \end{small} + \end{center} + \end{titlepage} +} + +\newcommand{\Organizacao}[2]{ + {\small \vfill + \begin{center} + + \textbf{Comissão Organizadora:} \\ + {#1} \\ + \bigskip + \textbf{Apoio:}\\ + {#2} + \end{center} + } + \vfill +} + + +% Problema +\newcounter{problem} +\newenvironment{Problema}[4]{ + \stepcounter{problem} + \newpage + \begin{center} + \Large{\ifthenelse{\equal{#1}{}}{\textbf{{#2}}}{\textbf{Problema {#1} -- {#2} }}}{\\\footnotesize \textbf{Limite de tempo: {#3}s}}{\\[-0.1cm]\footnotesize \textbf{Limite de memória: {#4}MB}} + \end{center} +} + +\newcounter{problemAutor} +\newenvironment{ProblemaAutor}[5]{ + \stepcounter{problemAutor} + \newpage + \begin{center} + \Large{\ifthenelse{\equal{#1}{}}{\textbf{{#2}}}{\textbf{Problema {#1} -- {#2} }}}{\\\footnotesize \textbf{Limite de tempo: {#3}s}}{\\[-0.1cm]\footnotesize \textbf{Limite de memória: {#4}MB\\}}{ + \footnotesize Autor: {#5} + } + \end{center} +} + + +% Código-fonte +\newcommand{\codigofonte}[1]{Nome do arquivo fonte: {#1}} + +% Entrada +\newcommand{\Entrada}{ + \bigskip + \begin{large} + \textbf{Entrada} \\ + \end{large} +} + +% Saida +\newcommand{\Saida}{ + \bigskip + \begin{large} + \textbf{Saída} \\ + \end{large} +} + +\newcommand{\Interacao}{ + \bigskip + \begin{large} + \textbf{Interação} \\ + \end{large} +} + +\newcommand{\Notas}{ + \bigskip + \begin{large} + \textbf{Notas} \\ + \end{large} +} + +% Exemplo +\newenvironment{Exemplo} +{ + + \tabularx{\textwidth}{XX} + % {@{\extracolsep{\fill}}|l|l|} + % {|l|l@{\extracolsep{\fill}|}} + \hline + Entrada & Saída \\\hline +} +{ + \hline + \endtabularx +} + +% Exemplo de Entrada +\newenvironment{ExemploEntrada} +{ + \bigskip + \begin{large} + \textbf{Exemplo} \\ + \end{large} +} +{ +} + +% Sample Output + diff --git a/longest-increasing-subsequence/output/1 b/longest-increasing-subsequence/output/1 new file mode 100644 index 0000000..1df2e06 --- /dev/null +++ b/longest-increasing-subsequence/output/1 @@ -0,0 +1,2 @@ +5 +1 2 3 4 5 diff --git a/longest-increasing-subsequence/output/10 b/longest-increasing-subsequence/output/10 new file mode 100644 index 0000000..077bc2b --- /dev/null +++ b/longest-increasing-subsequence/output/10 @@ -0,0 +1,2 @@ +22 +-7466 -6390 -5672 -5250 -4366 -3111 -3053 -1712 -514 61 1126 1139 4979 5201 5907 6748 7207 7243 7949 8873 9107 9805 diff --git a/longest-increasing-subsequence/output/100 b/longest-increasing-subsequence/output/100 new file mode 100644 index 0000000..63a8b78 --- /dev/null +++ b/longest-increasing-subsequence/output/100 @@ -0,0 +1,2 @@ +56 +-9945 -9419 -9359 -8535 -7308 -6125 -5545 -5479 -5428 -5327 -5275 -4679 -4479 -4353 -3890 -2753 -2500 -2435 -1981 -1811 -1641 -1063 -876 -214 77 1510 2315 2601 2657 3483 3713 3736 3739 3763 3784 4017 5063 5361 5394 5613 5648 5870 5885 6290 6459 6863 7266 7975 8358 8370 8554 8810 9413 9488 9810 9891 diff --git a/longest-increasing-subsequence/output/101 b/longest-increasing-subsequence/output/101 new file mode 100644 index 0000000..d9fab28 --- /dev/null +++ b/longest-increasing-subsequence/output/101 @@ -0,0 +1,2 @@ +22 +-8584 -8442 -7860 -6369 -6110 -5782 -1314 -824 -149 1012 1527 2227 3092 4225 4847 6077 6689 6773 6992 9268 9447 9504 diff --git a/longest-increasing-subsequence/output/102 b/longest-increasing-subsequence/output/102 new file mode 100644 index 0000000..25bdae9 --- /dev/null +++ b/longest-increasing-subsequence/output/102 @@ -0,0 +1,2 @@ +36 +-9291 -7321 -7313 -6800 -6465 -5424 -3703 -3690 -3686 -3186 -2730 -1283 -1179 -818 -247 60 1088 1618 1980 2764 3754 4485 4908 5557 5594 6443 6466 6484 6508 6689 7101 7400 7418 7545 8690 8946 diff --git a/longest-increasing-subsequence/output/103 b/longest-increasing-subsequence/output/103 new file mode 100644 index 0000000..476fcbe --- /dev/null +++ b/longest-increasing-subsequence/output/103 @@ -0,0 +1,2 @@ +55 +-7324 -7106 -6555 -6396 -6140 -5788 -4642 -4557 -4347 -3746 -2597 -1666 -1196 -1124 -819 -619 -162 -158 77 112 441 780 1283 1331 1745 1956 2007 2053 2186 2239 2268 2500 3199 3390 3673 4252 4341 4416 5196 6082 6193 6259 6764 6838 7655 7796 7889 8403 8448 8729 8744 8983 9051 9309 9445 diff --git a/longest-increasing-subsequence/output/104 b/longest-increasing-subsequence/output/104 new file mode 100644 index 0000000..5f7cd88 --- /dev/null +++ b/longest-increasing-subsequence/output/104 @@ -0,0 +1,2 @@ +2 +8265 9791 diff --git a/longest-increasing-subsequence/output/105 b/longest-increasing-subsequence/output/105 new file mode 100644 index 0000000..8eda656 --- /dev/null +++ b/longest-increasing-subsequence/output/105 @@ -0,0 +1,2 @@ +50 +-8984 -8762 -8297 -7086 -5635 -5579 -5208 -4783 -4390 -4230 -3010 -2379 -2368 -1658 -1397 -1393 -300 -188 -115 320 690 756 800 892 1046 1106 1299 1425 2314 2365 2415 2870 2887 3003 3186 3291 3568 4187 4630 4845 6371 6439 7645 8186 8248 8434 8503 9196 9289 9835 diff --git a/longest-increasing-subsequence/output/106 b/longest-increasing-subsequence/output/106 new file mode 100644 index 0000000..54eea23 --- /dev/null +++ b/longest-increasing-subsequence/output/106 @@ -0,0 +1,2 @@ +1 +-10000 diff --git a/longest-increasing-subsequence/output/107 b/longest-increasing-subsequence/output/107 new file mode 100644 index 0000000..5064386 --- /dev/null +++ b/longest-increasing-subsequence/output/107 @@ -0,0 +1,2 @@ +1 +10000 diff --git a/longest-increasing-subsequence/output/11 b/longest-increasing-subsequence/output/11 new file mode 100644 index 0000000..f879006 --- /dev/null +++ b/longest-increasing-subsequence/output/11 @@ -0,0 +1,2 @@ +25 +-8375 -7302 -6462 -6045 -3803 -3581 -3306 -616 -345 -312 313 737 1294 2950 4354 4375 4737 4823 5304 5563 6177 7502 7608 7804 9665 diff --git a/longest-increasing-subsequence/output/12 b/longest-increasing-subsequence/output/12 new file mode 100644 index 0000000..744cb20 --- /dev/null +++ b/longest-increasing-subsequence/output/12 @@ -0,0 +1,2 @@ +20 +-3124 -1465 428 1696 1737 1858 2164 2909 5848 5998 6755 6787 6854 6986 7487 7588 8350 9029 9065 9326 diff --git a/longest-increasing-subsequence/output/13 b/longest-increasing-subsequence/output/13 new file mode 100644 index 0000000..35af8f4 --- /dev/null +++ b/longest-increasing-subsequence/output/13 @@ -0,0 +1,2 @@ +13 +-8381 -6073 -5611 -6 252 656 835 1712 4346 4556 7043 8478 9987 diff --git a/longest-increasing-subsequence/output/14 b/longest-increasing-subsequence/output/14 new file mode 100644 index 0000000..795bf22 --- /dev/null +++ b/longest-increasing-subsequence/output/14 @@ -0,0 +1,2 @@ +11 +-7232 -6152 -3311 -3222 -2936 -1837 664 2093 4017 9277 9584 diff --git a/longest-increasing-subsequence/output/15 b/longest-increasing-subsequence/output/15 new file mode 100644 index 0000000..01d30f8 --- /dev/null +++ b/longest-increasing-subsequence/output/15 @@ -0,0 +1,2 @@ +11 +-6713 -5926 -5368 -5155 -4084 -1548 -436 3027 4294 5293 6760 diff --git a/longest-increasing-subsequence/output/16 b/longest-increasing-subsequence/output/16 new file mode 100644 index 0000000..5e9f12f --- /dev/null +++ b/longest-increasing-subsequence/output/16 @@ -0,0 +1,2 @@ +27 +-6775 -6311 -5641 -5109 -3496 -3451 -3417 -2946 -114 195 898 924 1069 1680 2941 3012 3171 3198 3734 4438 5212 5344 6312 7252 7349 9392 9868 diff --git a/longest-increasing-subsequence/output/17 b/longest-increasing-subsequence/output/17 new file mode 100644 index 0000000..1a54fd7 --- /dev/null +++ b/longest-increasing-subsequence/output/17 @@ -0,0 +1,2 @@ +6 +-8568 -8417 -8044 2209 7009 7122 diff --git a/longest-increasing-subsequence/output/18 b/longest-increasing-subsequence/output/18 new file mode 100644 index 0000000..36b9de9 --- /dev/null +++ b/longest-increasing-subsequence/output/18 @@ -0,0 +1,2 @@ +17 +-9321 -9279 -7582 -5655 -3296 -4 630 1877 2203 3857 3972 4211 5193 5784 7477 8988 9387 diff --git a/longest-increasing-subsequence/output/19 b/longest-increasing-subsequence/output/19 new file mode 100644 index 0000000..35bb03d --- /dev/null +++ b/longest-increasing-subsequence/output/19 @@ -0,0 +1,2 @@ +29 +-9163 -8648 -8385 -8314 -8178 -7078 -5042 -5032 -4562 -3730 -3024 -2912 -2161 -913 -776 1238 2519 2846 3301 3588 3925 4141 5221 5460 5749 8645 8844 9142 9912 diff --git a/longest-increasing-subsequence/output/2 b/longest-increasing-subsequence/output/2 new file mode 100644 index 0000000..88820dc --- /dev/null +++ b/longest-increasing-subsequence/output/2 @@ -0,0 +1,2 @@ +3 +2 3 4 diff --git a/longest-increasing-subsequence/output/20 b/longest-increasing-subsequence/output/20 new file mode 100644 index 0000000..b7bdb78 --- /dev/null +++ b/longest-increasing-subsequence/output/20 @@ -0,0 +1,2 @@ +17 +-8278 -5858 -5456 -3577 123 408 1274 3102 3558 3701 3937 4205 5572 5845 7129 7255 7843 diff --git a/longest-increasing-subsequence/output/21 b/longest-increasing-subsequence/output/21 new file mode 100644 index 0000000..708dd40 --- /dev/null +++ b/longest-increasing-subsequence/output/21 @@ -0,0 +1,2 @@ +27 +-6845 -5883 -5355 -4497 -4403 -3156 -2918 -2414 1216 2524 5420 5450 5644 6727 6804 7536 7668 7840 8491 8590 8607 8986 9393 9625 9680 9907 9912 diff --git a/longest-increasing-subsequence/output/22 b/longest-increasing-subsequence/output/22 new file mode 100644 index 0000000..1b70b57 --- /dev/null +++ b/longest-increasing-subsequence/output/22 @@ -0,0 +1,2 @@ +25 +-9983 -9465 -6902 -3783 -3189 -3047 -2841 -2177 -2150 -1575 -1295 -1143 -394 122 608 737 1088 1928 3926 3947 4132 4606 8063 8247 8712 diff --git a/longest-increasing-subsequence/output/23 b/longest-increasing-subsequence/output/23 new file mode 100644 index 0000000..1ea0611 --- /dev/null +++ b/longest-increasing-subsequence/output/23 @@ -0,0 +1,2 @@ +20 +-8746 -6749 -5478 -5139 -4114 -544 -475 -203 1325 1509 2404 3298 3467 3469 3720 4022 5857 7272 7655 9907 diff --git a/longest-increasing-subsequence/output/24 b/longest-increasing-subsequence/output/24 new file mode 100644 index 0000000..dd516f8 --- /dev/null +++ b/longest-increasing-subsequence/output/24 @@ -0,0 +1,2 @@ +31 +-9311 -8558 -8077 -6962 -6883 -6823 -6612 -5498 -5085 -4499 -4344 -2880 -2865 -2756 -2499 -2136 -2124 -2061 -1104 -861 2842 2925 3224 3226 3580 6260 6610 7293 7433 8457 8965 diff --git a/longest-increasing-subsequence/output/25 b/longest-increasing-subsequence/output/25 new file mode 100644 index 0000000..b0e7983 --- /dev/null +++ b/longest-increasing-subsequence/output/25 @@ -0,0 +1,2 @@ +16 +-8597 -4457 -2749 -2083 -1280 585 814 1103 1331 2043 3225 4478 4783 5136 5961 8518 diff --git a/longest-increasing-subsequence/output/26 b/longest-increasing-subsequence/output/26 new file mode 100644 index 0000000..c2d54a1 --- /dev/null +++ b/longest-increasing-subsequence/output/26 @@ -0,0 +1,2 @@ +24 +-8938 -6450 -6446 -5972 -5875 -4719 -4544 -4513 -4302 -2410 -1715 -1165 -1047 -1035 1075 1362 1431 3193 4159 4450 4800 5081 5937 9073 diff --git a/longest-increasing-subsequence/output/27 b/longest-increasing-subsequence/output/27 new file mode 100644 index 0000000..7360a76 --- /dev/null +++ b/longest-increasing-subsequence/output/27 @@ -0,0 +1,2 @@ +24 +-9906 -9241 -8376 -8092 -4815 -4586 -3740 -2401 -1944 -561 -88 246 2297 2697 4583 4973 5692 5696 7214 7244 7409 7716 7820 8184 diff --git a/longest-increasing-subsequence/output/28 b/longest-increasing-subsequence/output/28 new file mode 100644 index 0000000..ef94464 --- /dev/null +++ b/longest-increasing-subsequence/output/28 @@ -0,0 +1,2 @@ +2 +1910 2237 diff --git a/longest-increasing-subsequence/output/29 b/longest-increasing-subsequence/output/29 new file mode 100644 index 0000000..d16a3e0 --- /dev/null +++ b/longest-increasing-subsequence/output/29 @@ -0,0 +1,2 @@ +27 +-9133 -6876 -6288 -5320 -5289 -4408 -4402 -4176 -3756 -2783 -2137 -1909 -691 -402 1321 1630 2154 2591 3577 4167 6233 6255 6556 6966 7354 7890 8472 diff --git a/longest-increasing-subsequence/output/3 b/longest-increasing-subsequence/output/3 new file mode 100644 index 0000000..b261da1 --- /dev/null +++ b/longest-increasing-subsequence/output/3 @@ -0,0 +1,2 @@ +1 +0 diff --git a/longest-increasing-subsequence/output/30 b/longest-increasing-subsequence/output/30 new file mode 100644 index 0000000..94927d2 --- /dev/null +++ b/longest-increasing-subsequence/output/30 @@ -0,0 +1,2 @@ +33 +-8874 -8504 -7995 -7737 -7342 -6969 -6621 -6144 -4209 -4061 -2918 -2361 -2275 -524 -433 1441 2477 3064 3797 4307 4674 6267 6587 6949 7478 7622 7793 7987 8412 8579 8865 9444 9742 diff --git a/longest-increasing-subsequence/output/31 b/longest-increasing-subsequence/output/31 new file mode 100644 index 0000000..a01ee03 --- /dev/null +++ b/longest-increasing-subsequence/output/31 @@ -0,0 +1,2 @@ +29 +-8361 -7963 -7400 -7250 -6821 -6060 -5801 -5717 -5458 -5274 -4232 -2261 -1667 -1542 -1034 -787 -315 61 1369 2104 3025 3410 3800 3949 4207 4842 6881 8040 9865 diff --git a/longest-increasing-subsequence/output/32 b/longest-increasing-subsequence/output/32 new file mode 100644 index 0000000..8977f6e --- /dev/null +++ b/longest-increasing-subsequence/output/32 @@ -0,0 +1,2 @@ +20 +-7700 -6838 -6673 -6644 -6468 -4530 -2428 -2231 -1512 2863 2981 3695 3703 4132 5051 5147 6632 7683 8488 9320 diff --git a/longest-increasing-subsequence/output/33 b/longest-increasing-subsequence/output/33 new file mode 100644 index 0000000..befa829 --- /dev/null +++ b/longest-increasing-subsequence/output/33 @@ -0,0 +1,2 @@ +22 +-9512 -7592 -6990 -6780 -5958 -4796 -4670 -2274 -2263 -2129 -2055 -1779 -1444 -1259 -1008 2059 2126 2464 3174 6262 6602 8865 diff --git a/longest-increasing-subsequence/output/34 b/longest-increasing-subsequence/output/34 new file mode 100644 index 0000000..bd82848 --- /dev/null +++ b/longest-increasing-subsequence/output/34 @@ -0,0 +1,2 @@ +15 +-9568 -8787 -6736 -4078 -2151 -2101 -207 209 1425 2766 3220 3636 6930 8466 9400 diff --git a/longest-increasing-subsequence/output/35 b/longest-increasing-subsequence/output/35 new file mode 100644 index 0000000..172ff4e --- /dev/null +++ b/longest-increasing-subsequence/output/35 @@ -0,0 +1,2 @@ +24 +-8384 -7485 -7291 -6326 -5951 -5917 -4572 -2719 -2469 -400 2255 2889 3394 5159 5550 5683 7225 7606 7668 7728 8605 8789 9155 9731 diff --git a/longest-increasing-subsequence/output/36 b/longest-increasing-subsequence/output/36 new file mode 100644 index 0000000..5c2ecc0 --- /dev/null +++ b/longest-increasing-subsequence/output/36 @@ -0,0 +1,2 @@ +12 +-7532 -6599 -6346 -5339 -2593 -2367 -725 3832 6670 6809 8327 9686 diff --git a/longest-increasing-subsequence/output/37 b/longest-increasing-subsequence/output/37 new file mode 100644 index 0000000..77a5c6f --- /dev/null +++ b/longest-increasing-subsequence/output/37 @@ -0,0 +1,2 @@ +22 +-6312 -5644 -4622 -3419 -3095 -2977 -1553 -819 -272 -227 2136 2370 2456 2688 3112 5104 6621 7503 8040 8691 8871 9452 diff --git a/longest-increasing-subsequence/output/38 b/longest-increasing-subsequence/output/38 new file mode 100644 index 0000000..8836e78 --- /dev/null +++ b/longest-increasing-subsequence/output/38 @@ -0,0 +1,2 @@ +34 +-9570 -9433 -8103 -8003 -7724 -7643 -6626 -6576 -5936 -3137 -3040 -1708 -1434 15 536 1277 1904 2631 2953 3498 3873 4017 4308 4559 5027 5658 5742 6045 6996 8639 8923 8954 9018 9820 diff --git a/longest-increasing-subsequence/output/39 b/longest-increasing-subsequence/output/39 new file mode 100644 index 0000000..3b46129 --- /dev/null +++ b/longest-increasing-subsequence/output/39 @@ -0,0 +1,2 @@ +44 +-9038 -8750 -8643 -8111 -7926 -7823 -7680 -7576 -7458 -7375 -7052 -6812 -6756 -5375 -5212 -2996 -2419 -2267 -1383 -1379 -1171 -631 -498 61 1720 1999 2315 3039 3258 3547 3895 4939 5449 6400 6567 7004 7024 7572 8169 8334 8734 9119 9621 9900 diff --git a/longest-increasing-subsequence/output/4 b/longest-increasing-subsequence/output/4 new file mode 100644 index 0000000..54eea23 --- /dev/null +++ b/longest-increasing-subsequence/output/4 @@ -0,0 +1,2 @@ +1 +-10000 diff --git a/longest-increasing-subsequence/output/40 b/longest-increasing-subsequence/output/40 new file mode 100644 index 0000000..7094890 --- /dev/null +++ b/longest-increasing-subsequence/output/40 @@ -0,0 +1,2 @@ +22 +-8854 -7617 -6002 -5486 -5373 -3952 -3668 -1986 -1643 -830 -209 -103 2547 3886 4418 4474 5926 7358 8148 8256 8915 9515 diff --git a/longest-increasing-subsequence/output/41 b/longest-increasing-subsequence/output/41 new file mode 100644 index 0000000..10c8e94 --- /dev/null +++ b/longest-increasing-subsequence/output/41 @@ -0,0 +1,2 @@ +32 +-9690 -9343 -7437 -6586 -6563 -6052 -5841 -5482 -5203 -5026 -4968 -4282 -1986 -1173 -896 247 250 1423 1541 2493 2559 2820 3320 4957 5835 6111 6418 6761 7775 8334 9540 9765 diff --git a/longest-increasing-subsequence/output/42 b/longest-increasing-subsequence/output/42 new file mode 100644 index 0000000..0472f22 --- /dev/null +++ b/longest-increasing-subsequence/output/42 @@ -0,0 +1,2 @@ +44 +-9724 -9469 -8501 -8353 -8127 -7973 -7725 -7032 -6910 -6780 -6728 -6533 -6410 -5830 -5695 -5104 -4349 -3462 -3375 -2198 -2080 -1873 -1158 -929 -553 -202 886 1298 2288 2709 2971 3093 3183 3521 3605 5424 5826 6076 7284 7635 8358 9199 9722 9913 diff --git a/longest-increasing-subsequence/output/43 b/longest-increasing-subsequence/output/43 new file mode 100644 index 0000000..202116b --- /dev/null +++ b/longest-increasing-subsequence/output/43 @@ -0,0 +1,2 @@ +39 +-9176 -8668 -8237 -7611 -6746 -6615 -5482 -5479 -5395 -4578 -3281 -3020 -2427 -2026 -1612 -1558 -1271 -336 -87 13 361 660 1108 1227 1675 2305 2552 2943 4342 4681 5019 5120 5493 6369 7057 7330 7968 9290 9730 diff --git a/longest-increasing-subsequence/output/44 b/longest-increasing-subsequence/output/44 new file mode 100644 index 0000000..1b6c8ca --- /dev/null +++ b/longest-increasing-subsequence/output/44 @@ -0,0 +1,2 @@ +29 +-9228 -9028 -8561 -7848 -7767 -6528 -5014 -4729 -4432 -4310 -4207 -3299 -2444 343 1937 2583 2765 3921 4370 5769 6147 6304 6436 7052 7739 9204 9319 9399 9432 diff --git a/longest-increasing-subsequence/output/45 b/longest-increasing-subsequence/output/45 new file mode 100644 index 0000000..4b12f48 --- /dev/null +++ b/longest-increasing-subsequence/output/45 @@ -0,0 +1,2 @@ +25 +-8581 -7881 -7288 -7233 -6196 -5825 -5418 -4669 -3628 -3073 -3065 -1271 -1184 -280 1018 1318 1717 2850 3232 3605 4029 7419 8364 9114 9394 diff --git a/longest-increasing-subsequence/output/46 b/longest-increasing-subsequence/output/46 new file mode 100644 index 0000000..7127595 --- /dev/null +++ b/longest-increasing-subsequence/output/46 @@ -0,0 +1,2 @@ +14 +-9936 -9584 -8033 -5498 -5412 -2642 -1904 -290 -129 1957 2488 3514 5232 6138 diff --git a/longest-increasing-subsequence/output/47 b/longest-increasing-subsequence/output/47 new file mode 100644 index 0000000..fca655b --- /dev/null +++ b/longest-increasing-subsequence/output/47 @@ -0,0 +1,2 @@ +30 +-9860 -9638 -9269 -8461 -7748 -6377 -5677 -5469 -5191 -5129 -3937 -1037 114 1408 1948 3275 3996 5018 5110 5225 5256 5669 5744 5933 6040 6327 7618 8482 8666 9082 diff --git a/longest-increasing-subsequence/output/48 b/longest-increasing-subsequence/output/48 new file mode 100644 index 0000000..0cf7f3b --- /dev/null +++ b/longest-increasing-subsequence/output/48 @@ -0,0 +1,2 @@ +34 +-8739 -7323 -6317 -6005 -3539 -3413 -2752 -2681 -2373 -2048 -1945 -1667 -310 -167 794 955 1360 2661 2756 2827 4919 5385 5683 6514 7090 7199 7216 7713 7957 8678 8850 9499 9531 9748 diff --git a/longest-increasing-subsequence/output/49 b/longest-increasing-subsequence/output/49 new file mode 100644 index 0000000..8fb230e --- /dev/null +++ b/longest-increasing-subsequence/output/49 @@ -0,0 +1,2 @@ +39 +-8127 -7928 -6966 -6438 -6427 -6140 -5813 -5682 -5424 -4505 -4181 -3402 -3144 -2203 -1097 -753 42 311 1107 1353 2170 2228 2390 2781 3656 3910 3913 4056 4250 5798 6221 6368 6377 6613 6746 7071 9166 9218 9287 diff --git a/longest-increasing-subsequence/output/5 b/longest-increasing-subsequence/output/5 new file mode 100644 index 0000000..b261da1 --- /dev/null +++ b/longest-increasing-subsequence/output/5 @@ -0,0 +1,2 @@ +1 +0 diff --git a/longest-increasing-subsequence/output/50 b/longest-increasing-subsequence/output/50 new file mode 100644 index 0000000..bc361f4 --- /dev/null +++ b/longest-increasing-subsequence/output/50 @@ -0,0 +1,2 @@ +21 +-9789 -9454 -7812 -7326 -7266 -6031 -4977 -4915 -4837 -4225 -2533 -2457 -1867 -543 2009 2466 4850 6359 7103 9427 9562 diff --git a/longest-increasing-subsequence/output/51 b/longest-increasing-subsequence/output/51 new file mode 100644 index 0000000..d62a031 --- /dev/null +++ b/longest-increasing-subsequence/output/51 @@ -0,0 +1,2 @@ +40 +-9644 -8921 -8450 -8432 -7983 -6183 -5792 -5211 -5150 -4585 -3990 -2890 -2678 -2545 -613 96 370 488 730 749 1073 2629 3046 3449 3629 3892 4867 5182 5309 5358 5838 6841 8285 8292 8623 8764 8855 9136 9576 9679 diff --git a/longest-increasing-subsequence/output/52 b/longest-increasing-subsequence/output/52 new file mode 100644 index 0000000..9a83bba --- /dev/null +++ b/longest-increasing-subsequence/output/52 @@ -0,0 +1,2 @@ +33 +-8876 -7620 -7421 -7260 -6752 -6715 -6395 -6323 -6162 -5818 -5804 -5682 -3823 -3314 -2519 -2117 -1953 -1732 -1553 -1344 947 1559 1976 2466 2854 3736 4786 4978 5868 7050 7318 7632 9832 diff --git a/longest-increasing-subsequence/output/53 b/longest-increasing-subsequence/output/53 new file mode 100644 index 0000000..bccb7cc --- /dev/null +++ b/longest-increasing-subsequence/output/53 @@ -0,0 +1,2 @@ +6 +-5951 -3582 405 2666 6858 6991 diff --git a/longest-increasing-subsequence/output/54 b/longest-increasing-subsequence/output/54 new file mode 100644 index 0000000..7203cfc --- /dev/null +++ b/longest-increasing-subsequence/output/54 @@ -0,0 +1,2 @@ +22 +-9063 -8960 -7649 -2537 -2343 -1078 466 1478 1488 1721 2316 2414 2470 2498 2619 6494 6947 7165 7351 8822 9026 9461 diff --git a/longest-increasing-subsequence/output/55 b/longest-increasing-subsequence/output/55 new file mode 100644 index 0000000..901be20 --- /dev/null +++ b/longest-increasing-subsequence/output/55 @@ -0,0 +1,2 @@ +36 +-8951 -8216 -6963 -5809 -5655 -4636 -3882 -1328 -1232 -371 -370 1621 2032 2216 2275 2648 3152 3269 3359 3772 3863 4193 4440 4607 4629 5390 6903 6912 6970 7020 7447 7448 7867 8007 9567 9633 diff --git a/longest-increasing-subsequence/output/56 b/longest-increasing-subsequence/output/56 new file mode 100644 index 0000000..114497e --- /dev/null +++ b/longest-increasing-subsequence/output/56 @@ -0,0 +1,2 @@ +61 +-9554 -9254 -9204 -8393 -7704 -7658 -7370 -7170 -7148 -7012 -6868 -6794 -6714 -6346 -5403 -5002 -4834 -4678 -4251 -3936 -3908 -3754 -3511 -3462 -3061 -2473 -2447 -2433 -1549 -1416 -1358 -968 -615 -357 -258 -191 -173 167 771 1160 1362 1832 1842 2185 2532 2670 2706 3015 3343 3877 4019 4348 5113 6093 6282 6374 7388 7686 8031 8415 9158 diff --git a/longest-increasing-subsequence/output/57 b/longest-increasing-subsequence/output/57 new file mode 100644 index 0000000..5de426d --- /dev/null +++ b/longest-increasing-subsequence/output/57 @@ -0,0 +1,2 @@ +29 +-9511 -9269 -9133 -8804 -8358 -8208 -7558 -4782 -4389 -3862 -3351 -1981 -1790 -1561 -1227 -16 860 912 2505 4188 4566 4751 5830 6164 6185 6954 7434 8498 9034 diff --git a/longest-increasing-subsequence/output/58 b/longest-increasing-subsequence/output/58 new file mode 100644 index 0000000..ed27445 --- /dev/null +++ b/longest-increasing-subsequence/output/58 @@ -0,0 +1,2 @@ +50 +-9767 -9103 -8142 -7124 -6957 -6951 -6934 -6696 -6441 -5884 -5804 -5796 -5786 -5747 -5744 -4914 -4624 -4491 -4187 -3805 -3753 -3478 -2241 -1930 -754 -525 -315 -233 395 1601 1853 2808 2926 3247 3267 3547 4122 4167 4921 5257 6612 6972 7275 7445 7807 8453 8690 9399 9507 9985 diff --git a/longest-increasing-subsequence/output/59 b/longest-increasing-subsequence/output/59 new file mode 100644 index 0000000..799099e --- /dev/null +++ b/longest-increasing-subsequence/output/59 @@ -0,0 +1,2 @@ +55 +-9596 -9339 -8800 -8791 -8686 -8036 -7535 -7302 -6954 -6938 -6881 -5831 -5793 -5350 -4391 -4187 -4038 -3993 -3977 -3662 -3491 -3413 -3285 -3105 -3042 -2884 -2203 -2156 -2034 -1935 -1639 -366 -67 1539 1860 2024 2781 2985 2994 3193 3516 3540 3756 3861 5292 5436 5511 6749 6799 6988 7453 7934 7992 8269 8850 diff --git a/longest-increasing-subsequence/output/6 b/longest-increasing-subsequence/output/6 new file mode 100644 index 0000000..43e84d3 --- /dev/null +++ b/longest-increasing-subsequence/output/6 @@ -0,0 +1,2 @@ +4 +-7215 -5179 1091 7868 diff --git a/longest-increasing-subsequence/output/60 b/longest-increasing-subsequence/output/60 new file mode 100644 index 0000000..fde266f --- /dev/null +++ b/longest-increasing-subsequence/output/60 @@ -0,0 +1,2 @@ +47 +-8790 -8526 -8271 -7956 -7746 -7375 -7295 -7247 -6392 -5924 -4650 -4619 -4591 -4535 -2395 -2278 -1899 -1802 -1069 -105 -72 403 684 808 1245 1438 2073 2087 2968 3125 3502 3563 3880 3938 4440 5351 5989 6527 6666 7424 7624 7721 8107 8382 8677 9076 9616 diff --git a/longest-increasing-subsequence/output/61 b/longest-increasing-subsequence/output/61 new file mode 100644 index 0000000..ae22f9a --- /dev/null +++ b/longest-increasing-subsequence/output/61 @@ -0,0 +1,2 @@ +13 +-9681 -3317 -2217 -2060 2488 5319 5530 5876 6160 6907 6952 7718 7869 diff --git a/longest-increasing-subsequence/output/62 b/longest-increasing-subsequence/output/62 new file mode 100644 index 0000000..d3e7e16 --- /dev/null +++ b/longest-increasing-subsequence/output/62 @@ -0,0 +1,2 @@ +17 +-9599 -7215 -6054 -3739 -2228 -1507 -1327 -591 -156 1885 4002 4773 6634 8757 8869 9313 9345 diff --git a/longest-increasing-subsequence/output/63 b/longest-increasing-subsequence/output/63 new file mode 100644 index 0000000..8c09ae8 --- /dev/null +++ b/longest-increasing-subsequence/output/63 @@ -0,0 +1,2 @@ +33 +-7135 -6238 -5472 -3912 -2928 -2053 -1433 -1083 -1005 -826 -724 -633 -566 -178 -36 1148 1475 1963 4218 4363 4727 4757 5704 5789 5845 5993 6466 6621 6669 7386 8159 8958 9019 diff --git a/longest-increasing-subsequence/output/64 b/longest-increasing-subsequence/output/64 new file mode 100644 index 0000000..c773063 --- /dev/null +++ b/longest-increasing-subsequence/output/64 @@ -0,0 +1,2 @@ +53 +-7076 -6941 -6586 -6438 -5333 -5281 -5147 -4601 -4543 -4430 -3105 -3097 -3068 -2592 -2406 -2312 -2189 -1993 -1922 -1590 -1448 -1067 -748 -173 500 651 727 830 1547 1551 1985 2615 2650 3152 3757 4127 4220 4245 4358 4403 4932 4961 5178 6232 6547 6604 6750 7649 7696 8933 9109 9483 9929 diff --git a/longest-increasing-subsequence/output/65 b/longest-increasing-subsequence/output/65 new file mode 100644 index 0000000..f2fc420 --- /dev/null +++ b/longest-increasing-subsequence/output/65 @@ -0,0 +1,2 @@ +53 +-9276 -9203 -9009 -7471 -7290 -7272 -6884 -6826 -6633 -6176 -5787 -4937 -4678 -4495 -4399 -4312 -3963 -2427 -1905 -1370 -877 -666 -551 -270 -174 209 720 1141 1432 2304 3397 3546 3644 3952 4090 4545 4602 4931 5688 5922 5971 6175 6337 6603 6679 6829 7256 7540 8111 8692 9253 9403 9743 diff --git a/longest-increasing-subsequence/output/66 b/longest-increasing-subsequence/output/66 new file mode 100644 index 0000000..7780f0a --- /dev/null +++ b/longest-increasing-subsequence/output/66 @@ -0,0 +1,2 @@ +47 +-9992 -9455 -9096 -6759 -5377 -4338 -4028 -3992 -3842 -3770 -3750 -3738 -3707 -3246 -1741 -1338 -761 966 1012 1304 1971 2849 2931 3047 4117 4371 4442 5279 5371 5686 5904 5975 5997 6140 6594 6662 7371 7719 7740 8149 8423 8706 8954 9292 9348 9652 9873 diff --git a/longest-increasing-subsequence/output/67 b/longest-increasing-subsequence/output/67 new file mode 100644 index 0000000..f46653e --- /dev/null +++ b/longest-increasing-subsequence/output/67 @@ -0,0 +1,2 @@ +26 +-8669 -8248 -6804 -5552 -5504 -5255 -5239 -1644 -1463 -909 -749 -88 72 3093 3838 3991 4410 4821 4843 6950 8282 8706 8843 9086 9293 9339 diff --git a/longest-increasing-subsequence/output/68 b/longest-increasing-subsequence/output/68 new file mode 100644 index 0000000..ab68a38 --- /dev/null +++ b/longest-increasing-subsequence/output/68 @@ -0,0 +1,2 @@ +54 +-8980 -8558 -8406 -8097 -7847 -7816 -7724 -7182 -6883 -6863 -5931 -5786 -5295 -5152 -4625 -4327 -4130 -3988 -3574 -3197 -3176 -2874 -2283 -1408 -1198 -1144 -925 -206 -68 -25 92 248 705 1436 1751 1880 2383 2979 3081 4293 4389 5441 5643 6357 7099 7141 7675 7698 8146 8423 9086 9140 9223 9805 diff --git a/longest-increasing-subsequence/output/69 b/longest-increasing-subsequence/output/69 new file mode 100644 index 0000000..1599946 --- /dev/null +++ b/longest-increasing-subsequence/output/69 @@ -0,0 +1,2 @@ +26 +-9285 -5461 -5458 -5198 -3219 -2308 -1851 -837 627 1106 2381 2490 2946 3446 4264 4532 5904 6211 6310 6342 6677 7386 7616 8212 8287 9574 diff --git a/longest-increasing-subsequence/output/7 b/longest-increasing-subsequence/output/7 new file mode 100644 index 0000000..8f79103 --- /dev/null +++ b/longest-increasing-subsequence/output/7 @@ -0,0 +1,2 @@ +18 +-9402 -7238 -2917 -856 -543 -385 340 639 1700 2294 2511 3296 3474 4777 5035 5857 6115 8109 diff --git a/longest-increasing-subsequence/output/70 b/longest-increasing-subsequence/output/70 new file mode 100644 index 0000000..536f985 --- /dev/null +++ b/longest-increasing-subsequence/output/70 @@ -0,0 +1,2 @@ +29 +-7075 -6508 -6282 -5447 -5353 -5203 -4683 -3896 -3828 -3131 -2655 -1670 -1313 -816 -656 -261 628 962 1444 1753 2092 2723 3917 6302 7329 7450 7535 8466 9812 diff --git a/longest-increasing-subsequence/output/71 b/longest-increasing-subsequence/output/71 new file mode 100644 index 0000000..00218e1 --- /dev/null +++ b/longest-increasing-subsequence/output/71 @@ -0,0 +1,2 @@ +30 +-9853 -9825 -7925 -7468 -5468 -5279 -4309 -3249 -2616 -1706 -1434 -1006 -141 118 625 722 1551 2073 2745 3727 5654 5734 6084 6146 6184 6427 6824 7811 8636 9440 diff --git a/longest-increasing-subsequence/output/72 b/longest-increasing-subsequence/output/72 new file mode 100644 index 0000000..a8f8740 --- /dev/null +++ b/longest-increasing-subsequence/output/72 @@ -0,0 +1,2 @@ +36 +-9925 -8768 -7732 -7602 -6185 -4864 -3982 -3484 -3385 -3240 -3088 -1859 -1616 -1551 -1331 -1066 784 1021 1178 1229 1744 1842 2663 2742 2788 3643 4356 5110 5965 6432 6567 7577 7799 8376 8566 9435 diff --git a/longest-increasing-subsequence/output/73 b/longest-increasing-subsequence/output/73 new file mode 100644 index 0000000..f5c1fe1 --- /dev/null +++ b/longest-increasing-subsequence/output/73 @@ -0,0 +1,2 @@ +41 +-7028 -5634 -5497 -5399 -5185 -4995 -4895 -4716 -4345 -4101 -3441 -3195 -2687 -2590 -2356 -1627 -1383 -1265 -937 -701 -524 -408 -366 -343 -135 -84 470 1375 2134 2609 2985 3444 4438 4511 5422 5489 5868 6648 6996 7821 8091 diff --git a/longest-increasing-subsequence/output/74 b/longest-increasing-subsequence/output/74 new file mode 100644 index 0000000..dfb3c40 --- /dev/null +++ b/longest-increasing-subsequence/output/74 @@ -0,0 +1,2 @@ +44 +-8790 -8146 -7539 -6572 -6078 -5996 -5425 -5306 -4899 -4196 -3123 -2757 -2385 -2259 -1992 -1563 -1555 -1409 -1239 -370 405 625 737 981 1988 2212 2800 3940 4719 5208 6480 6944 7285 7541 7598 7685 7824 7943 8200 8567 8588 9135 9793 9912 diff --git a/longest-increasing-subsequence/output/75 b/longest-increasing-subsequence/output/75 new file mode 100644 index 0000000..f131d0d --- /dev/null +++ b/longest-increasing-subsequence/output/75 @@ -0,0 +1,2 @@ +55 +-9966 -9760 -9274 -9140 -9099 -9041 -9021 -8808 -8697 -8571 -7863 -7754 -7739 -7270 -7159 -6553 -5259 -4998 -4984 -4894 -4472 -4445 -4209 -4117 -3968 -3001 -2071 -1665 -1405 -978 -764 -264 -136 201 506 644 1044 1432 1703 3966 5727 5814 5821 5995 6021 6531 6739 7321 8111 8288 9266 9334 9349 9716 9816 diff --git a/longest-increasing-subsequence/output/76 b/longest-increasing-subsequence/output/76 new file mode 100644 index 0000000..8ae8e15 --- /dev/null +++ b/longest-increasing-subsequence/output/76 @@ -0,0 +1,2 @@ +57 +-9721 -9640 -9463 -9303 -8946 -8819 -8547 -8032 -7993 -7090 -7045 -6253 -5736 -5638 -5497 -5149 -4984 -4910 -4720 -4572 -4430 -4284 -3680 -3430 -3151 -2737 -2731 -2385 -2074 -1978 -1170 -700 152 789 950 1046 1051 1549 2108 2160 2781 3365 4315 4547 4617 4622 4690 5117 5275 5946 6986 7327 7722 7967 8397 8719 8807 diff --git a/longest-increasing-subsequence/output/77 b/longest-increasing-subsequence/output/77 new file mode 100644 index 0000000..8e28c24 --- /dev/null +++ b/longest-increasing-subsequence/output/77 @@ -0,0 +1,2 @@ +53 +-9243 -8289 -7906 -7678 -7119 -6742 -6545 -6324 -4463 -4041 -3780 -3463 -2943 -2223 -1343 -1314 -1132 -549 -517 -135 227 354 1122 1125 1407 2059 2214 2434 2568 2971 3479 4022 4092 4557 5734 5999 6123 6419 6694 6834 7086 7098 7732 8019 8404 8505 8548 8911 8939 9479 9758 9838 9892 diff --git a/longest-increasing-subsequence/output/78 b/longest-increasing-subsequence/output/78 new file mode 100644 index 0000000..975b8b5 --- /dev/null +++ b/longest-increasing-subsequence/output/78 @@ -0,0 +1,2 @@ +56 +-9230 -9109 -8868 -7597 -7444 -6957 -6926 -5316 -4863 -4499 -3985 -3523 -3230 -3085 -2244 -2185 -1744 -1667 -1061 -921 -860 -436 166 351 375 662 894 1006 1103 1117 1815 1878 2203 2691 2792 4191 4734 4819 5474 6048 6267 7115 7363 7406 7455 7535 7670 8198 8518 8668 8918 8922 9211 9254 9302 9612 diff --git a/longest-increasing-subsequence/output/79 b/longest-increasing-subsequence/output/79 new file mode 100644 index 0000000..813adc5 --- /dev/null +++ b/longest-increasing-subsequence/output/79 @@ -0,0 +1,2 @@ +19 +-4307 -926 121 975 2430 2534 2917 3470 3667 4556 5714 6148 6440 7479 7870 8467 9415 9606 9796 diff --git a/longest-increasing-subsequence/output/8 b/longest-increasing-subsequence/output/8 new file mode 100644 index 0000000..0defd06 --- /dev/null +++ b/longest-increasing-subsequence/output/8 @@ -0,0 +1,2 @@ +12 +-9883 -9335 -9104 -8849 -5806 -4160 -2248 913 2417 7449 8190 9681 diff --git a/longest-increasing-subsequence/output/80 b/longest-increasing-subsequence/output/80 new file mode 100644 index 0000000..b595e9e --- /dev/null +++ b/longest-increasing-subsequence/output/80 @@ -0,0 +1,2 @@ +49 +-9570 -9513 -9157 -8835 -8829 -8750 -8615 -8481 -8170 -7970 -7219 -6779 -6752 -6191 -5850 -5592 -5110 -5048 -4089 -3510 -2026 -1261 -606 -224 -199 -97 16 441 663 896 1306 1315 2419 2807 2836 3046 3361 3371 3530 3621 3713 3736 4146 4325 4518 4826 4909 8953 9796 diff --git a/longest-increasing-subsequence/output/81 b/longest-increasing-subsequence/output/81 new file mode 100644 index 0000000..94677a5 --- /dev/null +++ b/longest-increasing-subsequence/output/81 @@ -0,0 +1,2 @@ +39 +-9788 -9397 -9349 -8999 -8819 -8217 -7426 -7105 -7030 -6655 -6063 -5752 -5324 -5112 -4361 -4120 -4089 -3706 -3481 -3042 -531 -275 228 3415 4243 4279 4293 4511 4604 4922 5097 5109 6031 7927 7964 8333 8895 9383 9708 diff --git a/longest-increasing-subsequence/output/82 b/longest-increasing-subsequence/output/82 new file mode 100644 index 0000000..7a9863b --- /dev/null +++ b/longest-increasing-subsequence/output/82 @@ -0,0 +1,2 @@ +22 +-9379 -9181 -8457 -7591 -6424 -6265 -5157 -4893 -4279 -4187 -796 140 1342 4169 4506 4600 4690 4882 7079 7506 7689 8415 diff --git a/longest-increasing-subsequence/output/83 b/longest-increasing-subsequence/output/83 new file mode 100644 index 0000000..26114ad --- /dev/null +++ b/longest-increasing-subsequence/output/83 @@ -0,0 +1,2 @@ +19 +-7963 -7683 -7307 -6501 -5577 -4513 -3086 -1942 -1818 -436 531 756 846 990 4028 4288 6996 7528 8402 diff --git a/longest-increasing-subsequence/output/84 b/longest-increasing-subsequence/output/84 new file mode 100644 index 0000000..4fa7aa3 --- /dev/null +++ b/longest-increasing-subsequence/output/84 @@ -0,0 +1,2 @@ +25 +-7932 -7212 -6390 -6066 -4146 -1179 -1064 -625 -72 296 2474 3615 3754 4114 4961 5258 5733 5891 6329 7246 7475 7863 9081 9325 9342 diff --git a/longest-increasing-subsequence/output/85 b/longest-increasing-subsequence/output/85 new file mode 100644 index 0000000..f5621bc --- /dev/null +++ b/longest-increasing-subsequence/output/85 @@ -0,0 +1,2 @@ +9 +-7306 -2455 -823 489 1903 5578 6866 7404 7497 diff --git a/longest-increasing-subsequence/output/86 b/longest-increasing-subsequence/output/86 new file mode 100644 index 0000000..6c94aa2 --- /dev/null +++ b/longest-increasing-subsequence/output/86 @@ -0,0 +1,2 @@ +55 +-9528 -9108 -8891 -8824 -8700 -8242 -6843 -6840 -6235 -5738 -5564 -4870 -4358 -3746 -2948 -2646 -2389 -1896 -1878 -1253 -453 -87 120 219 738 814 1102 1110 1460 1952 2228 2388 2518 2640 3070 3358 3396 3549 3636 3711 4694 5339 5491 5810 5863 5906 5979 6268 6353 6598 6800 7088 7549 8190 8652 diff --git a/longest-increasing-subsequence/output/87 b/longest-increasing-subsequence/output/87 new file mode 100644 index 0000000..6e477c8 --- /dev/null +++ b/longest-increasing-subsequence/output/87 @@ -0,0 +1,2 @@ +38 +-8493 -7939 -6433 -6413 -6005 -5998 -5101 -5029 -4574 -3093 -1938 -1480 -1102 -1077 -646 -499 -495 -481 -295 163 417 890 1318 1376 2233 2337 2750 3184 3504 3539 4801 5520 5573 6604 6785 7115 7328 9314 diff --git a/longest-increasing-subsequence/output/88 b/longest-increasing-subsequence/output/88 new file mode 100644 index 0000000..02403b3 --- /dev/null +++ b/longest-increasing-subsequence/output/88 @@ -0,0 +1,2 @@ +16 +-8429 -7883 -7307 -5874 -5083 -4450 -3873 -2933 -1758 807 2888 3666 6398 6798 7458 8357 diff --git a/longest-increasing-subsequence/output/89 b/longest-increasing-subsequence/output/89 new file mode 100644 index 0000000..26b7033 --- /dev/null +++ b/longest-increasing-subsequence/output/89 @@ -0,0 +1,2 @@ +37 +-9823 -9663 -8693 -8671 -8435 -8239 -8167 -7394 -7384 -7155 -6914 -6177 -5331 -4957 -4754 -4108 -2871 -2615 -577 644 826 1028 1419 1872 2671 2815 4241 4329 5717 6524 6562 6831 6967 8020 8294 8602 9315 diff --git a/longest-increasing-subsequence/output/9 b/longest-increasing-subsequence/output/9 new file mode 100644 index 0000000..4247d0c --- /dev/null +++ b/longest-increasing-subsequence/output/9 @@ -0,0 +1,2 @@ +31 +-8769 -7842 -7246 -7024 -6999 -6995 -6503 -6411 -5096 -4467 -4304 -1725 -823 -765 -522 -22 466 1016 1851 2020 2782 3091 4352 4939 7101 7887 8293 8988 9084 9473 9950 diff --git a/longest-increasing-subsequence/output/90 b/longest-increasing-subsequence/output/90 new file mode 100644 index 0000000..6d354c0 --- /dev/null +++ b/longest-increasing-subsequence/output/90 @@ -0,0 +1,2 @@ +37 +-8422 -8278 -7658 -6830 -6806 -6512 -6184 -5678 -5025 -4725 -4578 -4298 -3844 -3390 -3311 -3132 -2990 -2972 -2785 -2739 -2443 -1218 -1063 43 480 890 2417 2970 3723 4196 4270 4422 4472 5209 5692 5834 7360 diff --git a/longest-increasing-subsequence/output/91 b/longest-increasing-subsequence/output/91 new file mode 100644 index 0000000..f79b272 --- /dev/null +++ b/longest-increasing-subsequence/output/91 @@ -0,0 +1,2 @@ +22 +-9167 -8560 -6611 -5531 -4691 -3085 -1418 76 944 2874 3080 3100 3159 4005 4988 6887 7017 7634 8007 8835 9221 9964 diff --git a/longest-increasing-subsequence/output/92 b/longest-increasing-subsequence/output/92 new file mode 100644 index 0000000..88f15bb --- /dev/null +++ b/longest-increasing-subsequence/output/92 @@ -0,0 +1,2 @@ +54 +-9948 -9842 -9779 -9277 -8459 -7803 -7596 -7563 -7262 -6615 -6613 -6256 -6133 -5437 -4979 -4531 -2762 -2618 -2338 -2241 -2133 -1789 -860 -71 300 695 1263 1382 1406 1653 1778 3037 3553 3578 3745 3768 4107 4253 4709 5010 5401 5744 6050 6185 6505 6523 6581 6583 7030 8174 8570 8603 9296 9574 diff --git a/longest-increasing-subsequence/output/93 b/longest-increasing-subsequence/output/93 new file mode 100644 index 0000000..6075696 --- /dev/null +++ b/longest-increasing-subsequence/output/93 @@ -0,0 +1,2 @@ +20 +-8601 -7516 -5652 -4491 -4445 -4088 -3608 -2435 -2127 -1572 -1504 -269 644 1377 2455 2836 4599 5670 7395 8015 diff --git a/longest-increasing-subsequence/output/94 b/longest-increasing-subsequence/output/94 new file mode 100644 index 0000000..4962b13 --- /dev/null +++ b/longest-increasing-subsequence/output/94 @@ -0,0 +1,2 @@ +54 +-9505 -9421 -9261 -8942 -8726 -8408 -8304 -7883 -7869 -7771 -7231 -7006 -6993 -6767 -6675 -6614 -6041 -5944 -5628 -5093 -4484 -4074 -3712 -3541 -3503 -2431 -2131 -2007 -1758 -1400 -1226 -231 251 1221 2236 3413 3784 4095 4314 4491 5094 5340 5621 5635 6006 6797 6830 7831 8805 8857 9239 9490 9562 9807 diff --git a/longest-increasing-subsequence/output/95 b/longest-increasing-subsequence/output/95 new file mode 100644 index 0000000..a656730 --- /dev/null +++ b/longest-increasing-subsequence/output/95 @@ -0,0 +1,2 @@ +6 +-7271 -7267 -5931 -3752 -2231 6031 diff --git a/longest-increasing-subsequence/output/96 b/longest-increasing-subsequence/output/96 new file mode 100644 index 0000000..ce3db44 --- /dev/null +++ b/longest-increasing-subsequence/output/96 @@ -0,0 +1,2 @@ +38 +-9655 -9220 -8906 -8325 -7586 -6917 -6290 -5763 -5545 -5128 -4578 -3788 -2877 -2712 -2470 -2418 -981 -669 -567 -334 1186 1472 1616 1632 2475 2656 2688 3047 3931 5026 5892 6005 6047 8418 8483 9045 9201 9702 diff --git a/longest-increasing-subsequence/output/97 b/longest-increasing-subsequence/output/97 new file mode 100644 index 0000000..1dcebe2 --- /dev/null +++ b/longest-increasing-subsequence/output/97 @@ -0,0 +1,2 @@ +41 +-9007 -8636 -7830 -7375 -6580 -6366 -6012 -4712 -3746 -3431 -3312 -3246 -2901 -2103 -1468 -901 -230 708 1754 1763 2142 2165 2313 2710 2832 3308 3599 3672 3720 4099 4503 4749 5093 5209 5345 5850 5907 7010 8638 8786 9108 diff --git a/longest-increasing-subsequence/output/98 b/longest-increasing-subsequence/output/98 new file mode 100644 index 0000000..dd5aa98 --- /dev/null +++ b/longest-increasing-subsequence/output/98 @@ -0,0 +1,2 @@ +43 +-9881 -8354 -8182 -7201 -7140 -5743 -5575 -5358 -4803 -3682 -2471 -1803 -1516 -1268 -985 -770 -586 -421 -91 -53 1768 1864 2233 2577 2865 3290 4008 4284 4990 5906 5950 6251 6333 6768 7020 7295 7858 8217 8365 8641 9066 9800 9805 diff --git a/longest-increasing-subsequence/output/99 b/longest-increasing-subsequence/output/99 new file mode 100644 index 0000000..17ccff0 --- /dev/null +++ b/longest-increasing-subsequence/output/99 @@ -0,0 +1,2 @@ +41 +-9991 -9909 -9058 -8948 -6265 -5863 -5736 -5564 -5151 -5002 -4788 -4742 -4193 -4051 -3909 -2722 -1724 -1509 -1417 -976 -440 -426 361 757 1188 1616 1643 2173 2245 2473 3540 3864 4000 5028 5148 5197 5658 5969 6548 7135 9657 diff --git a/longest-increasing-subsequence/problem.json b/longest-increasing-subsequence/problem.json new file mode 100644 index 0000000..f0ed1f5 --- /dev/null +++ b/longest-increasing-subsequence/problem.json @@ -0,0 +1,64 @@ +{ + "version": "1.0", + "problem": { + "title": "Maior subsequência Crescente", + "event": "", + "time_limit": 1.0, + "memory_limit_mb": 256, + "input_file": "stdin", + "output_file": "stdout", + "interactive": false, + "grader": false, + "subject": { + "en_us": [ + "dynamic-programming", "longest-increasing-subsequence" + ], + "pt_br": [ + "programação-dinâmica", "maior-subsequência-crescente" + ], + "es": [ + "" + ] + } + }, + "author": { + "name": "", + "affiliation": "", + "country": "", + "email": "" + }, + "build": { + "run_generator": true, + "run_validator": true, + "produce_outputs": true, + "run_checker": true, + "run_all_solutions": true, + "run_specific_solution": "", + "generate_io_only": false, + "generate_pdf_only": false, + "cpu_count": 1, + "build_pdf": true, + "pdf_format": "ds", + "io_samples": 3 + }, + "solutions": { + "main-ac": "ac.cpp", + "alternative-ac": [], + "wrong-answer": [], + "time-limit": [], + "time-limit-or-ac": [], + "time-limit-or-memory-limit": [], + "memory-limit": [], + "presentation-error": [], + "runtime-error": [] + }, + "polygon_config": { + "id": "" + }, + "boca_config": { + "time_limit": 1, + "number_of_repetitions": 1, + "maximum_memory_mb": 512, + "maximum_output_size_kb": 24096 + } +} \ No newline at end of file diff --git a/longest-increasing-subsequence/src/ac.cpp b/longest-increasing-subsequence/src/ac.cpp new file mode 100644 index 0000000..95fe2a1 --- /dev/null +++ b/longest-increasing-subsequence/src/ac.cpp @@ -0,0 +1,47 @@ +#include + +using namespace std; + + +int main(){ + int N; cin >> N; + vector a(N); + for (int i = 0; i < N; i++) { + cin >> a[i]; + } + + vector d(N, 1); + vector p(N, -1); + for (int i = 0; i < N; i++) { + for (int j = 0; j < i; j++) { + if (a[j] < a[i] && d[j] + 1 > d[i]) { + d[i] = d[j] + 1; + p[i] = j; + } + } + } + + int ans = d[0], pos = 0; + for (int i = 1; i < N; i++) { + if (d[i] > ans) { + ans = d[i]; + pos = i; + } + } + + vector subseq; + while (pos != -1) { + subseq.push_back(a[pos]); + pos = p[pos]; + } + reverse(subseq.begin(), subseq.end()); + + cout << ans << endl; + for (int i = 0; i < ans; i++) { + if (i != 0) cout << " "; + cout << subseq[i]; + } + cout << endl; + + return 0; +} \ No newline at end of file diff --git a/longest-increasing-subsequence/src/checker.cpp b/longest-increasing-subsequence/src/checker.cpp new file mode 100644 index 0000000..86f27d1 --- /dev/null +++ b/longest-increasing-subsequence/src/checker.cpp @@ -0,0 +1,52 @@ +#include "testlib.h" +#include + +using namespace std; + +bool isPaAnswerOk(vector &nums, vector &ans) { + for (int i = 1; i < ans.size(); i++) { + if (ans[i - 1] >= ans[i]) return false; + } + + int j = 0; + for (int i = 0, j = 0; i < nums.size() && j < ans.size(); i++) { + if (nums[i] == ans[j]) { + j++; + } + } + + return j == (int)ans.size(); +} + + +int main(int argc, char* argv[]) { + setName("Set the name of your checker here"); + registerTestlibCmd(argc, argv); + + int n = inf.readInt(); + vector nums(n); + for (int i = 0; i < n; i++) nums[i] = inf.readInt(); + + int ja = ans.readInt(); + int pa = ouf.readInt(1, 1e3); + + vector paAns; + while (!ouf.seekEof()) + paAns.push_back(ouf.readInt()); + + if (pa != paAns.size()) + quitf(_wa, "Subsequence does not match size provided"); + + if (!isPaAnswerOk(nums, paAns)) + quitf(_wa, "Subsequence does not match the constraints"); + + if (ja > pa) + quitf(_wa, "Expected (%i) found (%i)", ja, pa); + + if (ja < pa) + quitf(_fail, "Participant gave a better answer. PA - (%i), JA - (%i)", pa, ja); + + quitf(_ok, "OK"); + + return 0; +} \ No newline at end of file diff --git a/longest-increasing-subsequence/src/generator.cpp b/longest-increasing-subsequence/src/generator.cpp new file mode 100644 index 0000000..654a1cd --- /dev/null +++ b/longest-increasing-subsequence/src/generator.cpp @@ -0,0 +1,106 @@ +#include "testlib.h" +#include + +using namespace std; + +const int MIN_N = 1; +const int MAX_N = 1e3; +const int MIN_NI = -1e4; +const int MAX_NI = 1e4; + +const int rnd_test_n = 100; + +template void append(vector &dest, const vector &orig) { + dest.insert(dest.end(), orig.begin(), orig.end()); +} + +string output_tc(const vector &nums) { + ostringstream oss; + oss << nums.size() << endl; + for (int i = 0; i < nums.size(); i++) { + if (i != 0) oss << " "; + oss << nums[i]; + } + oss << endl; + return oss.str(); +} + +vector generate_sample_tests() { + vector tests; + tests.push_back(output_tc({1, 2, 3, 4, 5})); + tests.push_back(output_tc({2, 3, -1, 4})); + tests.push_back(output_tc({0})); + return tests; +} + +vector generate_manual_tests() { + vector tests; + tests.push_back(output_tc({MIN_NI, MIN_NI, MIN_NI, MIN_NI})); + tests.push_back(output_tc({0, 0, 0, 0, -1, -1, -1, -1, -1})); + return tests; +} + +string rnd_test(int i){ + int min_n = MIN_N; + int max_n = MAX_N; + + if(i nums(n); + for (int i = 0; i < n; i++) { + nums[i] = rnd.next(MIN_NI, MAX_NI); + } + return(output_tc(nums)); +} + +vector generate_random_tests() { + vector tests; + for (int i = 0; i < rnd_test_n; i++){ + tests.push_back(rnd_test(i)); + } + return tests; +} + +string extreme_test_1(){ + vector nums(MAX_N); + for (int i = 0; i < MAX_N; i++) { + nums[i] = MIN_NI; + } + return(output_tc(nums)); +} + +string extreme_test_2(){ + vector nums(MAX_N); + for (int i = 0; i < MAX_N; i++) { + nums[i] = MAX_NI; + } + return(output_tc(nums)); +} + +vector generate_extreme_tests(){ + vector tests; + tests.push_back(extreme_test_1()); + tests.push_back(extreme_test_2()); + return tests; +} + +int main(int argc, char *argv[]) { + registerGen(argc, argv, 1); + vector tests; + size_t test = 0; + append(tests, generate_sample_tests()); + append(tests, generate_manual_tests()); + append(tests, generate_random_tests()); + append(tests, generate_extreme_tests()); + for (const auto &t : tests) { + startTest(++test); + cout << t; + } + return 0; +} \ No newline at end of file diff --git a/longest-increasing-subsequence/src/script.sh b/longest-increasing-subsequence/src/script.sh new file mode 100644 index 0000000..a8a6bda --- /dev/null +++ b/longest-increasing-subsequence/src/script.sh @@ -0,0 +1 @@ +generator \ No newline at end of file diff --git a/longest-increasing-subsequence/src/testlib.h b/longest-increasing-subsequence/src/testlib.h new file mode 100644 index 0000000..fac02ad --- /dev/null +++ b/longest-increasing-subsequence/src/testlib.h @@ -0,0 +1,5963 @@ +/* + * It is strictly recommended to include "testlib.h" before any other include + * in your code. In this case testlib overrides compiler specific "random()". + * + * If you can't compile your code and compiler outputs something about + * ambiguous call of "random_shuffle", "rand" or "srand" it means that + * you shouldn't use them. Use "shuffle", and "rnd.next()" instead of them + * because these calls produce stable result for any C++ compiler. Read + * sample generator sources for clarification. + * + * Please read the documentation for class "random_t" and use "rnd" instance in + * generators. Probably, these sample calls will be usefull for you: + * rnd.next(); rnd.next(100); rnd.next(1, 2); + * rnd.next(3.14); rnd.next("[a-z]{1,100}"). + * + * Also read about wnext() to generate off-center random distribution. + * + * See https://github.com/MikeMirzayanov/testlib/ to get latest version or bug tracker. + */ + +#ifndef _TESTLIB_H_ +#define _TESTLIB_H_ + +/* + * Copyright (c) 2005-2022 + */ + +#define VERSION "0.9.40-SNAPSHOT" + +/* + * Mike Mirzayanov + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ + +/* NOTE: This file contains testlib library for C++. + * + * Check, using testlib running format: + * check.exe [ [-appes]], + * If result file is specified it will contain results. + * + * Validator, using testlib running format: + * validator.exe < input.txt, + * It will return non-zero exit code and writes message to standard output. + * + * Generator, using testlib running format: + * gen.exe [parameter-1] [parameter-2] [... paramerter-n] + * You can write generated test(s) into standard output or into the file(s). + * + * Interactor, using testlib running format: + * interactor.exe [ [ [-appes]]], + * Reads test from inf (mapped to args[1]), writes result to tout (mapped to argv[2], + * can be judged by checker later), reads program output from ouf (mapped to stdin), + * writes output to program via stdout (use cout, printf, etc). + */ + +const char *latestFeatures[] = { + "Supported '--testMarkupFileName fn' and '--testCase tc/--testCaseFileName fn' for validators", + "Added opt defaults via opt(key/index, default_val); check unused opts when using has_opt or default opt (turn off this check with suppressEnsureNoUnusedOpt()).", + "For checker added --group and --testset command line params (like for validator), use checker.group() or checker.testset() to get values", + "Added quitpi(points_info, message) function to return with _points exit code 7 and given points_info", + "rnd.partition(size, sum[, min_part=1]) returns random (unsorted) partition which is a representation of the given `sum` as a sum of `size` positive integers (or >=min_part if specified)", + "rnd.distinct(size, n) and rnd.distinct(size, from, to)", + "opt(\"some_missing_key\") returns false now", + "has_opt(key)", + "Abort validator on validator.testset()/validator.group() if registered without using command line", + "Print integer range violations in a human readable way like `violates the range [1, 10^9]`", + "Opts supported: use them like n = opt(\"n\"), in a command line you can use an exponential notation", + "Reformatted", + "Use setTestCase(i) or unsetTestCase() to support test cases (you can use it in any type of program: generator, interactor, validator or checker)", + "Fixed issue #87: readStrictDouble accepts \"-0.00\"", + "Fixed issue #83: added InStream::quitif(condition, ...)", + "Fixed issue #79: fixed missed guard against repeated header include", + "Fixed issue #80: fixed UB in case of huge quitf message", + "Fixed issue #84: added readXs(size, indexBase = 1)", + "Fixed stringstream repeated usage issue", + "Fixed compilation in g++ (for std=c++03)", + "Batch of println functions (support collections, iterator ranges)", + "Introduced rnd.perm(size, first = 0) to generate a `first`-indexed permutation", + "Allow any whitespace in readInts-like functions for non-validators", + "Ignore 4+ command line arguments ifdef EJUDGE", + "Speed up of vtos", + "Show line number in validators in case of incorrect format", + "Truncate huge checker/validator/interactor message", + "Fixed issue with readTokenTo of very long tokens, now aborts with _pe/_fail depending of a stream type", + "Introduced InStream::ensure/ensuref checking a condition, returns wa/fail depending of a stream type", + "Fixed compilation in VS 2015+", + "Introduced space-separated read functions: readWords/readTokens, multilines read functions: readStrings/readLines", + "Introduced space-separated read functions: readInts/readIntegers/readLongs/readUnsignedLongs/readDoubles/readReals/readStrictDoubles/readStrictReals", + "Introduced split/tokenize functions to separate string by given char", + "Introduced InStream::readUnsignedLong and InStream::readLong with unsigned long long paramerters", + "Supported --testOverviewLogFileName for validator: bounds hits + features", + "Fixed UB (sequence points) in random_t", + "POINTS_EXIT_CODE returned back to 7 (instead of 0)", + "Removed disable buffers for interactive problems, because it works unexpectedly in wine", + "InStream over string: constructor of InStream from base InStream to inherit policies and std::string", + "Added expectedButFound quit function, examples: expectedButFound(_wa, 10, 20), expectedButFound(_fail, ja, pa, \"[n=%d,m=%d]\", n, m)", + "Fixed incorrect interval parsing in patterns", + "Use registerGen(argc, argv, 1) to develop new generator, use registerGen(argc, argv, 0) to compile old generators (originally created for testlib under 0.8.7)", + "Introduced disableFinalizeGuard() to switch off finalization checkings", + "Use join() functions to format a range of items as a single string (separated by spaces or other separators)", + "Use -DENABLE_UNEXPECTED_EOF to enable special exit code (by default, 8) in case of unexpected eof. It is good idea to use it in interactors", + "Use -DUSE_RND_AS_BEFORE_087 to compile in compatibility mode with random behavior of versions before 0.8.7", + "Fixed bug with nan in stringToDouble", + "Fixed issue around overloads for size_t on x64", + "Added attribute 'points' to the XML output in case of result=_points", + "Exit codes can be customized via macros, e.g. -DPE_EXIT_CODE=14", + "Introduced InStream function readWordTo/readTokenTo/readStringTo/readLineTo for faster reading", + "Introduced global functions: format(), englishEnding(), upperCase(), lowerCase(), compress()", + "Manual buffer in InStreams, some IO speed improvements", + "Introduced quitif(bool, const char* pattern, ...) which delegates to quitf() in case of first argument is true", + "Introduced guard against missed quitf() in checker or readEof() in validators", + "Supported readStrictReal/readStrictDouble - to use in validators to check strictly float numbers", + "Supported registerInteraction(argc, argv)", + "Print checker message to the stderr instead of stdout", + "Supported TResult _points to output calculated score, use quitp(...) functions", + "Fixed to be compilable on Mac", + "PC_BASE_EXIT_CODE=50 in case of defined TESTSYS", + "Fixed issues 19-21, added __attribute__ format printf", + "Some bug fixes", + "ouf.readInt(1, 100) and similar calls return WA", + "Modified random_t to avoid integer overflow", + "Truncated checker output [patch by Stepan Gatilov]", + "Renamed class random -> class random_t", + "Supported name parameter for read-and-validation methods, like readInt(1, 2, \"n\")", + "Fixed bug in readDouble()", + "Improved ensuref(), fixed nextLine to work in case of EOF, added startTest()", + "Supported \"partially correct\", example: quitf(_pc(13), \"result=%d\", result)", + "Added shuffle(begin, end), use it instead of random_shuffle(begin, end)", + "Added readLine(const string& ptrn), fixed the logic of readLine() in the validation mode", + "Package extended with samples of generators and validators", + "Written the documentation for classes and public methods in testlib.h", + "Implemented random routine to support generators, use registerGen() to switch it on", + "Implemented strict mode to validate tests, use registerValidation() to switch it on", + "Now ncmp.cpp and wcmp.cpp are return WA if answer is suffix or prefix of the output", + "Added InStream::readLong() and removed InStream::readLongint()", + "Now no footer added to each report by default (use directive FOOTER to switch on)", + "Now every checker has a name, use setName(const char* format, ...) to set it", + "Now it is compatible with TTS (by Kittens Computing)", + "Added \'ensure(condition, message = \"\")\' feature, it works like assert()", + "Fixed compatibility with MS C++ 7.1", + "Added footer with exit code information", + "Added compatibility with EJUDGE (compile with EJUDGE directive)", + "Added compatibility with Contester (compile with CONTESTER directive)" +}; + +#ifdef _MSC_VER +#define _CRT_SECURE_NO_DEPRECATE +#define _CRT_SECURE_NO_WARNINGS +#define _CRT_NO_VA_START_VALIDATION +#endif + +/* Overrides random() for Borland C++. */ +#define random __random_deprecated +#include +#include +#include +#include +#undef random + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#ifdef TESTLIB_THROW_EXIT_EXCEPTION_INSTEAD_OF_EXIT +# include +#endif + +#if (_WIN32 || __WIN32__ || __WIN32 || _WIN64 || __WIN64__ || __WIN64 || WINNT || __WINNT || __WINNT__ || __CYGWIN__) +# if !defined(_MSC_VER) || _MSC_VER > 1400 +# define NOMINMAX 1 +# include +# else +# define WORD unsigned short +# include +# endif +# include +# define ON_WINDOWS +# if defined(_MSC_VER) && _MSC_VER > 1400 +# pragma warning( disable : 4127 ) +# pragma warning( disable : 4146 ) +# pragma warning( disable : 4458 ) +# endif +#else +# define WORD unsigned short +# include +#endif + +#if defined(FOR_WINDOWS) && defined(FOR_LINUX) +#error Only one target system is allowed +#endif + +#ifndef LLONG_MIN +#define LLONG_MIN (-9223372036854775807LL - 1) +#endif + +#ifndef ULLONG_MAX +#define ULLONG_MAX (18446744073709551615) +#endif + +#define LF ((char)10) +#define CR ((char)13) +#define TAB ((char)9) +#define SPACE ((char)' ') +#define EOFC (255) + +#ifndef OK_EXIT_CODE +# ifdef CONTESTER +# define OK_EXIT_CODE 0xAC +# elif defined BOCA_SUPPORT +# define OK_EXIT_CODE 4 +# else +# define OK_EXIT_CODE 0 +# endif +#endif + +#ifndef WA_EXIT_CODE +# ifdef EJUDGE +# define WA_EXIT_CODE 5 +# elif defined(CONTESTER) +# define WA_EXIT_CODE 0xAB +# elif defined BOCA_SUPPORT +# define WA_EXIT_CODE 6 +# else +# define WA_EXIT_CODE 1 +# endif +#endif + +#ifndef PE_EXIT_CODE +# ifdef EJUDGE +# define PE_EXIT_CODE 4 +# elif defined(CONTESTER) +# define PE_EXIT_CODE 0xAA +# elif defined BOCA_SUPPORT +# define PE_EXIT_CODE 6 +# else +# define PE_EXIT_CODE 2 +# endif +#endif + +#ifndef FAIL_EXIT_CODE +# ifdef EJUDGE +# define FAIL_EXIT_CODE 6 +# elif defined(CONTESTER) +# define FAIL_EXIT_CODE 0xA3 +# elif defined BOCA_SUPPORT +# define FAIL_EXIT_CODE 7 +# else +# define FAIL_EXIT_CODE 3 +# endif +#endif + +#ifndef DIRT_EXIT_CODE +# ifdef EJUDGE +# define DIRT_EXIT_CODE 6 +# else +# define DIRT_EXIT_CODE 4 +# endif +#endif + +#ifndef POINTS_EXIT_CODE +# ifndef BOCA_SUPPORT +# define POINTS_EXIT_CODE 7 +# else +# define POINTS_EXIT_CODE 5 +# endif +#endif + +#ifndef UNEXPECTED_EOF_EXIT_CODE +# define UNEXPECTED_EOF_EXIT_CODE 8 +#endif + +#ifndef PC_BASE_EXIT_CODE +# ifdef TESTSYS +# define PC_BASE_EXIT_CODE 50 +# else +# define PC_BASE_EXIT_CODE 0 +# endif +#endif + +#ifdef __GNUC__ +# define __TESTLIB_STATIC_ASSERT(condition) typedef void* __testlib_static_assert_type[(condition) ? 1 : -1] __attribute__((unused)) +#else +# define __TESTLIB_STATIC_ASSERT(condition) typedef void* __testlib_static_assert_type[(condition) ? 1 : -1] +#endif + +#ifdef ON_WINDOWS +#define I64 "%I64d" +#define U64 "%I64u" +#else +#define I64 "%lld" +#define U64 "%llu" +#endif + +#ifdef _MSC_VER +# define NORETURN __declspec(noreturn) +#elif defined __GNUC__ +# define NORETURN __attribute__ ((noreturn)) +#else +# define NORETURN +#endif + +static char __testlib_format_buffer[16777216]; +static int __testlib_format_buffer_usage_count = 0; + +#define FMT_TO_RESULT(fmt, cstr, result) std::string result; \ + if (__testlib_format_buffer_usage_count != 0) \ + __testlib_fail("FMT_TO_RESULT::__testlib_format_buffer_usage_count != 0"); \ + __testlib_format_buffer_usage_count++; \ + va_list ap; \ + va_start(ap, fmt); \ + vsnprintf(__testlib_format_buffer, sizeof(__testlib_format_buffer), cstr, ap); \ + va_end(ap); \ + __testlib_format_buffer[sizeof(__testlib_format_buffer) - 1] = 0; \ + result = std::string(__testlib_format_buffer); \ + __testlib_format_buffer_usage_count--; \ + +const long long __TESTLIB_LONGLONG_MAX = 9223372036854775807LL; +const int __TESTLIB_MAX_TEST_CASE = 1073741823; + +int __testlib_exitCode; + +bool __testlib_hasTestCase; +int __testlib_testCase = -1; + +void setTestCase(int testCase); + +void unsetTestCase() { + __testlib_hasTestCase = false; + __testlib_testCase = -1; +} + +NORETURN static void __testlib_fail(const std::string &message); + +template +static inline T __testlib_abs(const T &x) { + return x > 0 ? x : -x; +} + +template +static inline T __testlib_min(const T &a, const T &b) { + return a < b ? a : b; +} + +template +static inline T __testlib_max(const T &a, const T &b) { + return a > b ? a : b; +} + +template +static inline T __testlib_crop(T value, T a, T b) { + return __testlib_min(__testlib_max(value, a), --b); +} + +static inline double __testlib_crop(double value, double a, double b) { + value = __testlib_min(__testlib_max(value, a), b); + if (value >= b) + value = std::nexttoward(b, a); + return value; +} + +static bool __testlib_prelimIsNaN(double r) { + volatile double ra = r; +#ifndef __BORLANDC__ + return ((ra != ra) == true) && ((ra == ra) == false) && ((1.0 > ra) == false) && ((1.0 < ra) == false); +#else + return std::_isnan(ra); +#endif +} + +static std::string removeDoubleTrailingZeroes(std::string value) { + while (!value.empty() && value[value.length() - 1] == '0' && value.find('.') != std::string::npos) + value = value.substr(0, value.length() - 1); + if (!value.empty() && value[value.length() - 1] == '.') + return value + '0'; + else + return value; +} + +#ifdef __GNUC__ +__attribute__ ((format (printf, 1, 2))) +#endif +std::string format(const char *fmt, ...) { + FMT_TO_RESULT(fmt, fmt, result); + return result; +} + +std::string format(const std::string fmt, ...) { + FMT_TO_RESULT(fmt, fmt.c_str(), result); + return result; +} + +static std::string __testlib_part(const std::string &s); + +static bool __testlib_isNaN(double r) { + __TESTLIB_STATIC_ASSERT(sizeof(double) == sizeof(long long)); + volatile double ra = r; + long long llr1, llr2; + std::memcpy((void *) &llr1, (void *) &ra, sizeof(double)); + ra = -ra; + std::memcpy((void *) &llr2, (void *) &ra, sizeof(double)); + long long llnan = 0xFFF8000000000000LL; + return __testlib_prelimIsNaN(r) || llnan == llr1 || llnan == llr2; +} + +static double __testlib_nan() { + __TESTLIB_STATIC_ASSERT(sizeof(double) == sizeof(long long)); +#ifndef NAN + long long llnan = 0xFFF8000000000000LL; + double nan; + std::memcpy(&nan, &llnan, sizeof(double)); + return nan; +#else + return NAN; +#endif +} + +static bool __testlib_isInfinite(double r) { + volatile double ra = r; + return (ra > 1E300 || ra < -1E300); +} + +#ifdef __GNUC__ +__attribute__((const)) +#endif +inline bool doubleCompare(double expected, double result, double MAX_DOUBLE_ERROR) { + MAX_DOUBLE_ERROR += 1E-15; + if (__testlib_isNaN(expected)) { + return __testlib_isNaN(result); + } else if (__testlib_isInfinite(expected)) { + if (expected > 0) { + return result > 0 && __testlib_isInfinite(result); + } else { + return result < 0 && __testlib_isInfinite(result); + } + } else if (__testlib_isNaN(result) || __testlib_isInfinite(result)) { + return false; + } else if (__testlib_abs(result - expected) <= MAX_DOUBLE_ERROR) { + return true; + } else { + double minv = __testlib_min(expected * (1.0 - MAX_DOUBLE_ERROR), + expected * (1.0 + MAX_DOUBLE_ERROR)); + double maxv = __testlib_max(expected * (1.0 - MAX_DOUBLE_ERROR), + expected * (1.0 + MAX_DOUBLE_ERROR)); + return result >= minv && result <= maxv; + } +} + +#ifdef __GNUC__ +__attribute__((const)) +#endif +inline double doubleDelta(double expected, double result) { + double absolute = __testlib_abs(result - expected); + + if (__testlib_abs(expected) > 1E-9) { + double relative = __testlib_abs(absolute / expected); + return __testlib_min(absolute, relative); + } else + return absolute; +} + +/** It does nothing on non-windows and files differ from stdin/stdout/stderr. */ +static void __testlib_set_binary(std::FILE *file) { + if (NULL != file) { +#ifdef ON_WINDOWS +# ifdef _O_BINARY + if (stdin == file) +# ifdef STDIN_FILENO + return void(_setmode(STDIN_FILENO, _O_BINARY)); +# else + return void(_setmode(_fileno(stdin), _O_BINARY)); +# endif + if (stdout == file) +# ifdef STDOUT_FILENO + return void(_setmode(STDOUT_FILENO, _O_BINARY)); +# else + return void(_setmode(_fileno(stdout), _O_BINARY)); +# endif + if (stderr == file) +# ifdef STDERR_FILENO + return void(_setmode(STDERR_FILENO, _O_BINARY)); +# else + return void(_setmode(_fileno(stderr), _O_BINARY)); +# endif +# elif O_BINARY + if (stdin == file) +# ifdef STDIN_FILENO + return void(setmode(STDIN_FILENO, O_BINARY)); +# else + return void(setmode(fileno(stdin), O_BINARY)); +# endif + if (stdout == file) +# ifdef STDOUT_FILENO + return void(setmode(STDOUT_FILENO, O_BINARY)); +# else + return void(setmode(fileno(stdout), O_BINARY)); +# endif + if (stderr == file) +# ifdef STDERR_FILENO + return void(setmode(STDERR_FILENO, O_BINARY)); +# else + return void(setmode(fileno(stderr), O_BINARY)); +# endif +# endif +#endif + } +} + +#if __cplusplus > 199711L || defined(_MSC_VER) +template +static std::string vtos(const T &t, std::true_type) { + if (t == 0) + return "0"; + else { + T n(t); + bool negative = n < 0; + std::string s; + while (n != 0) { + T digit = n % 10; + if (digit < 0) + digit = -digit; + s += char('0' + digit); + n /= 10; + } + std::reverse(s.begin(), s.end()); + return negative ? "-" + s : s; + } +} + +template +static std::string vtos(const T &t, std::false_type) { + std::string s; + static std::stringstream ss; + ss.str(std::string()); + ss.clear(); + ss << t; + ss >> s; + return s; +} + +template +static std::string vtos(const T &t) { + return vtos(t, std::is_integral()); +} + +/* signed case. */ +template +static std::string toHumanReadableString(const T &n, std::false_type) { + if (n == 0) + return vtos(n); + int trailingZeroCount = 0; + T n_ = n; + while (n_ % 10 == 0) + n_ /= 10, trailingZeroCount++; + if (trailingZeroCount >= 7) { + if (n_ == 1) + return "10^" + vtos(trailingZeroCount); + else if (n_ == -1) + return "-10^" + vtos(trailingZeroCount); + else + return vtos(n_) + "*10^" + vtos(trailingZeroCount); + } else + return vtos(n); +} + +/* unsigned case. */ +template +static std::string toHumanReadableString(const T &n, std::true_type) { + if (n == 0) + return vtos(n); + int trailingZeroCount = 0; + T n_ = n; + while (n_ % 10 == 0) + n_ /= 10, trailingZeroCount++; + if (trailingZeroCount >= 7) { + if (n_ == 1) + return "10^" + vtos(trailingZeroCount); + else + return vtos(n_) + "*10^" + vtos(trailingZeroCount); + } else + return vtos(n); +} + +template +static std::string toHumanReadableString(const T &n) { + return toHumanReadableString(n, std::is_unsigned()); +} +#else +template +static std::string vtos(const T& t) +{ + std::string s; + static std::stringstream ss; + ss.str(std::string()); + ss.clear(); + ss << t; + ss >> s; + return s; +} + +template +static std::string toHumanReadableString(const T &n) { + return vtos(n); +} +#endif + +template +static std::string toString(const T &t) { + return vtos(t); +} + +#if __cplusplus > 199711L || defined(_MSC_VER) +/* opts */ +void prepareOpts(int argc, char* argv[]); +#endif + +/* + * Very simple regex-like pattern. + * It used for two purposes: validation and generation. + * + * For example, pattern("[a-z]{1,5}").next(rnd) will return + * random string from lowercase latin letters with length + * from 1 to 5. It is easier to call rnd.next("[a-z]{1,5}") + * for the same effect. + * + * Another samples: + * "mike|john" will generate (match) "mike" or "john"; + * "-?[1-9][0-9]{0,3}" will generate (match) non-zero integers from -9999 to 9999; + * "id-([ac]|b{2})" will generate (match) "id-a", "id-bb", "id-c"; + * "[^0-9]*" will match sequences (empty or non-empty) without digits, you can't + * use it for generations. + * + * You can't use pattern for generation if it contains meta-symbol '*'. Also it + * is not recommended to use it for char-sets with meta-symbol '^' like [^a-z]. + * + * For matching very simple greedy algorithm is used. For example, pattern + * "[0-9]?1" will not match "1", because of greedy nature of matching. + * Alternations (meta-symbols "|") are processed with brute-force algorithm, so + * do not use many alternations in one expression. + * + * If you want to use one expression many times it is better to compile it into + * a single pattern like "pattern p("[a-z]+")". Later you can use + * "p.matches(std::string s)" or "p.next(random_t& rd)" to check matching or generate + * new string by pattern. + * + * Simpler way to read token and check it for pattern matching is "inf.readToken("[a-z]+")". + * + * All spaces are ignored in regex, unless escaped with \. For example, ouf.readLine("NO SOLUTION") + * will expect "NOSOLUTION", the correct call should be ouf.readLine("NO\\ SOLUTION") or + * ouf.readLine(R"(NO\ SOLUTION)") if you prefer raw string literals from C++11. + */ +class random_t; + +class pattern { +public: + /* Create pattern instance by string. */ + pattern(std::string s); + + /* Generate new string by pattern and given random_t. */ + std::string next(random_t &rnd) const; + + /* Checks if given string match the pattern. */ + bool matches(const std::string &s) const; + + /* Returns source string of the pattern. */ + std::string src() const; + +private: + bool matches(const std::string &s, size_t pos) const; + + std::string s; + std::vector children; + std::vector chars; + int from; + int to; +}; + +/* + * Use random_t instances to generate random values. It is preffered + * way to use randoms instead of rand() function or self-written + * randoms. + * + * Testlib defines global variable "rnd" of random_t class. + * Use registerGen(argc, argv, 1) to setup random_t seed be command + * line (to use latest random generator version). + * + * Random generates uniformly distributed values if another strategy is + * not specified explicitly. + */ +class random_t { +private: + unsigned long long seed; + static const unsigned long long multiplier; + static const unsigned long long addend; + static const unsigned long long mask; + static const int lim; + + long long nextBits(int bits) { + if (bits <= 48) { + seed = (seed * multiplier + addend) & mask; + return (long long) (seed >> (48 - bits)); + } else { + if (bits > 63) + __testlib_fail("random_t::nextBits(int bits): n must be less than 64"); + + int lowerBitCount = (random_t::version == 0 ? 31 : 32); + + long long left = (nextBits(31) << 32); + long long right = nextBits(lowerBitCount); + + return left ^ right; + } + } + +public: + static int version; + + /* New random_t with fixed seed. */ + random_t() + : seed(3905348978240129619LL) { + } + + /* Sets seed by command line. */ + void setSeed(int argc, char *argv[]) { + random_t p; + + seed = 3905348978240129619LL; + for (int i = 1; i < argc; i++) { + std::size_t le = std::strlen(argv[i]); + for (std::size_t j = 0; j < le; j++) + seed = seed * multiplier + (unsigned int) (argv[i][j]) + addend; + seed += multiplier / addend; + } + + seed = seed & mask; + } + + /* Sets seed by given value. */ + void setSeed(long long _seed) { + _seed = (_seed ^ multiplier) & mask; + seed = _seed; + } + +#ifndef __BORLANDC__ + + /* Random string value by given pattern (see pattern documentation). */ + std::string next(const std::string &ptrn) { + pattern p(ptrn); + return p.next(*this); + } + +#else + /* Random string value by given pattern (see pattern documentation). */ + std::string next(std::string ptrn) + { + pattern p(ptrn); + return p.next(*this); + } +#endif + + /* Random value in range [0, n-1]. */ + int next(int n) { + if (n <= 0) + __testlib_fail("random_t::next(int n): n must be positive"); + + if ((n & -n) == n) // n is a power of 2 + return (int) ((n * (long long) nextBits(31)) >> 31); + + const long long limit = INT_MAX / n * n; + + long long bits; + do { + bits = nextBits(31); + } while (bits >= limit); + + return int(bits % n); + } + + /* Random value in range [0, n-1]. */ + unsigned int next(unsigned int n) { + if (n >= INT_MAX) + __testlib_fail("random_t::next(unsigned int n): n must be less INT_MAX"); + return (unsigned int) next(int(n)); + } + + /* Random value in range [0, n-1]. */ + long long next(long long n) { + if (n <= 0) + __testlib_fail("random_t::next(long long n): n must be positive"); + + const long long limit = __TESTLIB_LONGLONG_MAX / n * n; + + long long bits; + do { + bits = nextBits(63); + } while (bits >= limit); + + return bits % n; + } + + /* Random value in range [0, n-1]. */ + unsigned long long next(unsigned long long n) { + if (n >= (unsigned long long) (__TESTLIB_LONGLONG_MAX)) + __testlib_fail("random_t::next(unsigned long long n): n must be less LONGLONG_MAX"); + return (unsigned long long) next((long long) (n)); + } + + /* Random value in range [0, n-1]. */ + long next(long n) { + return (long) next((long long) (n)); + } + + /* Random value in range [0, n-1]. */ + unsigned long next(unsigned long n) { + if (n >= (unsigned long) (LONG_MAX)) + __testlib_fail("random_t::next(unsigned long n): n must be less LONG_MAX"); + return (unsigned long) next((unsigned long long) (n)); + } + + /* Returns random value in range [from,to]. */ + int next(int from, int to) { + return int(next((long long) to - from + 1) + from); + } + + /* Returns random value in range [from,to]. */ + unsigned int next(unsigned int from, unsigned int to) { + return (unsigned int) (next((long long) to - from + 1) + from); + } + + /* Returns random value in range [from,to]. */ + long long next(long long from, long long to) { + return next(to - from + 1) + from; + } + + /* Returns random value in range [from,to]. */ + unsigned long long next(unsigned long long from, unsigned long long to) { + if (from > to) + __testlib_fail("random_t::next(unsigned long long from, unsigned long long to): from can't not exceed to"); + return next(to - from + 1) + from; + } + + /* Returns random value in range [from,to]. */ + long next(long from, long to) { + return next(to - from + 1) + from; + } + + /* Returns random value in range [from,to]. */ + unsigned long next(unsigned long from, unsigned long to) { + if (from > to) + __testlib_fail("random_t::next(unsigned long from, unsigned long to): from can't not exceed to"); + return next(to - from + 1) + from; + } + + /* Random double value in range [0, 1). */ + double next() { + long long left = ((long long) (nextBits(26)) << 27); + long long right = nextBits(27); + return __testlib_crop((double) (left + right) / (double) (1LL << 53), 0.0, 1.0); + } + + /* Random double value in range [0, n). */ + double next(double n) { + if (n <= 0.0) + __testlib_fail("random_t::next(double): n should be positive"); + return __testlib_crop(n * next(), 0.0, n); + } + + /* Random double value in range [from, to). */ + double next(double from, double to) { + if (from >= to) + __testlib_fail("random_t::next(double from, double to): from should be strictly less than to"); + return next(to - from) + from; + } + + /* Returns random element from container. */ + template + typename Container::value_type any(const Container &c) { + int size = int(c.size()); + if (size <= 0) + __testlib_fail("random_t::any(const Container& c): c.size() must be positive"); + return *(c.begin() + next(size)); + } + + /* Returns random element from iterator range. */ + template + typename Iter::value_type any(const Iter &begin, const Iter &end) { + int size = int(end - begin); + if (size <= 0) + __testlib_fail("random_t::any(const Iter& begin, const Iter& end): range must have positive length"); + return *(begin + next(size)); + } + + /* Random string value by given pattern (see pattern documentation). */ +#ifdef __GNUC__ + __attribute__ ((format (printf, 2, 3))) +#endif + std::string next(const char *format, ...) { + FMT_TO_RESULT(format, format, ptrn); + return next(ptrn); + } + + /* + * Weighted next. If type == 0 than it is usual "next()". + * + * If type = 1, than it returns "max(next(), next())" + * (the number of "max" functions equals to "type"). + * + * If type < 0, than "max" function replaces with "min". + */ + int wnext(int n, int type) { + if (n <= 0) + __testlib_fail("random_t::wnext(int n, int type): n must be positive"); + + if (abs(type) < random_t::lim) { + int result = next(n); + + for (int i = 0; i < +type; i++) + result = __testlib_max(result, next(n)); + + for (int i = 0; i < -type; i++) + result = __testlib_min(result, next(n)); + + return result; + } else { + double p; + + if (type > 0) + p = std::pow(next() + 0.0, 1.0 / (type + 1)); + else + p = 1 - std::pow(next() + 0.0, 1.0 / (-type + 1)); + + return __testlib_crop((int) (double(n) * p), 0, n); + } + } + + /* See wnext(int, int). It uses the same algorithms. */ + long long wnext(long long n, int type) { + if (n <= 0) + __testlib_fail("random_t::wnext(long long n, int type): n must be positive"); + + if (abs(type) < random_t::lim) { + long long result = next(n); + + for (int i = 0; i < +type; i++) + result = __testlib_max(result, next(n)); + + for (int i = 0; i < -type; i++) + result = __testlib_min(result, next(n)); + + return result; + } else { + double p; + + if (type > 0) + p = std::pow(next() + 0.0, 1.0 / (type + 1)); + else + p = 1 - std::pow(next() + 0.0, 1.0 / (-type + 1)); + + return __testlib_crop((long long) (double(n) * p), 0LL, n); + } + } + + /* Returns value in [0, n). See wnext(int, int). It uses the same algorithms. */ + double wnext(double n, int type) { + if (n <= 0) + __testlib_fail("random_t::wnext(double n, int type): n must be positive"); + + if (abs(type) < random_t::lim) { + double result = next(); + + for (int i = 0; i < +type; i++) + result = __testlib_max(result, next()); + + for (int i = 0; i < -type; i++) + result = __testlib_min(result, next()); + + return n * result; + } else { + double p; + + if (type > 0) + p = std::pow(next() + 0.0, 1.0 / (type + 1)); + else + p = 1 - std::pow(next() + 0.0, 1.0 / (-type + 1)); + + return __testlib_crop(n * p, 0.0, n); + } + } + + /* Returns value in [0, 1). See wnext(int, int). It uses the same algorithms. */ + double wnext(int type) { + return wnext(1.0, type); + } + + /* See wnext(int, int). It uses the same algorithms. */ + unsigned int wnext(unsigned int n, int type) { + if (n >= INT_MAX) + __testlib_fail("random_t::wnext(unsigned int n, int type): n must be less INT_MAX"); + return (unsigned int) wnext(int(n), type); + } + + /* See wnext(int, int). It uses the same algorithms. */ + unsigned long long wnext(unsigned long long n, int type) { + if (n >= (unsigned long long) (__TESTLIB_LONGLONG_MAX)) + __testlib_fail("random_t::wnext(unsigned long long n, int type): n must be less LONGLONG_MAX"); + + return (unsigned long long) wnext((long long) (n), type); + } + + /* See wnext(int, int). It uses the same algorithms. */ + long wnext(long n, int type) { + return (long) wnext((long long) (n), type); + } + + /* See wnext(int, int). It uses the same algorithms. */ + unsigned long wnext(unsigned long n, int type) { + if (n >= (unsigned long) (LONG_MAX)) + __testlib_fail("random_t::wnext(unsigned long n, int type): n must be less LONG_MAX"); + + return (unsigned long) wnext((unsigned long long) (n), type); + } + + /* Returns weighted random value in range [from, to]. */ + int wnext(int from, int to, int type) { + if (from > to) + __testlib_fail("random_t::wnext(int from, int to, int type): from can't not exceed to"); + return wnext(to - from + 1, type) + from; + } + + /* Returns weighted random value in range [from, to]. */ + int wnext(unsigned int from, unsigned int to, int type) { + if (from > to) + __testlib_fail("random_t::wnext(unsigned int from, unsigned int to, int type): from can't not exceed to"); + return int(wnext(to - from + 1, type) + from); + } + + /* Returns weighted random value in range [from, to]. */ + long long wnext(long long from, long long to, int type) { + if (from > to) + __testlib_fail("random_t::wnext(long long from, long long to, int type): from can't not exceed to"); + return wnext(to - from + 1, type) + from; + } + + /* Returns weighted random value in range [from, to]. */ + unsigned long long wnext(unsigned long long from, unsigned long long to, int type) { + if (from > to) + __testlib_fail( + "random_t::wnext(unsigned long long from, unsigned long long to, int type): from can't not exceed to"); + return wnext(to - from + 1, type) + from; + } + + /* Returns weighted random value in range [from, to]. */ + long wnext(long from, long to, int type) { + if (from > to) + __testlib_fail("random_t::wnext(long from, long to, int type): from can't not exceed to"); + return wnext(to - from + 1, type) + from; + } + + /* Returns weighted random value in range [from, to]. */ + unsigned long wnext(unsigned long from, unsigned long to, int type) { + if (from > to) + __testlib_fail("random_t::wnext(unsigned long from, unsigned long to, int type): from can't not exceed to"); + return wnext(to - from + 1, type) + from; + } + + /* Returns weighted random double value in range [from, to). */ + double wnext(double from, double to, int type) { + if (from >= to) + __testlib_fail("random_t::wnext(double from, double to, int type): from should be strictly less than to"); + return wnext(to - from, type) + from; + } + + /* Returns weighted random element from container. */ + template + typename Container::value_type wany(const Container &c, int type) { + size_t size = c.size(); + if (size <= 0) + __testlib_fail("random_t::wany(const Container& c, int type): c.size() must be positive"); + return *(c.begin() + wnext(size, type)); + } + + /* Returns weighted random element from iterator range. */ + template + typename Iter::value_type wany(const Iter &begin, const Iter &end, int type) { + int size = int(end - begin); + if (size <= 0) + __testlib_fail( + "random_t::any(const Iter& begin, const Iter& end, int type): range must have positive length"); + return *(begin + wnext(size, type)); + } + + /* Returns random permutation of the given size (values are between `first` and `first`+size-1)*/ + template + std::vector perm(T size, E first) { + if (size < 0) + __testlib_fail("random_t::perm(T size, E first = 0): size must non-negative"); + else if (size == 0) + return std::vector(); + std::vector p(size); + E current = first; + for (T i = 0; i < size; i++) + p[i] = current++; + if (size > 1) + for (T i = 1; i < size; i++) + std::swap(p[i], p[next(i + 1)]); + return p; + } + + /* Returns random permutation of the given size (values are between 0 and size-1)*/ + template + std::vector perm(T size) { + return perm(size, T(0)); + } + + /* Returns `size` unordered (unsorted) distinct numbers between `from` and `to`. */ + template + std::vector distinct(int size, T from, T to) { + std::vector result; + if (size == 0) + return result; + + if (from > to) + __testlib_fail("random_t::distinct expected from <= to"); + + if (size < 0) + __testlib_fail("random_t::distinct expected size >= 0"); + + uint64_t n = to - from + 1; + if (uint64_t(size) > n) + __testlib_fail("random_t::distinct expected size <= to - from + 1"); + + double expected = 0.0; + for (int i = 1; i <= size; i++) + expected += double(n) / double(n - i + 1); + + if (expected < double(n)) { + std::set vals; + while (int(vals.size()) < size) { + T x = T(next(from, to)); + if (vals.insert(x).second) + result.push_back(x); + } + } else { + if (n > 1000000000) + __testlib_fail("random_t::distinct here expected to - from + 1 <= 1000000000"); + std::vector p(perm(int(n), from)); + result.insert(result.end(), p.begin(), p.begin() + size); + } + + return result; + } + + /* Returns `size` unordered (unsorted) distinct numbers between `0` and `upper`-1. */ + template + std::vector distinct(int size, T upper) { + if (size < 0) + __testlib_fail("random_t::distinct expected size >= 0"); + if (size == 0) + return std::vector(); + + if (upper <= 0) + __testlib_fail("random_t::distinct expected upper > 0"); + if (size > upper) + __testlib_fail("random_t::distinct expected size <= upper"); + + return distinct(size, T(0), upper - 1); + } + + /* Returns random (unsorted) partition which is a representation of sum as a sum of integers not less than min_part. */ + template + std::vector partition(int size, T sum, T min_part) { + if (size < 0) + __testlib_fail("random_t::partition: size < 0"); + if (size == 0 && sum != 0) + __testlib_fail("random_t::partition: size == 0 && sum != 0"); + if (min_part * size > sum) + __testlib_fail("random_t::partition: min_part * size > sum"); + if (size == 0 && sum == 0) + return std::vector(); + + T sum_ = sum; + sum -= min_part * size; + + std::vector septums(size); + std::vector d = distinct(size - 1, T(1), T(sum + size - 1)); + for (int i = 0; i + 1 < size; i++) + septums[i + 1] = d[i]; + sort(septums.begin(), septums.end()); + + std::vector result(size); + for (int i = 0; i + 1 < size; i++) + result[i] = septums[i + 1] - septums[i] - 1; + result[size - 1] = sum + size - 1 - septums.back(); + + for (std::size_t i = 0; i < result.size(); i++) + result[i] += min_part; + + T result_sum = 0; + for (std::size_t i = 0; i < result.size(); i++) + result_sum += result[i]; + if (result_sum != sum_) + __testlib_fail("random_t::partition: partition sum is expected to be the given sum"); + + if (*std::min_element(result.begin(), result.end()) < min_part) + __testlib_fail("random_t::partition: partition min is expected to be no less than the given min_part"); + + if (int(result.size()) != size || result.size() != (size_t) size) + __testlib_fail("random_t::partition: partition size is expected to be equal to the given size"); + + return result; + } + + /* Returns random (unsorted) partition which is a representation of sum as a sum of positive integers. */ + template + std::vector partition(int size, T sum) { + return partition(size, sum, T(1)); + } +}; + +const int random_t::lim = 25; +const unsigned long long random_t::multiplier = 0x5DEECE66DLL; +const unsigned long long random_t::addend = 0xBLL; +const unsigned long long random_t::mask = (1LL << 48) - 1; +int random_t::version = -1; + +/* Pattern implementation */ +bool pattern::matches(const std::string &s) const { + return matches(s, 0); +} + +static bool __pattern_isSlash(const std::string &s, size_t pos) { + return s[pos] == '\\'; +} + +#ifdef __GNUC__ +__attribute__((pure)) +#endif +static bool __pattern_isCommandChar(const std::string &s, size_t pos, char value) { + if (pos >= s.length()) + return false; + + int slashes = 0; + + int before = int(pos) - 1; + while (before >= 0 && s[before] == '\\') + before--, slashes++; + + return slashes % 2 == 0 && s[pos] == value; +} + +static char __pattern_getChar(const std::string &s, size_t &pos) { + if (__pattern_isSlash(s, pos)) + pos += 2; + else + pos++; + + return s[pos - 1]; +} + +#ifdef __GNUC__ +__attribute__((pure)) +#endif +static int __pattern_greedyMatch(const std::string &s, size_t pos, const std::vector chars) { + int result = 0; + + while (pos < s.length()) { + char c = s[pos++]; + if (!std::binary_search(chars.begin(), chars.end(), c)) + break; + else + result++; + } + + return result; +} + +std::string pattern::src() const { + return s; +} + +bool pattern::matches(const std::string &s, size_t pos) const { + std::string result; + + if (to > 0) { + int size = __pattern_greedyMatch(s, pos, chars); + if (size < from) + return false; + if (size > to) + size = to; + pos += size; + } + + if (children.size() > 0) { + for (size_t child = 0; child < children.size(); child++) + if (children[child].matches(s, pos)) + return true; + return false; + } else + return pos == s.length(); +} + +std::string pattern::next(random_t &rnd) const { + std::string result; + result.reserve(20); + + if (to == INT_MAX) + __testlib_fail("pattern::next(random_t& rnd): can't process character '*' for generation"); + + if (to > 0) { + int count = rnd.next(to - from + 1) + from; + for (int i = 0; i < count; i++) + result += chars[rnd.next(int(chars.size()))]; + } + + if (children.size() > 0) { + int child = rnd.next(int(children.size())); + result += children[child].next(rnd); + } + + return result; +} + +static void __pattern_scanCounts(const std::string &s, size_t &pos, int &from, int &to) { + if (pos >= s.length()) { + from = to = 1; + return; + } + + if (__pattern_isCommandChar(s, pos, '{')) { + std::vector parts; + std::string part; + + pos++; + + while (pos < s.length() && !__pattern_isCommandChar(s, pos, '}')) { + if (__pattern_isCommandChar(s, pos, ',')) + parts.push_back(part), part = "", pos++; + else + part += __pattern_getChar(s, pos); + } + + if (part != "") + parts.push_back(part); + + if (!__pattern_isCommandChar(s, pos, '}')) + __testlib_fail("pattern: Illegal pattern (or part) \"" + s + "\""); + + pos++; + + if (parts.size() < 1 || parts.size() > 2) + __testlib_fail("pattern: Illegal pattern (or part) \"" + s + "\""); + + std::vector numbers; + + for (size_t i = 0; i < parts.size(); i++) { + if (parts[i].length() == 0) + __testlib_fail("pattern: Illegal pattern (or part) \"" + s + "\""); + int number; + if (std::sscanf(parts[i].c_str(), "%d", &number) != 1) + __testlib_fail("pattern: Illegal pattern (or part) \"" + s + "\""); + numbers.push_back(number); + } + + if (numbers.size() == 1) + from = to = numbers[0]; + else + from = numbers[0], to = numbers[1]; + + if (from > to) + __testlib_fail("pattern: Illegal pattern (or part) \"" + s + "\""); + } else { + if (__pattern_isCommandChar(s, pos, '?')) { + from = 0, to = 1, pos++; + return; + } + + if (__pattern_isCommandChar(s, pos, '*')) { + from = 0, to = INT_MAX, pos++; + return; + } + + if (__pattern_isCommandChar(s, pos, '+')) { + from = 1, to = INT_MAX, pos++; + return; + } + + from = to = 1; + } +} + +static std::vector __pattern_scanCharSet(const std::string &s, size_t &pos) { + if (pos >= s.length()) + __testlib_fail("pattern: Illegal pattern (or part) \"" + s + "\""); + + std::vector result; + + if (__pattern_isCommandChar(s, pos, '[')) { + pos++; + bool negative = __pattern_isCommandChar(s, pos, '^'); + if (negative) + pos++; + + char prev = 0; + + while (pos < s.length() && !__pattern_isCommandChar(s, pos, ']')) { + if (__pattern_isCommandChar(s, pos, '-') && prev != 0) { + pos++; + + if (pos + 1 == s.length() || __pattern_isCommandChar(s, pos, ']')) { + result.push_back(prev); + prev = '-'; + continue; + } + + char next = __pattern_getChar(s, pos); + if (prev > next) + __testlib_fail("pattern: Illegal pattern (or part) \"" + s + "\""); + + for (char c = prev; c != next; c++) + result.push_back(c); + result.push_back(next); + + prev = 0; + } else { + if (prev != 0) + result.push_back(prev); + prev = __pattern_getChar(s, pos); + } + } + + if (prev != 0) + result.push_back(prev); + + if (!__pattern_isCommandChar(s, pos, ']')) + __testlib_fail("pattern: Illegal pattern (or part) \"" + s + "\""); + + pos++; + + if (negative) { + std::sort(result.begin(), result.end()); + std::vector actuals; + for (int code = 0; code < 255; code++) { + char c = char(code); + if (!std::binary_search(result.begin(), result.end(), c)) + actuals.push_back(c); + } + result = actuals; + } + + std::sort(result.begin(), result.end()); + } else + result.push_back(__pattern_getChar(s, pos)); + + return result; +} + +pattern::pattern(std::string s) : s(s), from(0), to(0) { + std::string t; + for (size_t i = 0; i < s.length(); i++) + if (!__pattern_isCommandChar(s, i, ' ')) + t += s[i]; + s = t; + + int opened = 0; + int firstClose = -1; + std::vector seps; + + for (size_t i = 0; i < s.length(); i++) { + if (__pattern_isCommandChar(s, i, '(')) { + opened++; + continue; + } + + if (__pattern_isCommandChar(s, i, ')')) { + opened--; + if (opened == 0 && firstClose == -1) + firstClose = int(i); + continue; + } + + if (opened < 0) + __testlib_fail("pattern: Illegal pattern (or part) \"" + s + "\""); + + if (__pattern_isCommandChar(s, i, '|') && opened == 0) + seps.push_back(int(i)); + } + + if (opened != 0) + __testlib_fail("pattern: Illegal pattern (or part) \"" + s + "\""); + + if (seps.size() == 0 && firstClose + 1 == (int) s.length() + && __pattern_isCommandChar(s, 0, '(') && __pattern_isCommandChar(s, s.length() - 1, ')')) { + children.push_back(pattern(s.substr(1, s.length() - 2))); + } else { + if (seps.size() > 0) { + seps.push_back(int(s.length())); + int last = 0; + + for (size_t i = 0; i < seps.size(); i++) { + children.push_back(pattern(s.substr(last, seps[i] - last))); + last = seps[i] + 1; + } + } else { + size_t pos = 0; + chars = __pattern_scanCharSet(s, pos); + __pattern_scanCounts(s, pos, from, to); + if (pos < s.length()) + children.push_back(pattern(s.substr(pos))); + } + } +} + +/* End of pattern implementation */ + +template +inline bool isEof(C c) { + return c == EOFC; +} + +template +inline bool isEoln(C c) { + return (c == LF || c == CR); +} + +template +inline bool isBlanks(C c) { + return (c == LF || c == CR || c == SPACE || c == TAB); +} + +inline std::string trim(const std::string &s) { + if (s.empty()) + return s; + + int left = 0; + while (left < int(s.length()) && isBlanks(s[left])) + left++; + if (left >= int(s.length())) + return ""; + + int right = int(s.length()) - 1; + while (right >= 0 && isBlanks(s[right])) + right--; + if (right < 0) + return ""; + + return s.substr(left, right - left + 1); +} + +enum TMode { + _input, _output, _answer +}; + +/* Outcomes 6-15 are reserved for future use. */ +enum TResult { + _ok = 0, + _wa = 1, + _pe = 2, + _fail = 3, + _dirt = 4, + _points = 5, + _unexpected_eof = 8, + _partially = 16 +}; + +enum TTestlibMode { + _unknown, _checker, _validator, _generator, _interactor, _scorer +}; + +#define _pc(exitCode) (TResult(_partially + (exitCode))) + +/* Outcomes 6-15 are reserved for future use. */ +const std::string outcomes[] = { + "accepted", + "wrong-answer", + "presentation-error", + "fail", + "fail", +#ifndef PCMS2 + "points", +#else + "relative-scoring", +#endif + "reserved", + "reserved", + "unexpected-eof", + "reserved", + "reserved", + "reserved", + "reserved", + "reserved", + "reserved", + "reserved", + "partially-correct" +}; + +class InputStreamReader { +public: + virtual void setTestCase(int testCase) = 0; + + virtual std::vector getReadChars() = 0; + + virtual int curChar() = 0; + + virtual int nextChar() = 0; + + virtual void skipChar() = 0; + + virtual void unreadChar(int c) = 0; + + virtual std::string getName() = 0; + + virtual bool eof() = 0; + + virtual void close() = 0; + + virtual int getLine() = 0; + + virtual ~InputStreamReader() = 0; +}; + +InputStreamReader::~InputStreamReader() { + // No operations. +} + +class StringInputStreamReader : public InputStreamReader { +private: + std::string s; + size_t pos; + +public: + StringInputStreamReader(const std::string &content) : s(content), pos(0) { + // No operations. + } + + void setTestCase(int) { + __testlib_fail("setTestCase not implemented in StringInputStreamReader"); + } + + std::vector getReadChars() { + __testlib_fail("getReadChars not implemented in StringInputStreamReader"); + } + + int curChar() { + if (pos >= s.length()) + return EOFC; + else + return s[pos]; + } + + int nextChar() { + if (pos >= s.length()) { + pos++; + return EOFC; + } else + return s[pos++]; + } + + void skipChar() { + pos++; + } + + void unreadChar(int c) { + if (pos == 0) + __testlib_fail("StringInputStreamReader::unreadChar(int): pos == 0."); + pos--; + if (pos < s.length()) + s[pos] = char(c); + } + + std::string getName() { + return __testlib_part(s); + } + + int getLine() { + return -1; + } + + bool eof() { + return pos >= s.length(); + } + + void close() { + // No operations. + } +}; + +class FileInputStreamReader : public InputStreamReader { +private: + std::FILE *file; + std::string name; + int line; + std::vector undoChars; + std::vector readChars; + std::vector undoReadChars; + + inline int postprocessGetc(int getcResult) { + if (getcResult != EOF) + return getcResult; + else + return EOFC; + } + + int getc(FILE *file) { + int c; + int rc; + + if (undoChars.empty()) { + c = rc = ::getc(file); + } else { + c = undoChars.back(); + undoChars.pop_back(); + rc = undoReadChars.back(); + undoReadChars.pop_back(); + } + + if (c == LF) + line++; + + readChars.push_back(rc); + return c; + } + + int ungetc(int c/*, FILE* file*/) { + if (!readChars.empty()) { + undoReadChars.push_back(readChars.back()); + readChars.pop_back(); + } + if (c == LF) + line--; + undoChars.push_back(c); + return c; + } + +public: + FileInputStreamReader(std::FILE *file, const std::string &name) : file(file), name(name), line(1) { + // No operations. + } + + void setTestCase(int testCase) { + if (testCase < 0 || testCase > __TESTLIB_MAX_TEST_CASE) + __testlib_fail(format("testCase expected fit in [1,%d], but %d doesn't", __TESTLIB_MAX_TEST_CASE, testCase)); + readChars.push_back(testCase + 256); + } + + std::vector getReadChars() { + return readChars; + } + + int curChar() { + if (feof(file)) + return EOFC; + else { + int c = getc(file); + ungetc(c/*, file*/); + return postprocessGetc(c); + } + } + + int nextChar() { + if (feof(file)) + return EOFC; + else + return postprocessGetc(getc(file)); + } + + void skipChar() { + getc(file); + } + + void unreadChar(int c) { + ungetc(c/*, file*/); + } + + std::string getName() { + return name; + } + + int getLine() { + return line; + } + + bool eof() { + if (NULL == file || feof(file)) + return true; + else { + int c = nextChar(); + if (c == EOFC || (c == EOF && feof(file))) + return true; + unreadChar(c); + return false; + } + } + + void close() { + if (NULL != file) { + fclose(file); + file = NULL; + } + } +}; + +class BufferedFileInputStreamReader : public InputStreamReader { +private: + static const size_t BUFFER_SIZE; + static const size_t MAX_UNREAD_COUNT; + + std::FILE *file; + std::string name; + int line; + + char *buffer; + bool *isEof; + int bufferPos; + size_t bufferSize; + + bool refill() { + if (NULL == file) + __testlib_fail("BufferedFileInputStreamReader: file == NULL (" + getName() + ")"); + + if (bufferPos >= int(bufferSize)) { + size_t readSize = fread( + buffer + MAX_UNREAD_COUNT, + 1, + BUFFER_SIZE - MAX_UNREAD_COUNT, + file + ); + + if (readSize < BUFFER_SIZE - MAX_UNREAD_COUNT + && ferror(file)) + __testlib_fail("BufferedFileInputStreamReader: unable to read (" + getName() + ")"); + + bufferSize = MAX_UNREAD_COUNT + readSize; + bufferPos = int(MAX_UNREAD_COUNT); + std::memset(isEof + MAX_UNREAD_COUNT, 0, sizeof(isEof[0]) * readSize); + + return readSize > 0; + } else + return true; + } + + char increment() { + char c; + if ((c = buffer[bufferPos++]) == LF) + line++; + return c; + } + +public: + BufferedFileInputStreamReader(std::FILE *file, const std::string &name) : file(file), name(name), line(1) { + buffer = new char[BUFFER_SIZE]; + isEof = new bool[BUFFER_SIZE]; + bufferSize = MAX_UNREAD_COUNT; + bufferPos = int(MAX_UNREAD_COUNT); + } + + ~BufferedFileInputStreamReader() { + if (NULL != buffer) { + delete[] buffer; + buffer = NULL; + } + if (NULL != isEof) { + delete[] isEof; + isEof = NULL; + } + } + + void setTestCase(int) { + __testlib_fail("setTestCase not implemented in BufferedFileInputStreamReader"); + } + + std::vector getReadChars() { + __testlib_fail("getReadChars not implemented in BufferedFileInputStreamReader"); + } + + int curChar() { + if (!refill()) + return EOFC; + + return isEof[bufferPos] ? EOFC : buffer[bufferPos]; + } + + int nextChar() { + if (!refill()) + return EOFC; + + return isEof[bufferPos] ? EOFC : increment(); + } + + void skipChar() { + increment(); + } + + void unreadChar(int c) { + bufferPos--; + if (bufferPos < 0) + __testlib_fail("BufferedFileInputStreamReader::unreadChar(int): bufferPos < 0"); + isEof[bufferPos] = (c == EOFC); + buffer[bufferPos] = char(c); + if (c == LF) + line--; + } + + std::string getName() { + return name; + } + + int getLine() { + return line; + } + + bool eof() { + return !refill() || EOFC == curChar(); + } + + void close() { + if (NULL != file) { + fclose(file); + file = NULL; + } + } +}; + +const size_t BufferedFileInputStreamReader::BUFFER_SIZE = 2000000; +const size_t BufferedFileInputStreamReader::MAX_UNREAD_COUNT = BufferedFileInputStreamReader::BUFFER_SIZE / 2; + +/* + * Streams to be used for reading data in checkers or validators. + * Each read*() method moves pointer to the next character after the + * read value. + */ +struct InStream { + /* Do not use them. */ + InStream(); + + ~InStream(); + + /* Wrap std::string with InStream. */ + InStream(const InStream &baseStream, std::string content); + + InputStreamReader *reader; + int lastLine; + + std::string name; + TMode mode; + bool opened; + bool stdfile; + bool strict; + + int wordReserveSize; + std::string _tmpReadToken; + + int readManyIteration; + size_t maxFileSize; + size_t maxTokenLength; + size_t maxMessageLength; + + void init(std::string fileName, TMode mode); + + void init(std::FILE *f, TMode mode); + + void setTestCase(int testCase); + std::vector getReadChars(); + + /* Moves stream pointer to the first non-white-space character or EOF. */ + void skipBlanks(); + + /* Returns current character in the stream. Doesn't remove it from stream. */ + char curChar(); + + /* Moves stream pointer one character forward. */ + void skipChar(); + + /* Returns current character and moves pointer one character forward. */ + char nextChar(); + + /* Returns current character and moves pointer one character forward. */ + char readChar(); + + /* As "readChar()" but ensures that the result is equal to given parameter. */ + char readChar(char c); + + /* As "readChar()" but ensures that the result is equal to the space (code=32). */ + char readSpace(); + + /* Puts back the character into the stream. */ + void unreadChar(char c); + + /* Reopens stream, you should not use it. */ + void reset(std::FILE *file = NULL); + + /* Checks that current position is EOF. If not it doesn't move stream pointer. */ + bool eof(); + + /* Moves pointer to the first non-white-space character and calls "eof()". */ + bool seekEof(); + + /* + * Checks that current position contains EOLN. + * If not it doesn't move stream pointer. + * In strict mode expects "#13#10" for windows or "#10" for other platforms. + */ + bool eoln(); + + /* Moves pointer to the first non-space and non-tab character and calls "eoln()". */ + bool seekEoln(); + + /* Moves stream pointer to the first character of the next line (if exists). */ + void nextLine(); + + /* + * Reads new token. Ignores white-spaces into the non-strict mode + * (strict mode is used in validators usually). + */ + std::string readWord(); + + /* The same as "readWord()", it is preffered to use "readToken()". */ + std::string readToken(); + + /* The same as "readWord()", but ensures that token matches to given pattern. */ + std::string readWord(const std::string &ptrn, const std::string &variableName = ""); + + std::string readWord(const pattern &p, const std::string &variableName = ""); + + std::vector + readWords(int size, const std::string &ptrn, const std::string &variablesName = "", int indexBase = 1); + + std::vector + readWords(int size, const pattern &p, const std::string &variablesName = "", int indexBase = 1); + + std::vector readWords(int size, int indexBase = 1); + + /* The same as "readToken()", but ensures that token matches to given pattern. */ + std::string readToken(const std::string &ptrn, const std::string &variableName = ""); + + std::string readToken(const pattern &p, const std::string &variableName = ""); + + std::vector + readTokens(int size, const std::string &ptrn, const std::string &variablesName = "", int indexBase = 1); + + std::vector + readTokens(int size, const pattern &p, const std::string &variablesName = "", int indexBase = 1); + + std::vector readTokens(int size, int indexBase = 1); + + void readWordTo(std::string &result); + + void readWordTo(std::string &result, const pattern &p, const std::string &variableName = ""); + + void readWordTo(std::string &result, const std::string &ptrn, const std::string &variableName = ""); + + void readTokenTo(std::string &result); + + void readTokenTo(std::string &result, const pattern &p, const std::string &variableName = ""); + + void readTokenTo(std::string &result, const std::string &ptrn, const std::string &variableName = ""); + + /* + * Reads new long long value. Ignores white-spaces into the non-strict mode + * (strict mode is used in validators usually). + */ + long long readLong(); + + unsigned long long readUnsignedLong(); + + /* + * Reads new int. Ignores white-spaces into the non-strict mode + * (strict mode is used in validators usually). + */ + int readInteger(); + + /* + * Reads new int. Ignores white-spaces into the non-strict mode + * (strict mode is used in validators usually). + */ + int readInt(); + + /* As "readLong()" but ensures that value in the range [minv,maxv]. */ + long long readLong(long long minv, long long maxv, const std::string &variableName = ""); + + /* Reads space-separated sequence of long longs. */ + std::vector + readLongs(int size, long long minv, long long maxv, const std::string &variablesName = "", int indexBase = 1); + + /* Reads space-separated sequence of long longs. */ + std::vector readLongs(int size, int indexBase = 1); + + unsigned long long + readUnsignedLong(unsigned long long minv, unsigned long long maxv, const std::string &variableName = ""); + + std::vector + readUnsignedLongs(int size, unsigned long long minv, unsigned long long maxv, const std::string &variablesName = "", + int indexBase = 1); + + std::vector readUnsignedLongs(int size, int indexBase = 1); + + unsigned long long readLong(unsigned long long minv, unsigned long long maxv, const std::string &variableName = ""); + + std::vector + readLongs(int size, unsigned long long minv, unsigned long long maxv, const std::string &variablesName = "", + int indexBase = 1); + + /* As "readInteger()" but ensures that value in the range [minv,maxv]. */ + int readInteger(int minv, int maxv, const std::string &variableName = ""); + + /* As "readInt()" but ensures that value in the range [minv,maxv]. */ + int readInt(int minv, int maxv, const std::string &variableName = ""); + + /* Reads space-separated sequence of integers. */ + std::vector + readIntegers(int size, int minv, int maxv, const std::string &variablesName = "", int indexBase = 1); + + /* Reads space-separated sequence of integers. */ + std::vector readIntegers(int size, int indexBase = 1); + + /* Reads space-separated sequence of integers. */ + std::vector readInts(int size, int minv, int maxv, const std::string &variablesName = "", int indexBase = 1); + + /* Reads space-separated sequence of integers. */ + std::vector readInts(int size, int indexBase = 1); + + /* + * Reads new double. Ignores white-spaces into the non-strict mode + * (strict mode is used in validators usually). + */ + double readReal(); + + /* + * Reads new double. Ignores white-spaces into the non-strict mode + * (strict mode is used in validators usually). + */ + double readDouble(); + + /* As "readReal()" but ensures that value in the range [minv,maxv]. */ + double readReal(double minv, double maxv, const std::string &variableName = ""); + + std::vector + readReals(int size, double minv, double maxv, const std::string &variablesName = "", int indexBase = 1); + + std::vector readReals(int size, int indexBase = 1); + + /* As "readDouble()" but ensures that value in the range [minv,maxv]. */ + double readDouble(double minv, double maxv, const std::string &variableName = ""); + + std::vector + readDoubles(int size, double minv, double maxv, const std::string &variablesName = "", int indexBase = 1); + + std::vector readDoubles(int size, int indexBase = 1); + + /* + * As "readReal()" but ensures that value in the range [minv,maxv] and + * number of digit after the decimal point is in range [minAfterPointDigitCount,maxAfterPointDigitCount] + * and number is in the form "[-]digit(s)[.digit(s)]". + */ + double readStrictReal(double minv, double maxv, + int minAfterPointDigitCount, int maxAfterPointDigitCount, + const std::string &variableName = ""); + + std::vector readStrictReals(int size, double minv, double maxv, + int minAfterPointDigitCount, int maxAfterPointDigitCount, + const std::string &variablesName = "", int indexBase = 1); + + /* + * As "readDouble()" but ensures that value in the range [minv,maxv] and + * number of digit after the decimal point is in range [minAfterPointDigitCount,maxAfterPointDigitCount] + * and number is in the form "[-]digit(s)[.digit(s)]". + */ + double readStrictDouble(double minv, double maxv, + int minAfterPointDigitCount, int maxAfterPointDigitCount, + const std::string &variableName = ""); + + std::vector readStrictDoubles(int size, double minv, double maxv, + int minAfterPointDigitCount, int maxAfterPointDigitCount, + const std::string &variablesName = "", int indexBase = 1); + + /* As readLine(). */ + std::string readString(); + + /* Read many lines. */ + std::vector readStrings(int size, int indexBase = 1); + + /* See readLine(). */ + void readStringTo(std::string &result); + + /* The same as "readLine()/readString()", but ensures that line matches to the given pattern. */ + std::string readString(const pattern &p, const std::string &variableName = ""); + + /* The same as "readLine()/readString()", but ensures that line matches to the given pattern. */ + std::string readString(const std::string &ptrn, const std::string &variableName = ""); + + /* Read many lines. */ + std::vector + readStrings(int size, const pattern &p, const std::string &variableName = "", int indexBase = 1); + + /* Read many lines. */ + std::vector + readStrings(int size, const std::string &ptrn, const std::string &variableName = "", int indexBase = 1); + + /* The same as "readLine()/readString()", but ensures that line matches to the given pattern. */ + void readStringTo(std::string &result, const pattern &p, const std::string &variableName = ""); + + /* The same as "readLine()/readString()", but ensures that line matches to the given pattern. */ + void readStringTo(std::string &result, const std::string &ptrn, const std::string &variableName = ""); + + /* + * Reads line from the current position to EOLN or EOF. Moves stream pointer to + * the first character of the new line (if possible). + */ + std::string readLine(); + + /* Read many lines. */ + std::vector readLines(int size, int indexBase = 1); + + /* See readLine(). */ + void readLineTo(std::string &result); + + /* The same as "readLine()", but ensures that line matches to the given pattern. */ + std::string readLine(const pattern &p, const std::string &variableName = ""); + + /* The same as "readLine()", but ensures that line matches to the given pattern. */ + std::string readLine(const std::string &ptrn, const std::string &variableName = ""); + + /* Read many lines. */ + std::vector + readLines(int size, const pattern &p, const std::string &variableName = "", int indexBase = 1); + + /* Read many lines. */ + std::vector + readLines(int size, const std::string &ptrn, const std::string &variableName = "", int indexBase = 1); + + /* The same as "readLine()", but ensures that line matches to the given pattern. */ + void readLineTo(std::string &result, const pattern &p, const std::string &variableName = ""); + + /* The same as "readLine()", but ensures that line matches to the given pattern. */ + void readLineTo(std::string &result, const std::string &ptrn, const std::string &variableName = ""); + + /* Reads EOLN or fails. Use it in validators. Calls "eoln()" method internally. */ + void readEoln(); + + /* Reads EOF or fails. Use it in validators. Calls "eof()" method internally. */ + void readEof(); + + /* + * Quit-functions aborts program with and : + * input/answer streams replace any result to FAIL. + */ + NORETURN void quit(TResult result, const char *msg); + /* + * Quit-functions aborts program with and : + * input/answer streams replace any result to FAIL. + */ + NORETURN void quitf(TResult result, const char *msg, ...); + + /* + * Quit-functions aborts program with and : + * input/answer streams replace any result to FAIL. + */ + void quitif(bool condition, TResult result, const char *msg, ...); + /* + * Quit-functions aborts program with and : + * input/answer streams replace any result to FAIL. + */ + NORETURN void quits(TResult result, std::string msg); + + /* + * Checks condition and aborts a program if codition is false. + * Returns _wa for ouf and _fail on any other streams. + */ +#ifdef __GNUC__ + __attribute__ ((format (printf, 3, 4))) +#endif + void ensuref(bool cond, const char *format, ...); + + void __testlib_ensure(bool cond, std::string message); + + void close(); + + const static int NO_INDEX = INT_MAX; + const static char OPEN_BRACKET = char(11); + const static char CLOSE_BRACKET = char(17); + + const static WORD LightGray = 0x07; + const static WORD LightRed = 0x0c; + const static WORD LightCyan = 0x0b; + const static WORD LightGreen = 0x0a; + const static WORD LightYellow = 0x0e; + + static void textColor(WORD color); + + static void quitscr(WORD color, const char *msg); + + static void quitscrS(WORD color, std::string msg); + + void xmlSafeWrite(std::FILE *file, const char *msg); + + /* Skips UTF-8 Byte Order Mark. */ + void skipBom(); + +private: + InStream(const InStream &); + + InStream &operator=(const InStream &); +}; + +InStream inf; +InStream ouf; +InStream ans; +bool appesMode; +std::string resultName; +std::string checkerName = "untitled checker"; +random_t rnd; +TTestlibMode testlibMode = _unknown; +double __testlib_points = std::numeric_limits::infinity(); + +struct ValidatorBoundsHit { + static const double EPS; + bool minHit; + bool maxHit; + + ValidatorBoundsHit(bool minHit = false, bool maxHit = false) : minHit(minHit), maxHit(maxHit) { + }; + + ValidatorBoundsHit merge(const ValidatorBoundsHit &validatorBoundsHit) { + return ValidatorBoundsHit( + __testlib_max(minHit, validatorBoundsHit.minHit), + __testlib_max(maxHit, validatorBoundsHit.maxHit) + ); + } +}; + +const double ValidatorBoundsHit::EPS = 1E-12; + +class Validator { +private: + const static std::string TEST_MARKUP_HEADER; + const static std::string TEST_CASE_OPEN_TAG; + const static std::string TEST_CASE_CLOSE_TAG; + + bool _initialized; + std::string _testset; + std::string _group; + + std::string _testOverviewLogFileName; + std::string _testMarkupFileName; + int _testCase = -1; + std::string _testCaseFileName; + + std::map _boundsHitByVariableName; + std::set _features; + std::set _hitFeatures; + + bool isVariableNameBoundsAnalyzable(const std::string &variableName) { + for (size_t i = 0; i < variableName.length(); i++) + if ((variableName[i] >= '0' && variableName[i] <= '9') || variableName[i] < ' ') + return false; + return true; + } + + bool isFeatureNameAnalyzable(const std::string &featureName) { + for (size_t i = 0; i < featureName.length(); i++) + if (featureName[i] < ' ') + return false; + return true; + } + +public: + Validator() : _initialized(false), _testset("tests"), _group() { + } + + void initialize() { + _initialized = true; + } + + std::string testset() const { + if (!_initialized) + __testlib_fail("Validator should be initialized with registerValidation(argc, argv) instead of registerValidation() to support validator.testset()"); + return _testset; + } + + std::string group() const { + if (!_initialized) + __testlib_fail("Validator should be initialized with registerValidation(argc, argv) instead of registerValidation() to support validator.group()"); + return _group; + } + + std::string testOverviewLogFileName() const { + return _testOverviewLogFileName; + } + + std::string testMarkupFileName() const { + return _testMarkupFileName; + } + + int testCase() const { + return _testCase; + } + + std::string testCaseFileName() const { + return _testCaseFileName; + } + + void setTestset(const char *const testset) { + _testset = testset; + } + + void setGroup(const char *const group) { + _group = group; + } + + void setTestOverviewLogFileName(const char *const testOverviewLogFileName) { + _testOverviewLogFileName = testOverviewLogFileName; + } + + void setTestMarkupFileName(const char *const testMarkupFileName) { + _testMarkupFileName = testMarkupFileName; + } + + void setTestCase(int testCase) { + _testCase = testCase; + } + + void setTestCaseFileName(const char *const testCaseFileName) { + _testCaseFileName = testCaseFileName; + } + + void addBoundsHit(const std::string &variableName, ValidatorBoundsHit boundsHit) { + if (isVariableNameBoundsAnalyzable(variableName)) { + _boundsHitByVariableName[variableName] + = boundsHit.merge(_boundsHitByVariableName[variableName]); + } + } + + std::string getBoundsHitLog() { + std::string result; + for (std::map::iterator i = _boundsHitByVariableName.begin(); + i != _boundsHitByVariableName.end(); + i++) { + result += "\"" + i->first + "\":"; + if (i->second.minHit) + result += " min-value-hit"; + if (i->second.maxHit) + result += " max-value-hit"; + result += "\n"; + } + return result; + } + + std::string getFeaturesLog() { + std::string result; + for (std::set::iterator i = _features.begin(); + i != _features.end(); + i++) { + result += "feature \"" + *i + "\":"; + if (_hitFeatures.count(*i)) + result += " hit"; + result += "\n"; + } + return result; + } + + void writeTestOverviewLog() { + if (!_testOverviewLogFileName.empty()) { + std::string fileName(_testOverviewLogFileName); + _testOverviewLogFileName = ""; + FILE *testOverviewLogFile = fopen(fileName.c_str(), "w"); + if (NULL == testOverviewLogFile) + __testlib_fail("Validator::writeTestOverviewLog: can't write test overview log to (" + fileName + ")"); + fprintf(testOverviewLogFile, "%s%s", getBoundsHitLog().c_str(), getFeaturesLog().c_str()); + if (fclose(testOverviewLogFile)) + __testlib_fail( + "Validator::writeTestOverviewLog: can't close test overview log file (" + fileName + ")"); + } + } + + void writeTestMarkup() { + if (!_testMarkupFileName.empty()) { + std::vector readChars = inf.getReadChars(); + if (!readChars.empty()) { + std::string markup(TEST_MARKUP_HEADER); + for (size_t i = 0; i < readChars.size(); i++) { + int c = readChars[i]; + if (i + 1 == readChars.size() && c == -1) + continue; + if (c <= 256) { + char cc = char(c); + if (cc == '\\' || cc == '!') + markup += '\\'; + markup += cc; + } else { + markup += TEST_CASE_OPEN_TAG; + markup += toString(c - 256); + markup += TEST_CASE_CLOSE_TAG; + } + } + FILE* f; + bool standard_file = false; + if (_testMarkupFileName == "stdout") + f = stdout, standard_file = true; + else if (_testMarkupFileName == "stderr") + f = stderr, standard_file = true; + else { + f = fopen(_testMarkupFileName.c_str(), "wb"); + if (NULL == f) + __testlib_fail("Validator::writeTestMarkup: can't write test markup to (" + _testMarkupFileName + ")"); + } + std::fprintf(f, "%s", markup.c_str()); + std::fflush(f); + if (!standard_file) + if (std::fclose(f)) + __testlib_fail("Validator::writeTestMarkup: can't close test markup file (" + _testCaseFileName + ")"); + } + } + } + + void writeTestCase() { + if (_testCase > 0) { + std::vector readChars = inf.getReadChars(); + if (!readChars.empty()) { + std::string content, testCaseContent; + bool matchedTestCase = false; + for (size_t i = 0; i < readChars.size(); i++) { + int c = readChars[i]; + if (i + 1 == readChars.size() && c == -1) + continue; + if (c <= 256) + content += char(c); + else { + if (matchedTestCase) { + testCaseContent = content; + matchedTestCase = false; + } + content = ""; + int testCase = c - 256; + if (testCase == _testCase) + matchedTestCase = true; + } + } + if (matchedTestCase) + testCaseContent = content; + + if (!testCaseContent.empty()) { + FILE* f; + bool standard_file = false; + if (_testCaseFileName.empty() || _testCaseFileName == "stdout") + f = stdout, standard_file = true; + else if (_testCaseFileName == "stderr") + f = stderr, standard_file = true; + else { + f = fopen(_testCaseFileName.c_str(), "wb"); + if (NULL == f) + __testlib_fail("Validator::writeTestCase: can't write test case to (" + _testCaseFileName + ")"); + } + std::fprintf(f, "%s", testCaseContent.c_str()); + std::fflush(f); + if (!standard_file) + if (std::fclose(f)) + __testlib_fail("Validator::writeTestCase: can't close test case file (" + _testCaseFileName + ")"); + } + } + } + } + + void addFeature(const std::string &feature) { + if (_features.count(feature)) + __testlib_fail("Feature " + feature + " registered twice."); + if (!isFeatureNameAnalyzable(feature)) + __testlib_fail("Feature name '" + feature + "' contains restricted characters."); + + _features.insert(feature); + } + + void feature(const std::string &feature) { + if (!isFeatureNameAnalyzable(feature)) + __testlib_fail("Feature name '" + feature + "' contains restricted characters."); + + if (!_features.count(feature)) + __testlib_fail("Feature " + feature + " didn't registered via addFeature(feature)."); + + _hitFeatures.insert(feature); + } +} validator; + +const std::string Validator::TEST_MARKUP_HEADER = "MU\xF3\x01"; +const std::string Validator::TEST_CASE_OPEN_TAG = "!c"; +const std::string Validator::TEST_CASE_CLOSE_TAG = ";"; + +struct TestlibFinalizeGuard { + static bool alive; + static bool registered; + + int quitCount, readEofCount; + + TestlibFinalizeGuard() : quitCount(0), readEofCount(0) { + // No operations. + } + + ~TestlibFinalizeGuard() { + bool _alive = alive; + alive = false; + + if (_alive) { + if (testlibMode == _checker && quitCount == 0) + __testlib_fail("Checker must end with quit or quitf call."); + + if (testlibMode == _validator && readEofCount == 0 && quitCount == 0) + __testlib_fail("Validator must end with readEof call."); + + /* opts */ + autoEnsureNoUnusedOpts(); + + if (!registered) + __testlib_fail("Call register-function in the first line of the main (registerTestlibCmd or other similar)"); + } + + if (__testlib_exitCode == 0) { + validator.writeTestOverviewLog(); + validator.writeTestMarkup(); + validator.writeTestCase(); + } + } + +private: + /* opts */ + void autoEnsureNoUnusedOpts(); +}; + +bool TestlibFinalizeGuard::alive = true; +bool TestlibFinalizeGuard::registered = false; +extern TestlibFinalizeGuard testlibFinalizeGuard; + +/* + * Call it to disable checks on finalization. + */ +void disableFinalizeGuard() { + TestlibFinalizeGuard::alive = false; +} + +/* Interactor streams. + */ +std::fstream tout; + +/* implementation + */ + +InStream::InStream() { + reader = NULL; + lastLine = -1; + opened = false; + name = ""; + mode = _input; + strict = false; + stdfile = false; + wordReserveSize = 4; + readManyIteration = NO_INDEX; + maxFileSize = 128 * 1024 * 1024; // 128MB. + maxTokenLength = 32 * 1024 * 1024; // 32MB. + maxMessageLength = 32000; +} + +InStream::InStream(const InStream &baseStream, std::string content) { + reader = new StringInputStreamReader(content); + lastLine = -1; + opened = true; + strict = baseStream.strict; + stdfile = false; + mode = baseStream.mode; + name = "based on " + baseStream.name; + readManyIteration = NO_INDEX; + maxFileSize = 128 * 1024 * 1024; // 128MB. + maxTokenLength = 32 * 1024 * 1024; // 32MB. + maxMessageLength = 32000; +} + +InStream::~InStream() { + if (NULL != reader) { + reader->close(); + delete reader; + reader = NULL; + } +} + +void InStream::setTestCase(int testCase) { + if (testlibMode != _validator || mode != _input || !stdfile || this != &inf) + __testlib_fail("InStream::setTestCase can be used only for inf in validator-mode." + " Actually, prefer setTestCase function instead of InStream member"); + reader->setTestCase(testCase); +} + +std::vector InStream::getReadChars() { + if (testlibMode != _validator || mode != _input || !stdfile || this != &inf) + __testlib_fail("InStream::getReadChars can be used only for inf in validator-mode."); + return reader == NULL ? std::vector() : reader->getReadChars(); +} + +void setTestCase(int testCase) { + static bool first_run = true; + static bool zero_based = false; + + if (first_run && testCase == 0) + zero_based = true; + + if (zero_based) + testCase++; + + __testlib_hasTestCase = true; + __testlib_testCase = testCase; + + if (testlibMode == _validator) + inf.setTestCase(testCase); + + first_run = false; +} + +#ifdef __GNUC__ +__attribute__((const)) +#endif +int resultExitCode(TResult r) { + if (r == _ok) + return OK_EXIT_CODE; + if (r == _wa) + return WA_EXIT_CODE; + if (r == _pe) + return PE_EXIT_CODE; + if (r == _fail) + return FAIL_EXIT_CODE; + if (r == _dirt) + return DIRT_EXIT_CODE; + if (r == _points) + return POINTS_EXIT_CODE; + if (r == _unexpected_eof) +#ifdef ENABLE_UNEXPECTED_EOF + return UNEXPECTED_EOF_EXIT_CODE; +#else + return PE_EXIT_CODE; +#endif + if (r >= _partially) + return PC_BASE_EXIT_CODE + (r - _partially); + return FAIL_EXIT_CODE; +} + +void InStream::textColor( +#if !(defined(ON_WINDOWS) && (!defined(_MSC_VER) || _MSC_VER > 1400)) && defined(__GNUC__) + __attribute__((unused)) +#endif + WORD color +) { +#if defined(ON_WINDOWS) && (!defined(_MSC_VER) || _MSC_VER > 1400) + HANDLE handle = GetStdHandle(STD_OUTPUT_HANDLE); + SetConsoleTextAttribute(handle, color); +#endif +#if !defined(ON_WINDOWS) && defined(__GNUC__) + if (isatty(2)) + { + switch (color) + { + case LightRed: + fprintf(stderr, "\033[1;31m"); + break; + case LightCyan: + fprintf(stderr, "\033[1;36m"); + break; + case LightGreen: + fprintf(stderr, "\033[1;32m"); + break; + case LightYellow: + fprintf(stderr, "\033[1;33m"); + break; + case LightGray: + default: + fprintf(stderr, "\033[0m"); + } + } +#endif +} + +#ifdef TESTLIB_THROW_EXIT_EXCEPTION_INSTEAD_OF_EXIT +class exit_exception: public std::exception { +private: + int exitCode; +public: + exit_exception(int exitCode): exitCode(exitCode) {} + int getExitCode() { return exitCode; } +}; +#endif + +NORETURN void halt(int exitCode) { +#ifdef FOOTER + InStream::textColor(InStream::LightGray); + std::fprintf(stderr, "Checker: \"%s\"\n", checkerName.c_str()); + std::fprintf(stderr, "Exit code: %d\n", exitCode); + InStream::textColor(InStream::LightGray); +#endif + __testlib_exitCode = exitCode; +#ifdef TESTLIB_THROW_EXIT_EXCEPTION_INSTEAD_OF_EXIT + throw exit_exception(exitCode); +#endif + std::exit(exitCode); +} + +static bool __testlib_shouldCheckDirt(TResult result) { + return result == _ok || result == _points || result >= _partially; +} + +static std::string __testlib_appendMessage(const std::string &message, const std::string &extra) { + int openPos = -1, closePos = -1; + for (size_t i = 0; i < message.length(); i++) { + if (message[i] == InStream::OPEN_BRACKET) { + if (openPos == -1) + openPos = int(i); + else + openPos = INT_MAX; + } + if (message[i] == InStream::CLOSE_BRACKET) { + if (closePos == -1) + closePos = int(i); + else + closePos = INT_MAX; + } + } + if (openPos != -1 && openPos != INT_MAX + && closePos != -1 && closePos != INT_MAX + && openPos < closePos) { + size_t index = message.find(extra, openPos); + if (index == std::string::npos || int(index) >= closePos) { + std::string result(message); + result.insert(closePos, ", " + extra); + return result; + } + return message; + } + + return message + " " + InStream::OPEN_BRACKET + extra + InStream::CLOSE_BRACKET; +} + +static std::string __testlib_toPrintableMessage(const std::string &message) { + int openPos = -1, closePos = -1; + for (size_t i = 0; i < message.length(); i++) { + if (message[i] == InStream::OPEN_BRACKET) { + if (openPos == -1) + openPos = int(i); + else + openPos = INT_MAX; + } + if (message[i] == InStream::CLOSE_BRACKET) { + if (closePos == -1) + closePos = int(i); + else + closePos = INT_MAX; + } + } + if (openPos != -1 && openPos != INT_MAX + && closePos != -1 && closePos != INT_MAX + && openPos < closePos) { + std::string result(message); + result[openPos] = '('; + result[closePos] = ')'; + return result; + } + + return message; +} + +NORETURN void InStream::quit(TResult result, const char *msg) { + if (TestlibFinalizeGuard::alive) + testlibFinalizeGuard.quitCount++; + + std::string message(msg); + message = trim(message); + + if (__testlib_hasTestCase) { + if (result != _ok) + message = __testlib_appendMessage(message, "test case " + vtos(__testlib_testCase)); + else { + if (__testlib_testCase == 1) + message = __testlib_appendMessage(message, vtos(__testlib_testCase) + " test case"); + else + message = __testlib_appendMessage(message, vtos(__testlib_testCase) + " test cases"); + } + } + + // You can change maxMessageLength. + // Example: 'inf.maxMessageLength = 1024 * 1024;'. + if (message.length() > maxMessageLength) { + std::string warn = "message length exceeds " + vtos(maxMessageLength) + + ", the message is truncated: "; + message = warn + message.substr(0, maxMessageLength - warn.length()); + } + +#ifndef ENABLE_UNEXPECTED_EOF + if (result == _unexpected_eof) + result = _pe; +#endif + + if (testlibMode == _scorer && result != _fail) + quits(_fail, "Scorer should return points only. Don't use a quit function."); + + if (mode != _output && result != _fail) { + if (mode == _input && testlibMode == _validator && lastLine != -1) + quits(_fail, __testlib_appendMessage(__testlib_appendMessage(message, name), "line " + vtos(lastLine))); + else + quits(_fail, __testlib_appendMessage(message, name)); + } + + std::FILE *resultFile; + std::string errorName; + + if (__testlib_shouldCheckDirt(result)) { + if (testlibMode != _interactor && !ouf.seekEof()) + quit(_dirt, "Extra information in the output file"); + } + + int pctype = result - _partially; + bool isPartial = false; + + switch (result) { + case _ok: + errorName = "ok "; + quitscrS(LightGreen, errorName); + break; + case _wa: + errorName = "wrong answer "; + quitscrS(LightRed, errorName); + break; + case _pe: + errorName = "wrong output format "; + quitscrS(LightRed, errorName); + break; + case _fail: + errorName = "FAIL "; + quitscrS(LightRed, errorName); + break; + case _dirt: + errorName = "wrong output format "; + quitscrS(LightCyan, errorName); + result = _pe; + break; + case _points: + errorName = "points "; + quitscrS(LightYellow, errorName); + break; + case _unexpected_eof: + errorName = "unexpected eof "; + quitscrS(LightCyan, errorName); + break; + default: + if (result >= _partially) { + errorName = format("partially correct (%d) ", pctype); + isPartial = true; + quitscrS(LightYellow, errorName); + } else + quit(_fail, "What is the code ??? "); + } + + if (resultName != "") { + resultFile = std::fopen(resultName.c_str(), "w"); + if (resultFile == NULL) { + resultName = ""; + quit(_fail, "Can not write to the result file"); + } + if (appesMode) { + std::fprintf(resultFile, ""); + if (isPartial) + std::fprintf(resultFile, "", + outcomes[(int) _partially].c_str(), pctype); + else { + if (result != _points) + std::fprintf(resultFile, "", outcomes[(int) result].c_str()); + else { + if (__testlib_points == std::numeric_limits::infinity()) + quit(_fail, "Expected points, but infinity found"); + std::string stringPoints = removeDoubleTrailingZeroes(format("%.10f", __testlib_points)); + std::fprintf(resultFile, "", + outcomes[(int) result].c_str(), stringPoints.c_str()); + } + } + xmlSafeWrite(resultFile, __testlib_toPrintableMessage(message).c_str()); + std::fprintf(resultFile, "\n"); + } else + std::fprintf(resultFile, "%s", __testlib_toPrintableMessage(message).c_str()); + if (NULL == resultFile || fclose(resultFile) != 0) { + resultName = ""; + quit(_fail, "Can not write to the result file"); + } + } + + quitscr(LightGray, __testlib_toPrintableMessage(message).c_str()); + std::fprintf(stderr, "\n"); + + inf.close(); + ouf.close(); + ans.close(); + if (tout.is_open()) + tout.close(); + + textColor(LightGray); + + if (resultName != "") + std::fprintf(stderr, "See file to check exit message\n"); + + halt(resultExitCode(result)); +} + +#ifdef __GNUC__ +__attribute__ ((format (printf, 3, 4))) +#endif +NORETURN void InStream::quitf(TResult result, const char *msg, ...) { + FMT_TO_RESULT(msg, msg, message); + InStream::quit(result, message.c_str()); +} + +#ifdef __GNUC__ +__attribute__ ((format (printf, 4, 5))) +#endif +void InStream::quitif(bool condition, TResult result, const char *msg, ...) { + if (condition) { + FMT_TO_RESULT(msg, msg, message); + InStream::quit(result, message.c_str()); + } +} + +NORETURN void InStream::quits(TResult result, std::string msg) { + InStream::quit(result, msg.c_str()); +} + +void InStream::xmlSafeWrite(std::FILE *file, const char *msg) { + size_t lmsg = strlen(msg); + for (size_t i = 0; i < lmsg; i++) { + if (msg[i] == '&') { + std::fprintf(file, "%s", "&"); + continue; + } + if (msg[i] == '<') { + std::fprintf(file, "%s", "<"); + continue; + } + if (msg[i] == '>') { + std::fprintf(file, "%s", ">"); + continue; + } + if (msg[i] == '"') { + std::fprintf(file, "%s", """); + continue; + } + if (0 <= msg[i] && msg[i] <= 31) { + std::fprintf(file, "%c", '.'); + continue; + } + std::fprintf(file, "%c", msg[i]); + } +} + +void InStream::quitscrS(WORD color, std::string msg) { + quitscr(color, msg.c_str()); +} + +void InStream::quitscr(WORD color, const char *msg) { + if (resultName == "") { + textColor(color); + std::fprintf(stderr, "%s", msg); + textColor(LightGray); + } +} + +void InStream::reset(std::FILE *file) { + if (opened && stdfile) + quit(_fail, "Can't reset standard handle"); + + if (opened) + close(); + + if (!stdfile && NULL == file) + if (NULL == (file = std::fopen(name.c_str(), "rb"))) { + if (mode == _output) + quits(_pe, std::string("Output file not found: \"") + name + "\""); + + if (mode == _answer) + quits(_fail, std::string("Answer file not found: \"") + name + "\""); + } + + if (NULL != file) { + opened = true; + __testlib_set_binary(file); + + if (stdfile) + reader = new FileInputStreamReader(file, name); + else + reader = new BufferedFileInputStreamReader(file, name); + } else { + opened = false; + reader = NULL; + } +} + +void InStream::init(std::string fileName, TMode mode) { + opened = false; + name = fileName; + stdfile = false; + this->mode = mode; + + std::ifstream stream; + stream.open(fileName.c_str(), std::ios::in); + if (stream.is_open()) { + std::streampos start = stream.tellg(); + stream.seekg(0, std::ios::end); + std::streampos end = stream.tellg(); + size_t fileSize = size_t(end - start); + stream.close(); + + // You can change maxFileSize. + // Example: 'inf.maxFileSize = 256 * 1024 * 1024;'. + if (fileSize > maxFileSize) + quitf(_pe, "File size exceeds %d bytes, size is %d", int(maxFileSize), int(fileSize)); + } + + reset(); + skipBom(); +} + +void InStream::init(std::FILE *f, TMode mode) { + opened = false; + name = "untitled"; + this->mode = mode; + + if (f == stdin) + name = "stdin", stdfile = true; + if (f == stdout) + name = "stdout", stdfile = true; + if (f == stderr) + name = "stderr", stdfile = true; + + reset(f); + skipBom(); +} + +void InStream::skipBom() { + const std::string utf8Bom = "\xEF\xBB\xBF"; + size_t index = 0; + while (index < utf8Bom.size() && curChar() == utf8Bom[index]) { + index++; + skipChar(); + } + if (index < utf8Bom.size()) { + while (index != 0) { + unreadChar(utf8Bom[index - 1]); + index--; + } + } +} + +char InStream::curChar() { + return char(reader->curChar()); +} + +char InStream::nextChar() { + return char(reader->nextChar()); +} + +char InStream::readChar() { + return nextChar(); +} + +char InStream::readChar(char c) { + lastLine = reader->getLine(); + char found = readChar(); + if (c != found) { + if (!isEoln(found)) + quit(_pe, ("Unexpected character '" + std::string(1, found) + "', but '" + std::string(1, c) + + "' expected").c_str()); + else + quit(_pe, ("Unexpected character " + ("#" + vtos(int(found))) + ", but '" + std::string(1, c) + + "' expected").c_str()); + } + return found; +} + +char InStream::readSpace() { + return readChar(' '); +} + +void InStream::unreadChar(char c) { + reader->unreadChar(c); +} + +void InStream::skipChar() { + reader->skipChar(); +} + +void InStream::skipBlanks() { + while (isBlanks(reader->curChar())) + reader->skipChar(); +} + +std::string InStream::readWord() { + readWordTo(_tmpReadToken); + return _tmpReadToken; +} + +void InStream::readWordTo(std::string &result) { + if (!strict) + skipBlanks(); + + lastLine = reader->getLine(); + int cur = reader->nextChar(); + + if (cur == EOFC) + quit(_unexpected_eof, "Unexpected end of file - token expected"); + + if (isBlanks(cur)) + quit(_pe, "Unexpected white-space - token expected"); + + result.clear(); + + while (!(isBlanks(cur) || cur == EOFC)) { + result += char(cur); + + // You can change maxTokenLength. + // Example: 'inf.maxTokenLength = 128 * 1024 * 1024;'. + if (result.length() > maxTokenLength) + quitf(_pe, "Length of token exceeds %d, token is '%s...'", int(maxTokenLength), + __testlib_part(result).c_str()); + + cur = reader->nextChar(); + } + + reader->unreadChar(cur); + + if (result.length() == 0) + quit(_unexpected_eof, "Unexpected end of file or white-space - token expected"); +} + +std::string InStream::readToken() { + return readWord(); +} + +void InStream::readTokenTo(std::string &result) { + readWordTo(result); +} + +static std::string __testlib_part(const std::string &s) { + std::string t; + for (size_t i = 0; i < s.length(); i++) + if (s[i] != '\0') + t += s[i]; + else + t += '~'; + if (t.length() <= 64) + return t; + else + return t.substr(0, 30) + "..." + t.substr(s.length() - 31, 31); +} + +#define __testlib_readMany(readMany, readOne, typeName, space) \ + if (size < 0) \ + quit(_fail, #readMany ": size should be non-negative."); \ + if (size > 100000000) \ + quit(_fail, #readMany ": size should be at most 100000000."); \ + \ + std::vector result(size); \ + readManyIteration = indexBase; \ + \ + for (int i = 0; i < size; i++) \ + { \ + result[i] = readOne; \ + readManyIteration++; \ + if (strict && space && i + 1 < size) \ + readSpace(); \ + } \ + \ + readManyIteration = NO_INDEX; \ + return result; \ + + +std::string InStream::readWord(const pattern &p, const std::string &variableName) { + readWordTo(_tmpReadToken); + if (!p.matches(_tmpReadToken)) { + if (readManyIteration == NO_INDEX) { + if (variableName.empty()) + quit(_wa, + ("Token \"" + __testlib_part(_tmpReadToken) + "\" doesn't correspond to pattern \"" + p.src() + + "\"").c_str()); + else + quit(_wa, ("Token parameter [name=" + variableName + "] equals to \"" + __testlib_part(_tmpReadToken) + + "\", doesn't correspond to pattern \"" + p.src() + "\"").c_str()); + } else { + if (variableName.empty()) + quit(_wa, ("Token element [index=" + vtos(readManyIteration) + "] equals to \"" + + __testlib_part(_tmpReadToken) + "\" doesn't correspond to pattern \"" + p.src() + + "\"").c_str()); + else + quit(_wa, ("Token element " + variableName + "[" + vtos(readManyIteration) + "] equals to \"" + + __testlib_part(_tmpReadToken) + "\", doesn't correspond to pattern \"" + p.src() + + "\"").c_str()); + } + } + return _tmpReadToken; +} + +std::vector +InStream::readWords(int size, const pattern &p, const std::string &variablesName, int indexBase) { + __testlib_readMany(readWords, readWord(p, variablesName), std::string, true); +} + +std::vector InStream::readWords(int size, int indexBase) { + __testlib_readMany(readWords, readWord(), std::string, true); +} + +std::string InStream::readWord(const std::string &ptrn, const std::string &variableName) { + return readWord(pattern(ptrn), variableName); +} + +std::vector +InStream::readWords(int size, const std::string &ptrn, const std::string &variablesName, int indexBase) { + pattern p(ptrn); + __testlib_readMany(readWords, readWord(p, variablesName), std::string, true); +} + +std::string InStream::readToken(const pattern &p, const std::string &variableName) { + return readWord(p, variableName); +} + +std::vector +InStream::readTokens(int size, const pattern &p, const std::string &variablesName, int indexBase) { + __testlib_readMany(readTokens, readToken(p, variablesName), std::string, true); +} + +std::vector InStream::readTokens(int size, int indexBase) { + __testlib_readMany(readTokens, readToken(), std::string, true); +} + +std::string InStream::readToken(const std::string &ptrn, const std::string &variableName) { + return readWord(ptrn, variableName); +} + +std::vector +InStream::readTokens(int size, const std::string &ptrn, const std::string &variablesName, int indexBase) { + pattern p(ptrn); + __testlib_readMany(readTokens, readWord(p, variablesName), std::string, true); +} + +void InStream::readWordTo(std::string &result, const pattern &p, const std::string &variableName) { + readWordTo(result); + if (!p.matches(result)) { + if (variableName.empty()) + quit(_wa, ("Token \"" + __testlib_part(result) + "\" doesn't correspond to pattern \"" + p.src() + + "\"").c_str()); + else + quit(_wa, ("Token parameter [name=" + variableName + "] equals to \"" + __testlib_part(result) + + "\", doesn't correspond to pattern \"" + p.src() + "\"").c_str()); + } +} + +void InStream::readWordTo(std::string &result, const std::string &ptrn, const std::string &variableName) { + return readWordTo(result, pattern(ptrn), variableName); +} + +void InStream::readTokenTo(std::string &result, const pattern &p, const std::string &variableName) { + return readWordTo(result, p, variableName); +} + +void InStream::readTokenTo(std::string &result, const std::string &ptrn, const std::string &variableName) { + return readWordTo(result, ptrn, variableName); +} + +#ifdef __GNUC__ +__attribute__((pure)) +#endif +static inline bool equals(long long integer, const char *s) { + if (integer == LLONG_MIN) + return strcmp(s, "-9223372036854775808") == 0; + + if (integer == 0LL) + return strcmp(s, "0") == 0; + + size_t length = strlen(s); + + if (length == 0) + return false; + + if (integer < 0 && s[0] != '-') + return false; + + if (integer < 0) + s++, length--, integer = -integer; + + if (length == 0) + return false; + + while (integer > 0) { + int digit = int(integer % 10); + + if (s[length - 1] != '0' + digit) + return false; + + length--; + integer /= 10; + } + + return length == 0; +} + +#ifdef __GNUC__ +__attribute__((pure)) +#endif +static inline bool equals(unsigned long long integer, const char *s) { + if (integer == ULLONG_MAX) + return strcmp(s, "18446744073709551615") == 0; + + if (integer == 0ULL) + return strcmp(s, "0") == 0; + + size_t length = strlen(s); + + if (length == 0) + return false; + + while (integer > 0) { + int digit = int(integer % 10); + + if (s[length - 1] != '0' + digit) + return false; + + length--; + integer /= 10; + } + + return length == 0; +} + +static inline double stringToDouble(InStream &in, const char *buffer) { + double retval; + + size_t length = strlen(buffer); + + int minusCount = 0; + int plusCount = 0; + int decimalPointCount = 0; + int digitCount = 0; + int eCount = 0; + + for (size_t i = 0; i < length; i++) { + if (('0' <= buffer[i] && buffer[i] <= '9') || buffer[i] == '.' + || buffer[i] == 'e' || buffer[i] == 'E' + || buffer[i] == '-' || buffer[i] == '+') { + if ('0' <= buffer[i] && buffer[i] <= '9') + digitCount++; + if (buffer[i] == 'e' || buffer[i] == 'E') + eCount++; + if (buffer[i] == '-') + minusCount++; + if (buffer[i] == '+') + plusCount++; + if (buffer[i] == '.') + decimalPointCount++; + } else + in.quit(_pe, ("Expected double, but \"" + __testlib_part(buffer) + "\" found").c_str()); + } + + // If for sure is not a number in standard notation or in e-notation. + if (digitCount == 0 || minusCount > 2 || plusCount > 2 || decimalPointCount > 1 || eCount > 1) + in.quit(_pe, ("Expected double, but \"" + __testlib_part(buffer) + "\" found").c_str()); + + char *suffix = new char[length + 1]; + std::memset(suffix, 0, length + 1); + int scanned = std::sscanf(buffer, "%lf%s", &retval, suffix); + bool empty = strlen(suffix) == 0; + delete[] suffix; + + if (scanned == 1 || (scanned == 2 && empty)) { + if (__testlib_isNaN(retval)) + in.quit(_pe, ("Expected double, but \"" + __testlib_part(buffer) + "\" found").c_str()); + return retval; + } else + in.quit(_pe, ("Expected double, but \"" + __testlib_part(buffer) + "\" found").c_str()); +} + +static inline double stringToDouble(InStream &in, const std::string& buffer) { + for (size_t i = 0; i < buffer.length(); i++) + if (buffer[i] == '\0') + in.quit(_pe, ("Expected double, but \"" + __testlib_part(buffer) + "\" found (it contains \\0)").c_str()); + return stringToDouble(in, buffer.c_str()); +} + +static inline double stringToStrictDouble(InStream &in, const char *buffer, + int minAfterPointDigitCount, int maxAfterPointDigitCount) { + if (minAfterPointDigitCount < 0) + in.quit(_fail, "stringToStrictDouble: minAfterPointDigitCount should be non-negative."); + + if (minAfterPointDigitCount > maxAfterPointDigitCount) + in.quit(_fail, + "stringToStrictDouble: minAfterPointDigitCount should be less or equal to maxAfterPointDigitCount."); + + double retval; + + size_t length = strlen(buffer); + + if (length == 0 || length > 1000) + in.quit(_pe, ("Expected strict double, but \"" + __testlib_part(buffer) + "\" found").c_str()); + + if (buffer[0] != '-' && (buffer[0] < '0' || buffer[0] > '9')) + in.quit(_pe, ("Expected strict double, but \"" + __testlib_part(buffer) + "\" found").c_str()); + + int pointPos = -1; + for (size_t i = 1; i + 1 < length; i++) { + if (buffer[i] == '.') { + if (pointPos > -1) + in.quit(_pe, ("Expected strict double, but \"" + __testlib_part(buffer) + "\" found").c_str()); + pointPos = int(i); + } + if (buffer[i] != '.' && (buffer[i] < '0' || buffer[i] > '9')) + in.quit(_pe, ("Expected strict double, but \"" + __testlib_part(buffer) + "\" found").c_str()); + } + + if (buffer[length - 1] < '0' || buffer[length - 1] > '9') + in.quit(_pe, ("Expected strict double, but \"" + __testlib_part(buffer) + "\" found").c_str()); + + int afterDigitsCount = (pointPos == -1 ? 0 : int(length) - pointPos - 1); + if (afterDigitsCount < minAfterPointDigitCount || afterDigitsCount > maxAfterPointDigitCount) + in.quit(_pe, ("Expected strict double with number of digits after point in range [" + + vtos(minAfterPointDigitCount) + + "," + + vtos(maxAfterPointDigitCount) + + "], but \"" + __testlib_part(buffer) + "\" found").c_str() + ); + + int firstDigitPos = -1; + for (size_t i = 0; i < length; i++) + if (buffer[i] >= '0' && buffer[i] <= '9') { + firstDigitPos = int(i); + break; + } + + if (firstDigitPos > 1 || firstDigitPos == -1) + in.quit(_pe, ("Expected strict double, but \"" + __testlib_part(buffer) + "\" found").c_str()); + + if (buffer[firstDigitPos] == '0' && firstDigitPos + 1 < int(length) + && buffer[firstDigitPos + 1] >= '0' && buffer[firstDigitPos + 1] <= '9') + in.quit(_pe, ("Expected strict double, but \"" + __testlib_part(buffer) + "\" found").c_str()); + + char *suffix = new char[length + 1]; + std::memset(suffix, 0, length + 1); + int scanned = std::sscanf(buffer, "%lf%s", &retval, suffix); + bool empty = strlen(suffix) == 0; + delete[] suffix; + + if (scanned == 1 || (scanned == 2 && empty)) { + if (__testlib_isNaN(retval) || __testlib_isInfinite(retval)) + in.quit(_pe, ("Expected double, but \"" + __testlib_part(buffer) + "\" found").c_str()); + if (buffer[0] == '-' && retval >= 0) + in.quit(_pe, ("Redundant minus in \"" + __testlib_part(buffer) + "\" found").c_str()); + return retval; + } else + in.quit(_pe, ("Expected double, but \"" + __testlib_part(buffer) + "\" found").c_str()); +} + +static inline double stringToStrictDouble(InStream &in, const std::string& buffer, + int minAfterPointDigitCount, int maxAfterPointDigitCount) { + for (size_t i = 0; i < buffer.length(); i++) + if (buffer[i] == '\0') + in.quit(_pe, ("Expected double, but \"" + __testlib_part(buffer) + "\" found (it contains \\0)").c_str()); + return stringToStrictDouble(in, buffer.c_str(), minAfterPointDigitCount, maxAfterPointDigitCount); +} + +static inline long long stringToLongLong(InStream &in, const char *buffer) { + if (strcmp(buffer, "-9223372036854775808") == 0) + return LLONG_MIN; + + bool minus = false; + size_t length = strlen(buffer); + + if (length > 1 && buffer[0] == '-') + minus = true; + + if (length > 20) + in.quit(_pe, ("Expected integer, but \"" + __testlib_part(buffer) + "\" found").c_str()); + + long long retval = 0LL; + + int zeroes = 0; + bool processingZeroes = true; + + for (int i = (minus ? 1 : 0); i < int(length); i++) { + if (buffer[i] == '0' && processingZeroes) + zeroes++; + else + processingZeroes = false; + + if (buffer[i] < '0' || buffer[i] > '9') + in.quit(_pe, ("Expected integer, but \"" + __testlib_part(buffer) + "\" found").c_str()); + retval = retval * 10 + (buffer[i] - '0'); + } + + if (retval < 0) + in.quit(_pe, ("Expected integer, but \"" + __testlib_part(buffer) + "\" found").c_str()); + + if ((zeroes > 0 && (retval != 0 || minus)) || zeroes > 1) + in.quit(_pe, ("Expected integer, but \"" + __testlib_part(buffer) + "\" found").c_str()); + + retval = (minus ? -retval : +retval); + + if (length < 19) + return retval; + + if (equals(retval, buffer)) + return retval; + else + in.quit(_pe, ("Expected int64, but \"" + __testlib_part(buffer) + "\" found").c_str()); +} + +static inline long long stringToLongLong(InStream &in, const std::string& buffer) { + for (size_t i = 0; i < buffer.length(); i++) + if (buffer[i] == '\0') + in.quit(_pe, ("Expected integer, but \"" + __testlib_part(buffer) + "\" found (it contains \\0)").c_str()); + return stringToLongLong(in, buffer.c_str()); +} + +static inline unsigned long long stringToUnsignedLongLong(InStream &in, const char *buffer) { + size_t length = strlen(buffer); + + if (length > 20) + in.quit(_pe, ("Expected unsigned integer, but \"" + __testlib_part(buffer) + "\" found").c_str()); + if (length > 1 && buffer[0] == '0') + in.quit(_pe, ("Expected unsigned integer, but \"" + __testlib_part(buffer) + "\" found").c_str()); + + unsigned long long retval = 0LL; + for (int i = 0; i < int(length); i++) { + if (buffer[i] < '0' || buffer[i] > '9') + in.quit(_pe, ("Expected unsigned integer, but \"" + __testlib_part(buffer) + "\" found").c_str()); + retval = retval * 10 + (buffer[i] - '0'); + } + + if (length < 19) + return retval; + + if (length == 20 && strcmp(buffer, "18446744073709551615") > 0) + in.quit(_pe, ("Expected unsigned int64, but \"" + __testlib_part(buffer) + "\" found").c_str()); + + if (equals(retval, buffer)) + return retval; + else + in.quit(_pe, ("Expected unsigned int64, but \"" + __testlib_part(buffer) + "\" found").c_str()); +} + +static inline long long stringToUnsignedLongLong(InStream &in, const std::string& buffer) { + for (size_t i = 0; i < buffer.length(); i++) + if (buffer[i] == '\0') + in.quit(_pe, ("Expected unsigned integer, but \"" + __testlib_part(buffer) + "\" found (it contains \\0)").c_str()); + return stringToUnsignedLongLong(in, buffer.c_str()); +} + +int InStream::readInteger() { + if (!strict && seekEof()) + quit(_unexpected_eof, "Unexpected end of file - int32 expected"); + + readWordTo(_tmpReadToken); + + long long value = stringToLongLong(*this, _tmpReadToken); + if (value < INT_MIN || value > INT_MAX) + quit(_pe, ("Expected int32, but \"" + __testlib_part(_tmpReadToken) + "\" found").c_str()); + + return int(value); +} + +long long InStream::readLong() { + if (!strict && seekEof()) + quit(_unexpected_eof, "Unexpected end of file - int64 expected"); + + readWordTo(_tmpReadToken); + + return stringToLongLong(*this, _tmpReadToken); +} + +unsigned long long InStream::readUnsignedLong() { + if (!strict && seekEof()) + quit(_unexpected_eof, "Unexpected end of file - int64 expected"); + + readWordTo(_tmpReadToken); + + return stringToUnsignedLongLong(*this, _tmpReadToken); +} + +long long InStream::readLong(long long minv, long long maxv, const std::string &variableName) { + long long result = readLong(); + + if (result < minv || result > maxv) { + if (readManyIteration == NO_INDEX) { + if (variableName.empty()) + quit(_wa, ("Integer " + vtos(result) + " violates the range [" + toHumanReadableString(minv) + ", " + toHumanReadableString(maxv) + + "]").c_str()); + else + quit(_wa, ("Integer parameter [name=" + std::string(variableName) + "] equals to " + vtos(result) + + ", violates the range [" + toHumanReadableString(minv) + ", " + toHumanReadableString(maxv) + "]").c_str()); + } else { + if (variableName.empty()) + quit(_wa, ("Integer element [index=" + vtos(readManyIteration) + "] equals to " + vtos(result) + + ", violates the range [" + toHumanReadableString(minv) + ", " + toHumanReadableString(maxv) + "]").c_str()); + else + quit(_wa, + ("Integer element " + std::string(variableName) + "[" + vtos(readManyIteration) + "] equals to " + + vtos(result) + ", violates the range [" + toHumanReadableString(minv) + ", " + toHumanReadableString(maxv) + "]").c_str()); + } + } + + if (strict && !variableName.empty()) + validator.addBoundsHit(variableName, ValidatorBoundsHit(minv == result, maxv == result)); + + return result; +} + +std::vector +InStream::readLongs(int size, long long minv, long long maxv, const std::string &variablesName, int indexBase) { + __testlib_readMany(readLongs, readLong(minv, maxv, variablesName), long long, true) +} + +std::vector InStream::readLongs(int size, int indexBase) { + __testlib_readMany(readLongs, readLong(), long long, true) +} + +unsigned long long +InStream::readUnsignedLong(unsigned long long minv, unsigned long long maxv, const std::string &variableName) { + unsigned long long result = readUnsignedLong(); + + if (result < minv || result > maxv) { + if (readManyIteration == NO_INDEX) { + if (variableName.empty()) + quit(_wa, + ("Unsigned integer " + vtos(result) + " violates the range [" + toHumanReadableString(minv) + ", " + toHumanReadableString(maxv) + + "]").c_str()); + else + quit(_wa, + ("Unsigned integer parameter [name=" + std::string(variableName) + "] equals to " + vtos(result) + + ", violates the range [" + toHumanReadableString(minv) + ", " + toHumanReadableString(maxv) + "]").c_str()); + } else { + if (variableName.empty()) + quit(_wa, + ("Unsigned integer element [index=" + vtos(readManyIteration) + "] equals to " + vtos(result) + + ", violates the range [" + toHumanReadableString(minv) + ", " + toHumanReadableString(maxv) + "]").c_str()); + else + quit(_wa, ("Unsigned integer element " + std::string(variableName) + "[" + vtos(readManyIteration) + + "] equals to " + vtos(result) + ", violates the range [" + toHumanReadableString(minv) + ", " + toHumanReadableString(maxv) + + "]").c_str()); + } + } + + if (strict && !variableName.empty()) + validator.addBoundsHit(variableName, ValidatorBoundsHit(minv == result, maxv == result)); + + return result; +} + +std::vector InStream::readUnsignedLongs(int size, unsigned long long minv, unsigned long long maxv, + const std::string &variablesName, int indexBase) { + __testlib_readMany(readUnsignedLongs, readUnsignedLong(minv, maxv, variablesName), unsigned long long, true) +} + +std::vector InStream::readUnsignedLongs(int size, int indexBase) { + __testlib_readMany(readUnsignedLongs, readUnsignedLong(), unsigned long long, true) +} + +unsigned long long +InStream::readLong(unsigned long long minv, unsigned long long maxv, const std::string &variableName) { + return readUnsignedLong(minv, maxv, variableName); +} + +int InStream::readInt() { + return readInteger(); +} + +int InStream::readInt(int minv, int maxv, const std::string &variableName) { + int result = readInt(); + + if (result < minv || result > maxv) { + if (readManyIteration == NO_INDEX) { + if (variableName.empty()) + quit(_wa, ("Integer " + vtos(result) + " violates the range [" + toHumanReadableString(minv) + ", " + toHumanReadableString(maxv) + + "]").c_str()); + else + quit(_wa, ("Integer parameter [name=" + std::string(variableName) + "] equals to " + vtos(result) + + ", violates the range [" + toHumanReadableString(minv) + ", " + toHumanReadableString(maxv) + "]").c_str()); + } else { + if (variableName.empty()) + quit(_wa, ("Integer element [index=" + vtos(readManyIteration) + "] equals to " + vtos(result) + + ", violates the range [" + toHumanReadableString(minv) + ", " + toHumanReadableString(maxv) + "]").c_str()); + else + quit(_wa, + ("Integer element " + std::string(variableName) + "[" + vtos(readManyIteration) + "] equals to " + + vtos(result) + ", violates the range [" + toHumanReadableString(minv) + ", " + toHumanReadableString(maxv) + "]").c_str()); + } + } + + if (strict && !variableName.empty()) + validator.addBoundsHit(variableName, ValidatorBoundsHit(minv == result, maxv == result)); + + return result; +} + +int InStream::readInteger(int minv, int maxv, const std::string &variableName) { + return readInt(minv, maxv, variableName); +} + +std::vector InStream::readInts(int size, int minv, int maxv, const std::string &variablesName, int indexBase) { + __testlib_readMany(readInts, readInt(minv, maxv, variablesName), int, true) +} + +std::vector InStream::readInts(int size, int indexBase) { + __testlib_readMany(readInts, readInt(), int, true) +} + +std::vector InStream::readIntegers(int size, int minv, int maxv, const std::string &variablesName, int indexBase) { + __testlib_readMany(readIntegers, readInt(minv, maxv, variablesName), int, true) +} + +std::vector InStream::readIntegers(int size, int indexBase) { + __testlib_readMany(readIntegers, readInt(), int, true) +} + +double InStream::readReal() { + if (!strict && seekEof()) + quit(_unexpected_eof, "Unexpected end of file - double expected"); + + return stringToDouble(*this, readWord()); +} + +double InStream::readDouble() { + return readReal(); +} + +double InStream::readReal(double minv, double maxv, const std::string &variableName) { + double result = readReal(); + + if (result < minv || result > maxv) { + if (readManyIteration == NO_INDEX) { + if (variableName.empty()) + quit(_wa, ("Double " + vtos(result) + " violates the range [" + vtos(minv) + ", " + vtos(maxv) + + "]").c_str()); + else + quit(_wa, ("Double parameter [name=" + std::string(variableName) + "] equals to " + vtos(result) + + ", violates the range [" + vtos(minv) + ", " + vtos(maxv) + "]").c_str()); + } else { + if (variableName.empty()) + quit(_wa, ("Double element [index=" + vtos(readManyIteration) + "] equals to " + vtos(result) + + ", violates the range [" + vtos(minv) + ", " + vtos(maxv) + "]").c_str()); + else + quit(_wa, + ("Double element " + std::string(variableName) + "[" + vtos(readManyIteration) + "] equals to " + + vtos(result) + ", violates the range [" + vtos(minv) + ", " + vtos(maxv) + "]").c_str()); + } + } + + if (strict && !variableName.empty()) + validator.addBoundsHit(variableName, ValidatorBoundsHit( + doubleDelta(minv, result) < ValidatorBoundsHit::EPS, + doubleDelta(maxv, result) < ValidatorBoundsHit::EPS + )); + + return result; +} + +std::vector +InStream::readReals(int size, double minv, double maxv, const std::string &variablesName, int indexBase) { + __testlib_readMany(readReals, readReal(minv, maxv, variablesName), double, true) +} + +std::vector InStream::readReals(int size, int indexBase) { + __testlib_readMany(readReals, readReal(), double, true) +} + +double InStream::readDouble(double minv, double maxv, const std::string &variableName) { + return readReal(minv, maxv, variableName); +} + +std::vector +InStream::readDoubles(int size, double minv, double maxv, const std::string &variablesName, int indexBase) { + __testlib_readMany(readDoubles, readDouble(minv, maxv, variablesName), double, true) +} + +std::vector InStream::readDoubles(int size, int indexBase) { + __testlib_readMany(readDoubles, readDouble(), double, true) +} + +double InStream::readStrictReal(double minv, double maxv, + int minAfterPointDigitCount, int maxAfterPointDigitCount, + const std::string &variableName) { + if (!strict && seekEof()) + quit(_unexpected_eof, "Unexpected end of file - strict double expected"); + + double result = stringToStrictDouble(*this, readWord(), minAfterPointDigitCount, maxAfterPointDigitCount); + + if (result < minv || result > maxv) { + if (readManyIteration == NO_INDEX) { + if (variableName.empty()) + quit(_wa, ("Strict double " + vtos(result) + " violates the range [" + vtos(minv) + ", " + vtos(maxv) + + "]").c_str()); + else + quit(_wa, + ("Strict double parameter [name=" + std::string(variableName) + "] equals to " + vtos(result) + + ", violates the range [" + vtos(minv) + ", " + vtos(maxv) + "]").c_str()); + } else { + if (variableName.empty()) + quit(_wa, ("Strict double element [index=" + vtos(readManyIteration) + "] equals to " + vtos(result) + + ", violates the range [" + vtos(minv) + ", " + vtos(maxv) + "]").c_str()); + else + quit(_wa, ("Strict double element " + std::string(variableName) + "[" + vtos(readManyIteration) + + "] equals to " + vtos(result) + ", violates the range [" + vtos(minv) + ", " + vtos(maxv) + + "]").c_str()); + } + } + + if (strict && !variableName.empty()) + validator.addBoundsHit(variableName, ValidatorBoundsHit( + doubleDelta(minv, result) < ValidatorBoundsHit::EPS, + doubleDelta(maxv, result) < ValidatorBoundsHit::EPS + )); + + return result; +} + +std::vector InStream::readStrictReals(int size, double minv, double maxv, + int minAfterPointDigitCount, int maxAfterPointDigitCount, + const std::string &variablesName, int indexBase) { + __testlib_readMany(readStrictReals, + readStrictReal(minv, maxv, minAfterPointDigitCount, maxAfterPointDigitCount, variablesName), + double, true) +} + +double InStream::readStrictDouble(double minv, double maxv, + int minAfterPointDigitCount, int maxAfterPointDigitCount, + const std::string &variableName) { + return readStrictReal(minv, maxv, + minAfterPointDigitCount, maxAfterPointDigitCount, + variableName); +} + +std::vector InStream::readStrictDoubles(int size, double minv, double maxv, + int minAfterPointDigitCount, int maxAfterPointDigitCount, + const std::string &variablesName, int indexBase) { + __testlib_readMany(readStrictDoubles, + readStrictDouble(minv, maxv, minAfterPointDigitCount, maxAfterPointDigitCount, variablesName), + double, true) +} + +bool InStream::eof() { + if (!strict && NULL == reader) + return true; + + return reader->eof(); +} + +bool InStream::seekEof() { + if (!strict && NULL == reader) + return true; + skipBlanks(); + return eof(); +} + +bool InStream::eoln() { + if (!strict && NULL == reader) + return true; + + int c = reader->nextChar(); + + if (!strict) { + if (c == EOFC) + return true; + + if (c == CR) { + c = reader->nextChar(); + + if (c != LF) { + reader->unreadChar(c); + reader->unreadChar(CR); + return false; + } else + return true; + } + + if (c == LF) + return true; + + reader->unreadChar(c); + return false; + } else { + bool returnCr = false; + +#if (defined(ON_WINDOWS) && !defined(FOR_LINUX)) || defined(FOR_WINDOWS) + if (c != CR) { + reader->unreadChar(c); + return false; + } else { + if (!returnCr) + returnCr = true; + c = reader->nextChar(); + } +#endif + if (c != LF) { + reader->unreadChar(c); + if (returnCr) + reader->unreadChar(CR); + return false; + } + + return true; + } +} + +void InStream::readEoln() { + lastLine = reader->getLine(); + if (!eoln()) + quit(_pe, "Expected EOLN"); +} + +void InStream::readEof() { + lastLine = reader->getLine(); + if (!eof()) + quit(_pe, "Expected EOF"); + + if (TestlibFinalizeGuard::alive && this == &inf) + testlibFinalizeGuard.readEofCount++; +} + +bool InStream::seekEoln() { + if (!strict && NULL == reader) + return true; + + int cur; + do { + cur = reader->nextChar(); + } while (cur == SPACE || cur == TAB); + + reader->unreadChar(cur); + return eoln(); +} + +void InStream::nextLine() { + readLine(); +} + +void InStream::readStringTo(std::string &result) { + if (NULL == reader) + quit(_pe, "Expected line"); + + result.clear(); + + for (;;) { + int cur = reader->curChar(); + + if (cur == LF || cur == EOFC) + break; + + if (cur == CR) { + cur = reader->nextChar(); + if (reader->curChar() == LF) { + reader->unreadChar(cur); + break; + } + } + + lastLine = reader->getLine(); + result += char(reader->nextChar()); + } + + if (strict) + readEoln(); + else + eoln(); +} + +std::string InStream::readString() { + readStringTo(_tmpReadToken); + return _tmpReadToken; +} + +std::vector InStream::readStrings(int size, int indexBase) { + __testlib_readMany(readStrings, readString(), std::string, false) +} + +void InStream::readStringTo(std::string &result, const pattern &p, const std::string &variableName) { + readStringTo(result); + if (!p.matches(result)) { + if (readManyIteration == NO_INDEX) { + if (variableName.empty()) + quit(_wa, ("Line \"" + __testlib_part(result) + "\" doesn't correspond to pattern \"" + p.src() + + "\"").c_str()); + else + quit(_wa, ("Line [name=" + variableName + "] equals to \"" + __testlib_part(result) + + "\", doesn't correspond to pattern \"" + p.src() + "\"").c_str()); + } else { + if (variableName.empty()) + quit(_wa, + ("Line element [index=" + vtos(readManyIteration) + "] equals to \"" + __testlib_part(result) + + "\" doesn't correspond to pattern \"" + p.src() + "\"").c_str()); + else + quit(_wa, + ("Line element " + std::string(variableName) + "[" + vtos(readManyIteration) + "] equals to \"" + + __testlib_part(result) + "\", doesn't correspond to pattern \"" + p.src() + "\"").c_str()); + } + } +} + +void InStream::readStringTo(std::string &result, const std::string &ptrn, const std::string &variableName) { + readStringTo(result, pattern(ptrn), variableName); +} + +std::string InStream::readString(const pattern &p, const std::string &variableName) { + readStringTo(_tmpReadToken, p, variableName); + return _tmpReadToken; +} + +std::vector +InStream::readStrings(int size, const pattern &p, const std::string &variablesName, int indexBase) { + __testlib_readMany(readStrings, readString(p, variablesName), std::string, false) +} + +std::string InStream::readString(const std::string &ptrn, const std::string &variableName) { + readStringTo(_tmpReadToken, ptrn, variableName); + return _tmpReadToken; +} + +std::vector +InStream::readStrings(int size, const std::string &ptrn, const std::string &variablesName, int indexBase) { + pattern p(ptrn); + __testlib_readMany(readStrings, readString(p, variablesName), std::string, false) +} + +void InStream::readLineTo(std::string &result) { + readStringTo(result); +} + +std::string InStream::readLine() { + return readString(); +} + +std::vector InStream::readLines(int size, int indexBase) { + __testlib_readMany(readLines, readString(), std::string, false) +} + +void InStream::readLineTo(std::string &result, const pattern &p, const std::string &variableName) { + readStringTo(result, p, variableName); +} + +void InStream::readLineTo(std::string &result, const std::string &ptrn, const std::string &variableName) { + readStringTo(result, ptrn, variableName); +} + +std::string InStream::readLine(const pattern &p, const std::string &variableName) { + return readString(p, variableName); +} + +std::vector +InStream::readLines(int size, const pattern &p, const std::string &variablesName, int indexBase) { + __testlib_readMany(readLines, readString(p, variablesName), std::string, false) +} + +std::string InStream::readLine(const std::string &ptrn, const std::string &variableName) { + return readString(ptrn, variableName); +} + +std::vector +InStream::readLines(int size, const std::string &ptrn, const std::string &variablesName, int indexBase) { + pattern p(ptrn); + __testlib_readMany(readLines, readString(p, variablesName), std::string, false) +} + +#ifdef __GNUC__ +__attribute__ ((format (printf, 3, 4))) +#endif +void InStream::ensuref(bool cond, const char *format, ...) { + if (!cond) { + FMT_TO_RESULT(format, format, message); + this->__testlib_ensure(cond, message); + } +} + +void InStream::__testlib_ensure(bool cond, std::string message) { + if (!cond) + this->quit(_wa, message.c_str()); +} + +void InStream::close() { + if (NULL != reader) { + reader->close(); + delete reader; + reader = NULL; + } + + opened = false; +} + +NORETURN void quit(TResult result, const std::string &msg) { + ouf.quit(result, msg.c_str()); +} + +NORETURN void quit(TResult result, const char *msg) { + ouf.quit(result, msg); +} + +NORETURN void __testlib_quitp(double points, const char *message) { + __testlib_points = points; + std::string stringPoints = removeDoubleTrailingZeroes(format("%.10f", points)); + + std::string quitMessage; + if (NULL == message || 0 == strlen(message)) + quitMessage = stringPoints; + else + quitMessage = stringPoints + " " + message; + + quit(_points, quitMessage.c_str()); +} + +NORETURN void __testlib_quitp(int points, const char *message) { + __testlib_points = points; + std::string stringPoints = format("%d", points); + + std::string quitMessage; + if (NULL == message || 0 == strlen(message)) + quitMessage = stringPoints; + else + quitMessage = stringPoints + " " + message; + + quit(_points, quitMessage.c_str()); +} + +NORETURN void quitp(float points, const std::string &message = "") { + __testlib_quitp(double(points), message.c_str()); +} + +NORETURN void quitp(double points, const std::string &message = "") { + __testlib_quitp(points, message.c_str()); +} + +NORETURN void quitp(long double points, const std::string &message = "") { + __testlib_quitp(double(points), message.c_str()); +} + +NORETURN void quitp(int points, const std::string &message = "") { + __testlib_quitp(points, message.c_str()); +} + +NORETURN void quitpi(const std::string &points_info, const std::string &message = "") { + if (points_info.find(' ') != std::string::npos) + quit(_fail, "Parameter 'points_info' can't contain spaces"); + if (message.empty()) + quit(_points, ("points_info=" + points_info).c_str()); + else + quit(_points, ("points_info=" + points_info + " " + message).c_str()); +} + +template +#ifdef __GNUC__ +__attribute__ ((format (printf, 2, 3))) +#endif +NORETURN void quitp(F points, const char *format, ...) { + FMT_TO_RESULT(format, format, message); + quitp(points, message); +} + +#ifdef __GNUC__ +__attribute__ ((format (printf, 2, 3))) +#endif +NORETURN void quitf(TResult result, const char *format, ...) { + FMT_TO_RESULT(format, format, message); + quit(result, message); +} + +#ifdef __GNUC__ +__attribute__ ((format (printf, 3, 4))) +#endif +void quitif(bool condition, TResult result, const char *format, ...) { + if (condition) { + FMT_TO_RESULT(format, format, message); + quit(result, message); + } +} + +NORETURN void __testlib_help() { + InStream::textColor(InStream::LightCyan); + std::fprintf(stderr, "TESTLIB %s, https://github.com/MikeMirzayanov/testlib/ ", VERSION); + std::fprintf(stderr, "by Mike Mirzayanov, copyright(c) 2005-2020\n"); + std::fprintf(stderr, "Checker name: \"%s\"\n", checkerName.c_str()); + InStream::textColor(InStream::LightGray); + + std::fprintf(stderr, "\n"); + std::fprintf(stderr, "Latest features: \n"); + for (size_t i = 0; i < sizeof(latestFeatures) / sizeof(char *); i++) { + std::fprintf(stderr, "*) %s\n", latestFeatures[i]); + } + std::fprintf(stderr, "\n"); + + std::fprintf(stderr, "Program must be run with the following arguments: \n"); + std::fprintf(stderr, " [--testset testset] [--group group] [ [<-appes>]]\n\n"); + + __testlib_exitCode = FAIL_EXIT_CODE; + std::exit(FAIL_EXIT_CODE); +} + +static void __testlib_ensuresPreconditions() { + // testlib assumes: sizeof(int) = 4. + __TESTLIB_STATIC_ASSERT(sizeof(int) == 4); + + // testlib assumes: INT_MAX == 2147483647. + __TESTLIB_STATIC_ASSERT(INT_MAX == 2147483647); + + // testlib assumes: sizeof(long long) = 8. + __TESTLIB_STATIC_ASSERT(sizeof(long long) == 8); + + // testlib assumes: sizeof(double) = 8. + __TESTLIB_STATIC_ASSERT(sizeof(double) == 8); + + // testlib assumes: no -ffast-math. + if (!__testlib_isNaN(+__testlib_nan())) + quit(_fail, "Function __testlib_isNaN is not working correctly: possible reason is '-ffast-math'"); + if (!__testlib_isNaN(-__testlib_nan())) + quit(_fail, "Function __testlib_isNaN is not working correctly: possible reason is '-ffast-math'"); +} + +std::string __testlib_testset; + +std::string getTestset() { + return __testlib_testset; +} + +std::string __testlib_group; + +std::string getGroup() { + return __testlib_group; +} + +static void __testlib_set_testset_and_group(int argc, char* argv[]) { + for (int i = 1; i < argc; i++) { + if (!strcmp("--testset", argv[i])) { + if (i + 1 < argc && strlen(argv[i + 1]) > 0) + __testlib_testset = argv[++i]; + else + quit(_fail, std::string("Expected non-empty testset after --testset command line parameter")); + } else if (!strcmp("--group", argv[i])) { + if (i + 1 < argc) + __testlib_group = argv[++i]; + else + quit(_fail, std::string("Expected group after --group command line parameter")); + } + } +} + +void registerGen(int argc, char *argv[], int randomGeneratorVersion) { + if (randomGeneratorVersion < 0 || randomGeneratorVersion > 1) + quitf(_fail, "Random generator version is expected to be 0 or 1."); + random_t::version = randomGeneratorVersion; + + __testlib_ensuresPreconditions(); + TestlibFinalizeGuard::registered = true; + + testlibMode = _generator; + __testlib_set_binary(stdin); + rnd.setSeed(argc, argv); + +#if __cplusplus > 199711L || defined(_MSC_VER) + prepareOpts(argc, argv); +#endif +} + +#ifdef USE_RND_AS_BEFORE_087 +void registerGen(int argc, char* argv[]) +{ + registerGen(argc, argv, 0); +} +#else +#ifdef __GNUC__ +#if (__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ > 4)) +__attribute__ ((deprecated("Use registerGen(argc, argv, 0) or registerGen(argc, argv, 1)." +" The third parameter stands for the random generator version." +" If you are trying to compile old generator use macro -DUSE_RND_AS_BEFORE_087 or registerGen(argc, argv, 0)." +" Version 1 has been released on Spring, 2013. Use it to write new generators."))) +#else +__attribute__ ((deprecated)) +#endif +#endif +#ifdef _MSC_VER +__declspec(deprecated("Use registerGen(argc, argv, 0) or registerGen(argc, argv, 1)." + " The third parameter stands for the random generator version." + " If you are trying to compile old generator use macro -DUSE_RND_AS_BEFORE_087 or registerGen(argc, argv, 0)." + " Version 1 has been released on Spring, 2013. Use it to write new generators.")) +#endif +void registerGen(int argc, char *argv[]) { + std::fprintf(stderr, "Use registerGen(argc, argv, 0) or registerGen(argc, argv, 1)." + " The third parameter stands for the random generator version." + " If you are trying to compile old generator use macro -DUSE_RND_AS_BEFORE_087 or registerGen(argc, argv, 0)." + " Version 1 has been released on Spring, 2013. Use it to write new generators.\n\n"); + registerGen(argc, argv, 0); +} +#endif + +void registerInteraction(int argc, char *argv[]) { + __testlib_ensuresPreconditions(); + __testlib_set_testset_and_group(argc, argv); + TestlibFinalizeGuard::registered = true; + + testlibMode = _interactor; + __testlib_set_binary(stdin); + + if (argc > 1 && !strcmp("--help", argv[1])) + __testlib_help(); + + if (argc < 3 || argc > 6) { + quit(_fail, std::string("Program must be run with the following arguments: ") + + std::string(" [ [ [<-appes>]]]") + + "\nUse \"--help\" to get help information"); + } + + if (argc <= 4) { + resultName = ""; + appesMode = false; + } + +#ifndef EJUDGE + if (argc == 5) { + resultName = argv[4]; + appesMode = false; + } + + if (argc == 6) { + if (strcmp("-APPES", argv[5]) && strcmp("-appes", argv[5])) { + quit(_fail, std::string("Program must be run with the following arguments: ") + + " [ [<-appes>]]"); + } else { + resultName = argv[4]; + appesMode = true; + } + } +#endif + + inf.init(argv[1], _input); + + tout.open(argv[2], std::ios_base::out); + if (tout.fail() || !tout.is_open()) + quit(_fail, std::string("Can not write to the test-output-file '") + argv[2] + std::string("'")); + + ouf.init(stdin, _output); + + if (argc >= 4) + ans.init(argv[3], _answer); + else + ans.name = "unopened answer stream"; +} + +void registerValidation() { + __testlib_ensuresPreconditions(); + TestlibFinalizeGuard::registered = true; + + testlibMode = _validator; + + __testlib_set_binary(stdin); + __testlib_set_binary(stdout); + __testlib_set_binary(stderr); + + inf.init(stdin, _input); + inf.strict = true; +} + +void registerValidation(int argc, char *argv[]) { + registerValidation(); + __testlib_set_testset_and_group(argc, argv); + + validator.initialize(); + TestlibFinalizeGuard::registered = true; + + std::string comment = "Validator must be run with the following arguments:" + " [--testset testset]" + " [--group group]" + " [--testOverviewLogFileName fileName]" + " [--testMarkupFileName fileName]" + " [--testCase testCase]" + " [--testCaseFileName fileName]" + ; + + for (int i = 1; i < argc; i++) { + if (!strcmp("--testset", argv[i])) { + if (i + 1 < argc && strlen(argv[i + 1]) > 0) + validator.setTestset(argv[++i]); + else + quit(_fail, comment); + } + if (!strcmp("--group", argv[i])) { + if (i + 1 < argc) + validator.setGroup(argv[++i]); + else + quit(_fail, comment); + } + if (!strcmp("--testOverviewLogFileName", argv[i])) { + if (i + 1 < argc) + validator.setTestOverviewLogFileName(argv[++i]); + else + quit(_fail, comment); + } + if (!strcmp("--testMarkupFileName", argv[i])) { + if (i + 1 < argc) + validator.setTestMarkupFileName(argv[++i]); + else + quit(_fail, comment); + } + if (!strcmp("--testCase", argv[i])) { + if (i + 1 < argc) { + long long testCase = stringToLongLong(inf, argv[++i]); + if (testCase < 1 || testCase >= __TESTLIB_MAX_TEST_CASE) + quit(_fail, format("Argument testCase should be between 1 and %d, but ", __TESTLIB_MAX_TEST_CASE) + + toString(testCase) + " found"); + validator.setTestCase(int(testCase)); + } else + quit(_fail, comment); + } + if (!strcmp("--testCaseFileName", argv[i])) { + if (i + 1 < argc) { + validator.setTestCaseFileName(argv[++i]); + } else + quit(_fail, comment); + } + } +} + +void addFeature(const std::string &feature) { + if (testlibMode != _validator) + quit(_fail, "Features are supported in validators only."); + validator.addFeature(feature); +} + +void feature(const std::string &feature) { + if (testlibMode != _validator) + quit(_fail, "Features are supported in validators only."); + validator.feature(feature); +} + +class Checker { +private: + bool _initialized; + std::string _testset; + std::string _group; + +public: + Checker() : _initialized(false), _testset("tests"), _group() { + } + + void initialize() { + _initialized = true; + } + + std::string testset() const { + if (!_initialized) + __testlib_fail("Checker should be initialized with registerTestlibCmd(argc, argv) instead of registerTestlibCmd() to support checker.testset()"); + return _testset; + } + + std::string group() const { + if (!_initialized) + __testlib_fail("Checker should be initialized with registerTestlibCmd(argc, argv) instead of registerTestlibCmd() to support checker.group()"); + return _group; + } + + void setTestset(const char *const testset) { + _testset = testset; + } + + void setGroup(const char *const group) { + _group = group; + } +} checker; + +void registerTestlibCmd(int argc, char *argv[]) { + __testlib_ensuresPreconditions(); + __testlib_set_testset_and_group(argc, argv); + TestlibFinalizeGuard::registered = true; + + testlibMode = _checker; + __testlib_set_binary(stdin); + + std::vector args(1, argv[0]); + checker.initialize(); + + for (int i = 1; i < argc; i++) { + if (!strcmp("--testset", argv[i])) { + if (i + 1 < argc && strlen(argv[i + 1]) > 0) + checker.setTestset(argv[++i]); + else + quit(_fail, std::string("Expected testset after --testset command line parameter")); + } else if (!strcmp("--group", argv[i])) { + if (i + 1 < argc) + checker.setGroup(argv[++i]); + else + quit(_fail, std::string("Expected group after --group command line parameter")); + } else + args.push_back(argv[i]); + } + + argc = int(args.size()); + if (argc > 1 && "--help" == args[1]) + __testlib_help(); + + if (argc < 4 || argc > 6) { + quit(_fail, std::string("Program must be run with the following arguments: ") + + std::string("[--testset testset] [--group group] [ [<-appes>]]") + + "\nUse \"--help\" to get help information"); + } + + if (argc == 4) { + resultName = ""; + appesMode = false; + } + + if (argc == 5) { + resultName = args[4]; + appesMode = false; + } + + if (argc == 6) { + if ("-APPES" != args[5] && "-appes" != args[5]) { + quit(_fail, std::string("Program must be run with the following arguments: ") + + " [ [<-appes>]]"); + } else { + resultName = args[4]; + appesMode = true; + } + } + + #ifdef BOCA_SUPPORT + inf.init(argv[3], _input); + ouf.init(argv[1], _output); + ans.init(argv[2], _answer); + #else + inf.init(argv[1], _input); + ouf.init(argv[2], _output); + ans.init(argv[3], _answer); + #endif +} + +void registerTestlib(int argc, ...) { + if (argc < 3 || argc > 5) + quit(_fail, std::string("Program must be run with the following arguments: ") + + " [ [<-appes>]]"); + + char **argv = new char *[argc + 1]; + + va_list ap; + va_start(ap, argc); + argv[0] = NULL; + for (int i = 0; i < argc; i++) { + argv[i + 1] = va_arg(ap, char*); + } + va_end(ap); + + registerTestlibCmd(argc + 1, argv); + delete[] argv; +} + +static inline void __testlib_ensure(bool cond, const std::string &msg) { + if (!cond) + quit(_fail, msg.c_str()); +} + +#ifdef __GNUC__ +__attribute__((unused)) +#endif +static inline void __testlib_ensure(bool cond, const char *msg) { + if (!cond) + quit(_fail, msg); +} + +#define ensure(cond) __testlib_ensure(cond, "Condition failed: \"" #cond "\"") +#define STRINGIZE_DETAIL(x) #x +#define STRINGIZE(x) STRINGIZE_DETAIL(x) +#define ensure_ext(cond) __testlib_ensure(cond, "Line " STRINGIZE(__LINE__) ": Condition failed: \"" #cond "\"") + +#ifdef __GNUC__ +__attribute__ ((format (printf, 2, 3))) +#endif +inline void ensuref(bool cond, const char *format, ...) { + if (!cond) { + FMT_TO_RESULT(format, format, message); + __testlib_ensure(cond, message); + } +} + +NORETURN static void __testlib_fail(const std::string &message) { + quitf(_fail, "%s", message.c_str()); +} + +#ifdef __GNUC__ +__attribute__ ((format (printf, 1, 2))) +#endif +void setName(const char *format, ...) { + FMT_TO_RESULT(format, format, name); + checkerName = name; +} + +/* + * Do not use random_shuffle, because it will produce different result + * for different C++ compilers. + * + * This implementation uses testlib random_t to produce random numbers, so + * it is stable. + */ +template +void shuffle(_RandomAccessIter __first, _RandomAccessIter __last) { + if (__first == __last) return; + for (_RandomAccessIter __i = __first + 1; __i != __last; ++__i) + std::iter_swap(__i, __first + rnd.next(int(__i - __first) + 1)); +} + + +template +#if defined(__GNUC__) && !defined(__clang__) +__attribute__ ((error("Don't use random_shuffle(), use shuffle() instead"))) +#endif +void random_shuffle(_RandomAccessIter, _RandomAccessIter) { + quitf(_fail, "Don't use random_shuffle(), use shuffle() instead"); +} + +#ifdef __GLIBC__ +# define RAND_THROW_STATEMENT throw() +#else +# define RAND_THROW_STATEMENT +#endif + +#if defined(__GNUC__) && !defined(__clang__) + +__attribute__ ((error("Don't use rand(), use rnd.next() instead"))) +#endif +#ifdef _MSC_VER +# pragma warning( disable : 4273 ) +#endif +int rand() RAND_THROW_STATEMENT +{ + quitf(_fail, "Don't use rand(), use rnd.next() instead"); + + /* This line never runs. */ + //throw "Don't use rand(), use rnd.next() instead"; +} + +#if defined(__GNUC__) && !defined(__clang__) + +__attribute__ ((error("Don't use srand(), you should use " +"'registerGen(argc, argv, 1);' to initialize generator seed " +"by hash code of the command line params. The third parameter " +"is randomGeneratorVersion (currently the latest is 1)."))) +#endif +#ifdef _MSC_VER +# pragma warning( disable : 4273 ) +#endif +void srand(unsigned int seed) RAND_THROW_STATEMENT +{ + quitf(_fail, "Don't use srand(), you should use " + "'registerGen(argc, argv, 1);' to initialize generator seed " + "by hash code of the command line params. The third parameter " + "is randomGeneratorVersion (currently the latest is 1) [ignored seed=%u].", seed); +} + +void startTest(int test) { + const std::string testFileName = vtos(test); + if (NULL == freopen(testFileName.c_str(), "wt", stdout)) + __testlib_fail("Unable to write file '" + testFileName + "'"); +} + +inline std::string upperCase(std::string s) { + for (size_t i = 0; i < s.length(); i++) + if ('a' <= s[i] && s[i] <= 'z') + s[i] = char(s[i] - 'a' + 'A'); + return s; +} + +inline std::string lowerCase(std::string s) { + for (size_t i = 0; i < s.length(); i++) + if ('A' <= s[i] && s[i] <= 'Z') + s[i] = char(s[i] - 'A' + 'a'); + return s; +} + +inline std::string compress(const std::string &s) { + return __testlib_part(s); +} + +inline std::string englishEnding(int x) { + x %= 100; + if (x / 10 == 1) + return "th"; + if (x % 10 == 1) + return "st"; + if (x % 10 == 2) + return "nd"; + if (x % 10 == 3) + return "rd"; + return "th"; +} + +template +std::string join(_ForwardIterator first, _ForwardIterator last, _Separator separator) { + std::stringstream ss; + bool repeated = false; + for (_ForwardIterator i = first; i != last; i++) { + if (repeated) + ss << separator; + else + repeated = true; + ss << *i; + } + return ss.str(); +} + +template +std::string join(_ForwardIterator first, _ForwardIterator last) { + return join(first, last, ' '); +} + +template +std::string join(const _Collection &collection, _Separator separator) { + return join(collection.begin(), collection.end(), separator); +} + +template +std::string join(const _Collection &collection) { + return join(collection, ' '); +} + +/** + * Splits string s by character separator returning exactly k+1 items, + * where k is the number of separator occurences. + */ +std::vector split(const std::string &s, char separator) { + std::vector result; + std::string item; + for (size_t i = 0; i < s.length(); i++) + if (s[i] == separator) { + result.push_back(item); + item = ""; + } else + item += s[i]; + result.push_back(item); + return result; +} + +/** + * Splits string s by character separators returning exactly k+1 items, + * where k is the number of separator occurences. + */ +std::vector split(const std::string &s, const std::string &separators) { + if (separators.empty()) + return std::vector(1, s); + + std::vector isSeparator(256); + for (size_t i = 0; i < separators.size(); i++) + isSeparator[(unsigned char) (separators[i])] = true; + + std::vector result; + std::string item; + for (size_t i = 0; i < s.length(); i++) + if (isSeparator[(unsigned char) (s[i])]) { + result.push_back(item); + item = ""; + } else + item += s[i]; + result.push_back(item); + return result; +} + +/** + * Splits string s by character separator returning non-empty items. + */ +std::vector tokenize(const std::string &s, char separator) { + std::vector result; + std::string item; + for (size_t i = 0; i < s.length(); i++) + if (s[i] == separator) { + if (!item.empty()) + result.push_back(item); + item = ""; + } else + item += s[i]; + if (!item.empty()) + result.push_back(item); + return result; +} + +/** + * Splits string s by character separators returning non-empty items. + */ +std::vector tokenize(const std::string &s, const std::string &separators) { + if (separators.empty()) + return std::vector(1, s); + + std::vector isSeparator(256); + for (size_t i = 0; i < separators.size(); i++) + isSeparator[(unsigned char) (separators[i])] = true; + + std::vector result; + std::string item; + for (size_t i = 0; i < s.length(); i++) + if (isSeparator[(unsigned char) (s[i])]) { + if (!item.empty()) + result.push_back(item); + item = ""; + } else + item += s[i]; + + if (!item.empty()) + result.push_back(item); + + return result; +} + +NORETURN void __testlib_expectedButFound(TResult result, std::string expected, std::string found, const char *prepend) { + std::string message; + if (strlen(prepend) != 0) + message = format("%s: expected '%s', but found '%s'", + compress(prepend).c_str(), compress(expected).c_str(), compress(found).c_str()); + else + message = format("expected '%s', but found '%s'", + compress(expected).c_str(), compress(found).c_str()); + quit(result, message); +} + +NORETURN void __testlib_expectedButFound(TResult result, double expected, double found, const char *prepend) { + std::string expectedString = removeDoubleTrailingZeroes(format("%.12f", expected)); + std::string foundString = removeDoubleTrailingZeroes(format("%.12f", found)); + __testlib_expectedButFound(result, expectedString, foundString, prepend); +} + +template +#ifdef __GNUC__ +__attribute__ ((format (printf, 4, 5))) +#endif +NORETURN void expectedButFound(TResult result, T expected, T found, const char *prependFormat = "", ...) { + FMT_TO_RESULT(prependFormat, prependFormat, prepend); + std::string expectedString = vtos(expected); + std::string foundString = vtos(found); + __testlib_expectedButFound(result, expectedString, foundString, prepend.c_str()); +} + +template<> +#ifdef __GNUC__ +__attribute__ ((format (printf, 4, 5))) +#endif +NORETURN void +expectedButFound(TResult result, std::string expected, std::string found, const char *prependFormat, ...) { + FMT_TO_RESULT(prependFormat, prependFormat, prepend); + __testlib_expectedButFound(result, expected, found, prepend.c_str()); +} + +template<> +#ifdef __GNUC__ +__attribute__ ((format (printf, 4, 5))) +#endif +NORETURN void expectedButFound(TResult result, double expected, double found, const char *prependFormat, ...) { + FMT_TO_RESULT(prependFormat, prependFormat, prepend); + std::string expectedString = removeDoubleTrailingZeroes(format("%.12f", expected)); + std::string foundString = removeDoubleTrailingZeroes(format("%.12f", found)); + __testlib_expectedButFound(result, expectedString, foundString, prepend.c_str()); +} + +template<> +#ifdef __GNUC__ +__attribute__ ((format (printf, 4, 5))) +#endif +NORETURN void +expectedButFound(TResult result, const char *expected, const char *found, const char *prependFormat, + ...) { + FMT_TO_RESULT(prependFormat, prependFormat, prepend); + __testlib_expectedButFound(result, std::string(expected), std::string(found), prepend.c_str()); +} + +template<> +#ifdef __GNUC__ +__attribute__ ((format (printf, 4, 5))) +#endif +NORETURN void expectedButFound(TResult result, float expected, float found, const char *prependFormat, ...) { + FMT_TO_RESULT(prependFormat, prependFormat, prepend); + __testlib_expectedButFound(result, double(expected), double(found), prepend.c_str()); +} + +template<> +#ifdef __GNUC__ +__attribute__ ((format (printf, 4, 5))) +#endif +NORETURN void +expectedButFound(TResult result, long double expected, long double found, const char *prependFormat, ...) { + FMT_TO_RESULT(prependFormat, prependFormat, prepend); + __testlib_expectedButFound(result, double(expected), double(found), prepend.c_str()); +} + +#if __cplusplus > 199711L || defined(_MSC_VER) +template +struct is_iterable { + template + static char test(typename U::iterator *x); + + template + static long test(U *x); + + static const bool value = sizeof(test(0)) == 1; +}; + +template +struct __testlib_enable_if { +}; + +template +struct __testlib_enable_if { + typedef T type; +}; + +template +typename __testlib_enable_if::value, void>::type __testlib_print_one(const T &t) { + std::cout << t; +} + +template +typename __testlib_enable_if::value, void>::type __testlib_print_one(const T &t) { + bool first = true; + for (typename T::const_iterator i = t.begin(); i != t.end(); i++) { + if (first) + first = false; + else + std::cout << " "; + std::cout << *i; + } +} + +template<> +typename __testlib_enable_if::value, void>::type +__testlib_print_one(const std::string &t) { + std::cout << t; +} + +template +void __println_range(A begin, B end) { + bool first = true; + for (B i = B(begin); i != end; i++) { + if (first) + first = false; + else + std::cout << " "; + __testlib_print_one(*i); + } + std::cout << std::endl; +} + +template +struct is_iterator { + static T makeT(); + + typedef void *twoptrs[2]; + + static twoptrs &test(...); + + template + static typename R::iterator_category *test(R); + + template + static void *test(R *); + + static const bool value = sizeof(test(makeT())) == sizeof(void *); +}; + +template +struct is_iterator::value>::type> { + static const bool value = false; +}; + +template +typename __testlib_enable_if::value, void>::type println(const A &a, const B &b) { + __testlib_print_one(a); + std::cout << " "; + __testlib_print_one(b); + std::cout << std::endl; +} + +template +typename __testlib_enable_if::value, void>::type println(const A &a, const B &b) { + __println_range(a, b); +} + +template +void println(const A *a, const A *b) { + __println_range(a, b); +} + +template<> +void println(const char *a, const char *b) { + __testlib_print_one(a); + std::cout << " "; + __testlib_print_one(b); + std::cout << std::endl; +} + +template +void println(const T &x) { + __testlib_print_one(x); + std::cout << std::endl; +} + +template +void println(const A &a, const B &b, const C &c) { + __testlib_print_one(a); + std::cout << " "; + __testlib_print_one(b); + std::cout << " "; + __testlib_print_one(c); + std::cout << std::endl; +} + +template +void println(const A &a, const B &b, const C &c, const D &d) { + __testlib_print_one(a); + std::cout << " "; + __testlib_print_one(b); + std::cout << " "; + __testlib_print_one(c); + std::cout << " "; + __testlib_print_one(d); + std::cout << std::endl; +} + +template +void println(const A &a, const B &b, const C &c, const D &d, const E &e) { + __testlib_print_one(a); + std::cout << " "; + __testlib_print_one(b); + std::cout << " "; + __testlib_print_one(c); + std::cout << " "; + __testlib_print_one(d); + std::cout << " "; + __testlib_print_one(e); + std::cout << std::endl; +} + +template +void println(const A &a, const B &b, const C &c, const D &d, const E &e, const F &f) { + __testlib_print_one(a); + std::cout << " "; + __testlib_print_one(b); + std::cout << " "; + __testlib_print_one(c); + std::cout << " "; + __testlib_print_one(d); + std::cout << " "; + __testlib_print_one(e); + std::cout << " "; + __testlib_print_one(f); + std::cout << std::endl; +} + +template +void println(const A &a, const B &b, const C &c, const D &d, const E &e, const F &f, const G &g) { + __testlib_print_one(a); + std::cout << " "; + __testlib_print_one(b); + std::cout << " "; + __testlib_print_one(c); + std::cout << " "; + __testlib_print_one(d); + std::cout << " "; + __testlib_print_one(e); + std::cout << " "; + __testlib_print_one(f); + std::cout << " "; + __testlib_print_one(g); + std::cout << std::endl; +} + +/* opts */ + +/** + * A struct for a singular testlib opt, containing the raw string value, + * and a boolean value for marking whether the opt is used. + */ +struct TestlibOpt { + std::string value; + bool used; + + TestlibOpt() : value(), used(false) {} +}; + +/** + * Get the type of opt based on the number of `-` at the beginning and the + * _validity_ of the key name. + * + * A valid key name must start with an alphabetical character. + * + * Returns: 1 if s has one `-` at the beginning, that is, "-keyName". + * 2 if s has two `-` at the beginning, that is, "--keyName". + * 0 otherwise. That is, if s has no `-` at the beginning, or has more + * than 2 at the beginning ("---keyName", "----keyName", ...), or the + * keyName is invalid (the first character is not an alphabetical + * character). + */ +size_t getOptType(char *s) { + if (!s || strlen(s) <= 1) + return 0; + + if (s[0] == '-') { + if (isalpha(s[1])) + return 1; + else if (s[1] == '-') + return isalpha(s[2]) ? 2 : 0; + } + + return 0; +} + +/** + * Parse the opt at a given index, and put it into the opts maps. + * + * An opt can has the following form: + * 1) -keyName=value or --keyName=value (ex. -n=10 --test-count=20) + * 2) -keyName value or --keyName value (ex. -n 10 --test-count 20) + * 3) -kNumval or --kNumval (ex. -n10 --t20) + * 4) -boolProperty or --boolProperty (ex. -sorted --tree-only) + * + * Only the second form consumes 2 arguments. The other consumes only 1 + * argument. + * + * In the third form, the key is a single character, and after the key is the + * value. The value _should_ be a number. + * + * In the forth form, the value is true. + * + * Params: + * - argc and argv: the number of command line arguments and the command line + * arguments themselves. + * - index: the starting index of the opts. + * - opts: the map containing the resulting opt. + * + * Returns: the number of consumed arguments to parse the opt. + * 0 if there is no arguments to parse. + * + * Algorithm details: + * TODO. Please refer to the implementation to see how the code handles the 3rd and 4th forms separately. + */ +size_t parseOpt(size_t argc, char *argv[], size_t index, std::map &opts) { + if (index >= argc) + return 0; + + size_t type = getOptType(argv[index]), inc = 1; + if (type > 0) { + std::string key(argv[index] + type), val; + size_t sep = key.find('='); + if (sep != std::string::npos) { + val = key.substr(sep + 1); + key = key.substr(0, sep); + } else { + if (index + 1 < argc && getOptType(argv[index + 1]) == 0) { + val = argv[index + 1]; + inc = 2; + } else { + if (key.length() > 1 && isdigit(key[1])) { + val = key.substr(1); + key = key.substr(0, 1); + } else { + val = "true"; + } + } + } + opts[key].value = val; + } else { + return inc; + } + + return inc; +} + +/** + * Global list containing all the arguments in the order given in the command line. + */ +std::vector __testlib_argv; + +/** + * Global dictionary containing all the parsed opts. + */ +std::map __testlib_opts; + +/** + * Whether automatic no unused opts ensurement should be done. This flag will + * be turned on when `has_opt` or `opt(key, default_value)` is called. + * + * The automatic ensurement can be suppressed when + * __testlib_ensureNoUnusedOptsSuppressed is true. + */ +bool __testlib_ensureNoUnusedOptsFlag = false; + +/** + * Suppress no unused opts automatic ensurement. Can be set to true with + * `suppressEnsureNoUnusedOpts()`. + */ +bool __testlib_ensureNoUnusedOptsSuppressed = false; + +/** + * Parse command line arguments into opts. + * The results are stored into __testlib_argv and __testlib_opts. + */ +void prepareOpts(int argc, char *argv[]) { + if (argc <= 0) + __testlib_fail("Opts: expected argc>=0 but found " + toString(argc)); + size_t n = static_cast(argc); // NOLINT(hicpp-use-auto,modernize-use-auto) + __testlib_opts = std::map(); + for (size_t index = 1; index < n; index += parseOpt(n, argv, index, __testlib_opts)); + __testlib_argv = std::vector(n); + for (size_t index = 0; index < n; index++) + __testlib_argv[index] = argv[index]; +} + +/** + * An utility function to get the argument with a given index. This function + * also print a readable message when no arguments are found. + */ +std::string __testlib_indexToArgv(int index) { + if (index < 0 || index >= int(__testlib_argv.size())) + __testlib_fail("Opts: index '" + toString(index) + "' is out of range [0," + + toString(__testlib_argv.size()) + ")"); + return __testlib_argv[size_t(index)]; +} + +/** + * An utility function to get the opt with a given key . This function + * also print a readable message when no opts are found. + */ +std::string __testlib_keyToOpts(const std::string &key) { + auto it = __testlib_opts.find(key); + if (it == __testlib_opts.end()) + __testlib_fail("Opts: unknown key '" + compress(key) + "'"); + it->second.used = true; + return it->second.value; +} + +template +T optValueToIntegral(const std::string &s, bool nonnegative); + +long double optValueToLongDouble(const std::string &s); + +std::string parseExponentialOptValue(const std::string &s) { + size_t pos = std::string::npos; + for (size_t i = 0; i < s.length(); i++) + if (s[i] == 'e' || s[i] == 'E') { + if (pos != std::string::npos) + __testlib_fail("Opts: expected typical exponential notation but '" + compress(s) + "' found"); + pos = i; + } + if (pos == std::string::npos) + return s; + std::string e = s.substr(pos + 1); + if (!e.empty() && e[0] == '+') + e = e.substr(1); + if (e.empty()) + __testlib_fail("Opts: expected typical exponential notation but '" + compress(s) + "' found"); + if (e.length() > 20) + __testlib_fail("Opts: expected typical exponential notation but '" + compress(s) + "' found"); + int ne = optValueToIntegral(e, false); + std::string num = s.substr(0, pos); + if (num.length() > 20) + __testlib_fail("Opts: expected typical exponential notation but '" + compress(s) + "' found"); + if (!num.empty() && num[0] == '+') + num = num.substr(1); + optValueToLongDouble(num); + bool minus = false; + if (num[0] == '-') { + minus = true; + num = num.substr(1); + } + for (int i = 0; i < +ne; i++) { + size_t sep = num.find('.'); + if (sep == std::string::npos) + num += '0'; + else { + if (sep + 1 == num.length()) + num[sep] = '0'; + else + std::swap(num[sep], num[sep + 1]); + } + } + for (int i = 0; i < -ne; i++) { + size_t sep = num.find('.'); + if (sep == std::string::npos) + num.insert(num.begin() + int(num.length()) - 1, '.'); + else { + if (sep == 0) + num.insert(num.begin() + 1, '0'); + else + std::swap(num[sep - 1], num[sep]); + } + } + while (!num.empty() && num[0] == '0') + num = num.substr(1); + while (num.find('.') != std::string::npos && num.back() == '0') + num = num.substr(0, num.length() - 1); + if (!num.empty() && num.back() == '.') + num = num.substr(0, num.length() - 1); + if ((!num.empty() && num[0] == '.') || num.empty()) + num.insert(num.begin(), '0'); + return (minus ? "-" : "") + num; +} + +template +T optValueToIntegral(const std::string &s_, bool nonnegative) { + std::string s(parseExponentialOptValue(s_)); + if (s.empty()) + __testlib_fail("Opts: expected integer but '" + compress(s_) + "' found"); + T value = 0; + long double about = 0.0; + signed char sign = +1; + size_t pos = 0; + if (s[pos] == '-') { + if (nonnegative) + __testlib_fail("Opts: expected non-negative integer but '" + compress(s_) + "' found"); + sign = -1; + pos++; + } + for (size_t i = pos; i < s.length(); i++) { + if (s[i] < '0' || s[i] > '9') + __testlib_fail("Opts: expected integer but '" + compress(s_) + "' found"); + value = value * 10 + s[i] - '0'; + about = about * 10 + s[i] - '0'; + } + value *= sign; + about *= sign; + if (fabsl(value - about) > 0.1) + __testlib_fail("Opts: integer overflow: expected integer but '" + compress(s_) + "' found"); + return value; +} + +long double optValueToLongDouble(const std::string &s_) { + std::string s(parseExponentialOptValue(s_)); + if (s.empty()) + __testlib_fail("Opts: expected float number but '" + compress(s_) + "' found"); + long double value = 0.0; + signed char sign = +1; + size_t pos = 0; + if (s[pos] == '-') { + sign = -1; + pos++; + } + bool period = false; + long double mul = 1.0; + for (size_t i = pos; i < s.length(); i++) { + if (s[i] == '.') { + if (period) + __testlib_fail("Opts: expected float number but '" + compress(s_) + "' found"); + else { + period = true; + continue; + } + } + if (period) + mul *= 10.0; + if (s[i] < '0' || s[i] > '9') + __testlib_fail("Opts: expected float number but '" + compress(s_) + "' found"); + if (period) + value += (s[i] - '0') / mul; + else + value = value * 10 + s[i] - '0'; + } + value *= sign; + return value; +} + +/** + * Return true if there is an opt with a given key. + * + * By calling this function, automatic ensurement for no unused opts will be + * done when the program is finalized. Call suppressEnsureNoUnusedOpts() to + * turn it off. + */ +bool has_opt(const std::string &key) { + __testlib_ensureNoUnusedOptsFlag = true; + return __testlib_opts.count(key) != 0; +} + +/* About the followings part for opt with 2 and 3 arguments. + * + * To parse the argv/opts correctly for a give type (integer, floating point or + * string), some meta programming must be done to determine the type of + * the type, and use the correct parsing function accordingly. + * + * The pseudo algorithm for determining the type of T and parse it accordingly + * is as follows: + * + * if (T is integral type) { + * if (T is unsigned) { + * parse the argv/opt as an **unsigned integer** of type T. + * } else { + * parse the argv/opt as an **signed integer** of type T. + * } else { + * if (T is floating point type) { + * parse the argv/opt as an **floating point** of type T. + * } else { + * // T should be std::string + * just the raw content of the argv/opts. + * } + * } + * + * To help with meta programming, some `opt` function with 2 or 3 arguments are + * defined. + * + * Opt with 3 arguments: T opt(true/false is_integral, true/false is_unsigned, index/key) + * + * + The first argument is for determining whether the type T is an integral + * type. That is, the result of std::is_integral() should be passed to + * this argument. When false, the type _should_ be either floating point or a + * std::string. + * + * + The second argument is for determining whether the signedness of the type + * T (if it is unsigned or signed). That is, the result of + * std::is_unsigned() should be passed to this argument. This argument can + * be ignored if the first one is false, because it only applies to integer. + * + * Opt with 2 arguments: T opt(true/false is_floating_point, index/key) + * + The first argument is for determining whether the type T is a floating + * point type. That is, the result of std::is_floating_point() should be + * passed to this argument. When false, the type _should_ be a std::string. + */ + +template +T opt(std::false_type is_floating_point, int index); + +template<> +std::string opt(std::false_type /*is_floating_point*/, int index) { + return __testlib_indexToArgv(index); +} + +template +T opt(std::true_type /*is_floating_point*/, int index) { + return T(optValueToLongDouble(__testlib_indexToArgv(index))); +} + +template +T opt(std::false_type /*is_integral*/, U /*is_unsigned*/, int index) { + return opt(std::is_floating_point(), index); +} + +template +T opt(std::true_type /*is_integral*/, std::false_type /*is_unsigned*/, int index) { + return optValueToIntegral(__testlib_indexToArgv(index), false); +} + +template +T opt(std::true_type /*is_integral*/, std::true_type /*is_unsigned*/, int index) { + return optValueToIntegral(__testlib_indexToArgv(index), true); +} + +template<> +bool opt(std::true_type /*is_integral*/, std::true_type /*is_unsigned*/, int index) { + std::string value = __testlib_indexToArgv(index); + if (value == "true" || value == "1") + return true; + if (value == "false" || value == "0") + return false; + __testlib_fail("Opts: opt by index '" + toString(index) + "': expected bool true/false or 0/1 but '" + + compress(value) + "' found"); +} + +/** + * Return the parsed argv by a given index. + */ +template +T opt(int index) { + return opt(std::is_integral(), std::is_unsigned(), index); +} + +/** + * Return the raw string value of an argv by a given index. + */ +std::string opt(int index) { + return opt(index); +} + +/** + * Return the parsed argv by a given index. If the index is bigger than + * the number of argv, return the given default_value. + */ +template +T opt(int index, const T &default_value) { + if (index >= int(__testlib_argv.size())) { + return default_value; + } + return opt(index); +} + +/** + * Return the raw string value of an argv by a given index. If the index is + * bigger than the number of argv, return the given default_value. + */ +std::string opt(int index, const std::string &default_value) { + return opt(index, default_value); +} + +template +T opt(std::false_type is_floating_point, const std::string &key); + +template<> +std::string opt(std::false_type /*is_floating_point*/, const std::string &key) { + return __testlib_keyToOpts(key); +} + +template +T opt(std::true_type /*is_integral*/, const std::string &key) { + return T(optValueToLongDouble(__testlib_keyToOpts(key))); +} + +template +T opt(std::false_type /*is_integral*/, U, const std::string &key) { + return opt(std::is_floating_point(), key); +} + +template +T opt(std::true_type /*is_integral*/, std::false_type /*is_unsigned*/, const std::string &key) { + return optValueToIntegral(__testlib_keyToOpts(key), false); +} + +template +T opt(std::true_type /*is_integral*/, std::true_type /*is_unsigned*/, const std::string &key) { + return optValueToIntegral(__testlib_keyToOpts(key), true); +} + +template<> +bool opt(std::true_type /*is_integral*/, std::true_type /*is_unsigned*/, const std::string &key) { + if (!has_opt(key)) + return false; + std::string value = __testlib_keyToOpts(key); + if (value == "true" || value == "1") + return true; + if (value == "false" || value == "0") + return false; + __testlib_fail("Opts: key '" + compress(key) + "': expected bool true/false or 0/1 but '" + + compress(value) + "' found"); +} + +/** + * Return the parsed opt by a given key. + */ +template +T opt(const std::string &key) { + return opt(std::is_integral(), std::is_unsigned(), key); +} + +/** + * Return the raw string value of an opt by a given key + */ +std::string opt(const std::string &key) { + return opt(key); +} + +/* Scorer started. */ + +enum TestResultVerdict { + SKIPPED, + OK, + WRONG_ANSWER, + RUNTIME_ERROR, + TIME_LIMIT_EXCEEDED, + IDLENESS_LIMIT_EXCEEDED, + MEMORY_LIMIT_EXCEEDED, + COMPILATION_ERROR, + CRASHED, + FAILED +}; + +std::string serializeVerdict(TestResultVerdict verdict) { + switch (verdict) { + case SKIPPED: return "SKIPPED"; + case OK: return "OK"; + case WRONG_ANSWER: return "WRONG_ANSWER"; + case RUNTIME_ERROR: return "RUNTIME_ERROR"; + case TIME_LIMIT_EXCEEDED: return "TIME_LIMIT_EXCEEDED"; + case IDLENESS_LIMIT_EXCEEDED: return "IDLENESS_LIMIT_EXCEEDED"; + case MEMORY_LIMIT_EXCEEDED: return "MEMORY_LIMIT_EXCEEDED"; + case COMPILATION_ERROR: return "COMPILATION_ERROR"; + case CRASHED: return "CRASHED"; + case FAILED: return "FAILED"; + } + throw "Unexpected verdict"; +} + +TestResultVerdict deserializeTestResultVerdict(std::string s) { + if (s == "SKIPPED") + return SKIPPED; + else if (s == "OK") + return OK; + else if (s == "WRONG_ANSWER") + return WRONG_ANSWER; + else if (s == "RUNTIME_ERROR") + return RUNTIME_ERROR; + else if (s == "TIME_LIMIT_EXCEEDED") + return TIME_LIMIT_EXCEEDED; + else if (s == "IDLENESS_LIMIT_EXCEEDED") + return IDLENESS_LIMIT_EXCEEDED; + else if (s == "MEMORY_LIMIT_EXCEEDED") + return MEMORY_LIMIT_EXCEEDED; + else if (s == "COMPILATION_ERROR") + return COMPILATION_ERROR; + else if (s == "CRASHED") + return CRASHED; + else if (s == "FAILED") + return FAILED; + ensuref(false, "Unexpected serialized TestResultVerdict"); + // No return actually. + return FAILED; +} + +struct TestResult { + int testIndex; + std::string testset; + std::string group; + TestResultVerdict verdict; + double points; + long long timeConsumed; + long long memoryConsumed; + std::string input; + std::string output; + std::string answer; + int exitCode; + std::string checkerComment; +}; + +std::string serializePoints(double points) { + if (std::isnan(points)) + return ""; + else { + char c[64]; + sprintf(c, "%.03lf", points); + return c; + } +} + +double deserializePoints(std::string s) { + if (s.empty()) + return std::numeric_limits::quiet_NaN(); + else { + double result; + ensuref(sscanf(s.c_str(), "%lf", &result) == 1, "Invalid serialized points"); + return result; + } +} + +std::string escapeTestResultString(std::string s) { + std::string result; + for (size_t i = 0; i < s.length(); i++) { + if (s[i] == '\r') + continue; + if (s[i] == '\n') { + result += "\\n"; + continue; + } + if (s[i] == '\\' || s[i] == ';') + result += '\\'; + result += s[i]; + } + return result; +} + +std::string unescapeTestResultString(std::string s) { + std::string result; + for (size_t i = 0; i < s.length(); i++) { + if (s[i] == '\\' && i + 1 < s.length()) { + if (s[i + 1] == 'n') { + result += '\n'; + i++; + continue; + } else if (s[i + 1] == ';' || s[i + 1] == '\\') { + result += s[i + 1]; + i++; + continue; + } + } + result += s[i]; + } + return result; +} + +std::string serializeTestResult(TestResult tr) { + std::string result; + result += std::to_string(tr.testIndex); + result += ";"; + result += escapeTestResultString(tr.testset); + result += ";"; + result += escapeTestResultString(tr.group); + result += ";"; + result += serializeVerdict(tr.verdict); + result += ";"; + result += serializePoints(tr.points); + result += ";"; + result += std::to_string(tr.timeConsumed); + result += ";"; + result += std::to_string(tr.memoryConsumed); + result += ";"; + result += escapeTestResultString(tr.input); + result += ";"; + result += escapeTestResultString(tr.output); + result += ";"; + result += escapeTestResultString(tr.answer); + result += ";"; + result += std::to_string(tr.exitCode); + result += ";"; + result += escapeTestResultString(tr.checkerComment); + return result; +} + +TestResult deserializeTestResult(std::string s) { + std::vector items; + std::string t; + for (size_t i = 0; i < s.length(); i++) { + if (s[i] == '\\') { + t += s[i]; + if (i + 1 < s.length()) + t += s[i + 1]; + i++; + continue; + } else { + if (s[i] == ';') { + items.push_back(t); + t = ""; + } else + t += s[i]; + } + } + items.push_back(t); + + ensuref(items.size() == 12, "Invalid TestResult serialization: expected exactly 12 items"); + + TestResult tr; + size_t pos = 0; + tr.testIndex = stoi(items[pos++]); + tr.testset = unescapeTestResultString(items[pos++]); + tr.group = unescapeTestResultString(items[pos++]); + tr.verdict = deserializeTestResultVerdict(items[pos++]); + tr.points = deserializePoints(items[pos++]); + tr.timeConsumed = stoll(items[pos++]); + tr.memoryConsumed = stoll(items[pos++]); + tr.input = unescapeTestResultString(items[pos++]); + tr.output = unescapeTestResultString(items[pos++]); + tr.answer = unescapeTestResultString(items[pos++]); + tr.exitCode = stoi(items[pos++]); + tr.checkerComment = unescapeTestResultString(items[pos++]); + + return tr; +} + +std::vector readTestResults(std::string fileName) { + std::ifstream stream; + stream.open(fileName.c_str(), std::ios::in); + ensuref(stream.is_open(), "Can't read test results file '%s'", fileName.c_str()); + std::vector result; + std::string line; + while (getline(stream, line)) + if (!line.empty()) + result.push_back(deserializeTestResult(line)); + stream.close(); + return result; +} + +std::function)> __testlib_scorer; + +struct TestlibScorerGuard { + ~TestlibScorerGuard() { + if (testlibMode == _scorer) { + std::vector testResults; + while (!inf.eof()) { + std::string line = inf.readLine(); + if (!line.empty()) + testResults.push_back(deserializeTestResult(line)); + } + inf.readEof(); + printf("%.3f\n", __testlib_scorer(testResults)); + } + } +} __testlib_scorer_guard; + +void registerScorer(int argc, char *argv[], std::function)> scorer) { + /* Supress unused. */ + (void)(argc), (void)(argv); + + __testlib_ensuresPreconditions(); + + testlibMode = _scorer; + __testlib_set_binary(stdin); + + inf.init(stdin, _input); + inf.strict = false; + + __testlib_scorer = scorer; +} + +/* Scorer ended. */ + +/** + * Return the parsed opt by a given key. If no opts with the given key are + * found, return the given default_value. + * + * By calling this function, automatic ensurement for no unused opts will be + * done when the program is finalized. Call suppressEnsureNoUnusedOpts() to + * turn it off. + */ +template +T opt(const std::string &key, const T &default_value) { + if (!has_opt(key)) { + return default_value; + } + return opt(key); +} + +/** + * Return the raw string value of an opt by a given key. If no opts with the + * given key are found, return the given default_value. + * + * By calling this function, automatic ensurement for no unused opts will be + * done when the program is finalized. Call suppressEnsureNoUnusedOpts() to + * turn it off. + */ +std::string opt(const std::string &key, const std::string &default_value) { + return opt(key, default_value); +} + +/** + * Check if all opts are used. If not, __testlib_fail is called. + * Should be used after calling all opt() function calls. + * + * This function is useful when opt() with default_value for checking typos + * in the opt's key. + */ +void ensureNoUnusedOpts() { + for (const auto &opt: __testlib_opts) { + if (!opt.second.used) { + __testlib_fail(format("Opts: unused key '%s'", compress(opt.first).c_str())); + } + } +} + +void suppressEnsureNoUnusedOpts() { + __testlib_ensureNoUnusedOptsSuppressed = true; +} + +void TestlibFinalizeGuard::autoEnsureNoUnusedOpts() { + if (__testlib_ensureNoUnusedOptsFlag && !__testlib_ensureNoUnusedOptsSuppressed) { + ensureNoUnusedOpts(); + } +} + +TestlibFinalizeGuard testlibFinalizeGuard; + +#endif +#endif diff --git a/longest-increasing-subsequence/src/validator.cpp b/longest-increasing-subsequence/src/validator.cpp new file mode 100644 index 0000000..949c63e --- /dev/null +++ b/longest-increasing-subsequence/src/validator.cpp @@ -0,0 +1,18 @@ +#include "testlib.h" +#include + +using namespace std; + + +int main(int argc, char* argv[]) { + registerValidation(argc, argv); + int n = inf.readInt(1, 1e3, "N"); + inf.readEoln(); + for (int i = 0; i < n; i++) { + if (i != 0) inf.readSpace(); + inf.readInt(-1e4, 1e4, "ai"); + } + inf.readEoln(); + inf.readEof(); + return 0; +} \ No newline at end of file diff --git a/longest-increasing-subsequence/statement/description.tex b/longest-increasing-subsequence/statement/description.tex new file mode 100644 index 0000000..880e569 --- /dev/null +++ b/longest-increasing-subsequence/statement/description.tex @@ -0,0 +1,4 @@ +O problema consiste em determinar a maior subsequência crescente de uma sequência de números inteiros. +Uma subsequência é formada ao remover zero ou mais elementos da sequência original, sem alterar a ordem relativa dos elementos restantes. +A subsequência procurada deve conter pelo menos um elemento, e seus valores devem estar em ordem estritamente crescente, isto é, para todos os índices válidos \( i \) e \( j \) pertencentes à subsequência, se \( i < j \) então \( a_i < a_j \). +O objetivo é identificar essa subsequência de tamanho máximo e apresentar tanto o seu comprimento quanto os próprios elementos. diff --git a/longest-increasing-subsequence/statement/input.tex b/longest-increasing-subsequence/statement/input.tex new file mode 100644 index 0000000..d785b5d --- /dev/null +++ b/longest-increasing-subsequence/statement/input.tex @@ -0,0 +1,3 @@ +A entrada é composta por duas linhas. +A primeira linha contém um inteiro \( N \) (\( 1 \leq N \leq 1000 \)), representando o número de elementos da sequência. +A segunda linha contém \( N \) inteiros \( a_1, a_2, \ldots, a_N \) (\( -10^4 \leq a_i \leq 10^4 \)), separados por espaços, correspondentes aos elementos da sequência. diff --git a/longest-increasing-subsequence/statement/notes.tex b/longest-increasing-subsequence/statement/notes.tex new file mode 100644 index 0000000..8a04921 --- /dev/null +++ b/longest-increasing-subsequence/statement/notes.tex @@ -0,0 +1,3 @@ +Para a sequência \( (1, 2, 3, 4, 5) \), toda a sequência já é estritamente crescente, portanto o tamanho da subsequência é \( L = 5 \) e ela contém os mesmos elementos. +Para a sequência \( (2, 3, -1, 4) \), uma das maiores subsequências crescentes possíveis é \( (2, 3, 4) \), com tamanho \( L = 3 \). +Para a sequência \( (0) \), há apenas um elemento, então a maior subsequência crescente é o próprio número \( 0 \), com tamanho \( L = 1 \). diff --git a/longest-increasing-subsequence/statement/output.tex b/longest-increasing-subsequence/statement/output.tex new file mode 100644 index 0000000..8de01aa --- /dev/null +++ b/longest-increasing-subsequence/statement/output.tex @@ -0,0 +1,3 @@ +A saída deve conter duas linhas. +A primeira linha deve conter um único inteiro representando o tamanho \( L \) da maior subsequência crescente. +A segunda linha deve conter \( L \) inteiros \( b_1, b_2, \ldots, b_L \), correspondentes aos elementos dessa subsequência, na mesma ordem em que aparecem na sequência original, separados por um espaço. diff --git a/longest-increasing-subsequence/statement/preamble.tex b/longest-increasing-subsequence/statement/preamble.tex new file mode 100644 index 0000000..e69de29 diff --git a/longest-increasing-subsequence/statement/tutorial.tex b/longest-increasing-subsequence/statement/tutorial.tex new file mode 100644 index 0000000..e69de29