QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#85446#5035. foo~Walking_Dead100 ✓182ms18208kbC++141.7kb2023-03-07 19:26:222023-03-07 19:26:24

Judging History

你现在查看的是最新测评结果

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-03-07 19:26:24]
  • 评测
  • 测评结果:100
  • 用时:182ms
  • 内存:18208kb
  • [2023-03-07 19:26:22]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;

#define MAXN 600005

template <typename T> inline void read (T &x){x = 0;int f = 1;char c = getchar ();while (!isdigit (c)) f *= (c == '-' ? -1 : 1),c = getchar ();while (isdigit (c)) x = x * 10 + c - '0',c = getchar ();x *= f;}
template <typename T,typename ... Args> inline void read (T &x,Args& ... args){read (x),read (args...);}
template <typename T> inline void write (T x){if (x < 0) putchar ('-'),x = -x;if (x > 9) write (x / 10);putchar (x % 10 + '0');}
template <typename T> inline void chkmin (T &a,T b){a = min (a,b);}
template <typename T> inline void chkmax (T &a,T b){a = max (a,b);}

int n,K,ans,top,sta[MAXN],a[MAXN],b[MAXN],pre[MAXN],nxt[MAXN],f[MAXN],g[MAXN];

void solve (){
	sta[top = 0] = 0;
	for (int i = 1;i <= n;++ i){
		while (top && a[i] > a[sta[top]]) top --;
		pre[i] = sta[top],sta[++ top] = i;
	}
	sta[top = 0] = n + 1;
	for (int i = n;i >= 1;-- i){
		while (top && a[i] > a[sta[top]]) top --;
		nxt[i] = sta[top],sta[++ top] = i;
	}
	memset (f,0,sizeof (f));
	for (int t = 1;t <= K;++ t){
		for (int i = 1;i <= n;++ i) g[i] = 0;
		for (int i = 1;i <= n;++ i) chkmax (g[i],f[i - 1] + 1),chkmax (g[nxt[i]],g[i] + 1);
		for (int i = 1,mxv = 0,tmp;i <= n;++ i) tmp = f[i],chkmax (f[i],max (f[pre[i]],mxv) + 1),chkmax (mxv,tmp);
		for (int i = 1;i <= n;++ i) chkmax (g[i],g[i - 1]),chkmax (f[i],g[i]);
	}
	chkmax (ans,f[n]);
}

signed main(){
	read (n,K);
	for (int x = 1;x <= n;++ x) read (a[x]);
	int p = max_element (a + 1,a + n + 1) - a,cnt = 0;
	for (int i = p + 1;i <= n;++ i) b[++ cnt] = a[i];
	for (int i = 1;i <= p;++ i) b[++ cnt] = a[i];
	memcpy (a,b,sizeof (a)),solve (),reverse (a + 1,a + n),solve ();
	write (ans),putchar ('\n');
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 10
Accepted

Test #1:

score: 10
Accepted
time: 1ms
memory: 8124kb

input:

23 6
16 20 22 4 21 10 3 7 5 8 15 12 9 1 6 17 23 13 11 19 18 14 2

output:

20

result:

ok "20"

Test #2:

score: 0
Accepted
time: 2ms
memory: 8088kb

input:

13 6
13 9 3 4 12 6 5 1 8 10 11 7 2

output:

13

result:

ok "13"

Test #3:

score: 0
Accepted
time: 6ms
memory: 8092kb

input:

25 3
25 2 3 19 5 6 7 11 8 10 9 20 4 14 21 1 17 12 13 18 15 22 23 16 24

output:

16

result:

ok "16"

Test #4:

score: 0
Accepted
time: 2ms
memory: 8100kb

input:

25 9
1 11 10 23 9 24 7 8 19 3 5 21 18 12 15 16 17 13 2 20 14 22 4 6 25

output:

23

result:

ok "23"

Test #5:

score: 0
Accepted
time: 2ms
memory: 8096kb

input:

13 2
1 4 2 3 5 6 7 8 9 10 12 11 13

output:

12

result:

ok "12"

Test #6:

score: 0
Accepted
time: 0ms
memory: 8248kb

input:

17 5
4 2 3 6 5 1 7 8 13 16 11 12 9 14 15 10 17

output:

15

result:

ok "15"

Test #7:

score: 0
Accepted
time: 6ms
memory: 8100kb

input:

8 2
1 2 5 6 3 4 7 8

output:

8

result:

ok "8"

Test #8:

score: 0
Accepted
time: 2ms
memory: 8128kb

input:

11 5
3 11 2 10 6 5 1 4 8 7 9

output:

11

result:

ok "11"

Test #9:

score: 0
Accepted
time: 2ms
memory: 8208kb

input:

10 1
5 3 4 1 10 8 9 6 7 2

output:

6

result:

ok "6"

Test #10:

score: 0
Accepted
time: 2ms
memory: 8208kb

input:

16 2
15 12 14 9 11 13 1 3 10 8 5 2 16 4 6 7

output:

9

result:

ok "9"

Test #11:

score: 0
Accepted
time: 2ms
memory: 8040kb

input:

6 3
4 1 5 6 2 3

output:

6

result:

ok "6"

Test #12:

score: 0
Accepted
time: 5ms
memory: 8148kb

input:

1 1
1

output:

1

result:

ok "1"

Test #13:

score: 0
Accepted
time: 1ms
memory: 8092kb

input:

16 5
7 14 13 16 10 1 9 11 3 8 2 4 5 15 12 6

output:

14

result:

ok "14"

Test #14:

score: 0
Accepted
time: 7ms
memory: 8088kb

input:

10 3
10 1 7 2 8 6 9 5 4 3

output:

9

result:

ok "9"

Test #15:

score: 0
Accepted
time: 5ms
memory: 8280kb

input:

23 9
12 11 22 2 5 9 1 4 18 19 17 16 23 20 6 13 8 21 10 7 14 15 3

output:

23

result:

ok "23"

Test #16:

score: 0
Accepted
time: 3ms
memory: 8100kb

input:

15 4
4 3 8 13 12 1 14 9 15 10 7 11 2 6 5

output:

13

result:

ok "13"

Test #17:

score: 0
Accepted
time: 2ms
memory: 8056kb

input:

24 7
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24

output:

24

result:

ok "24"

Test #18:

score: 0
Accepted
time: 1ms
memory: 7984kb

input:

4 2
1 2 3 4

output:

4

result:

ok "4"

Test #19:

score: 0
Accepted
time: 3ms
memory: 8092kb

input:

18 1
1 3 5 7 9 11 13 15 17 18 16 14 12 10 8 6 4 2

output:

10

result:

ok "10"

Test #20:

score: 0
Accepted
time: 2ms
memory: 8092kb

input:

18 2
1 3 5 7 9 11 13 15 17 18 16 14 12 10 8 6 4 2

output:

18

result:

ok "18"

Subtask #2:

score: 10
Accepted

Test #21:

score: 10
Accepted
time: 6ms
memory: 9552kb

input:

93943 1
87243 48984 50611 19218 77699 25025 85769 28141 13380 34875 42459 66419 53472 4367 48292 16894 92171 87263 42527 67085 30687 29235 27515 81053 31421 34864 83591 70491 75344 7026 50250 63402 26773 5330 36308 76399 80032 15501 16205 71750 73964 67876 68901 70548 2043 79979 89479 19784 38838 44...

output:

25

result:

ok "25"

Test #22:

score: 0
Accepted
time: 15ms
memory: 9848kb

input:

112118 1
24338 1586 3 108269 5 53472 80391 70331 9 15335 62487 28331 13 14 16564 94323 36681 108815 32632 44382 21 22 23 24 11758 40070 21518 51991 109983 30 45524 59784 33 2068 62111 36 37 38 39 89031 30508 42 43 16414 110006 34303 47 10331 44651 50 93957 95407 22019 88681 56605 12426 28498 58 59 8...

output:

281

result:

ok "281"

Test #23:

score: 0
Accepted
time: 36ms
memory: 14404kb

input:

391400 1
158965 280194 3 4 5 369036 92293 245923 57403 10 6887 280754 277300 110148 314164 135940 17 46573 126951 111447 301107 22 23 24 25 26 247952 28 342994 339309 23647 350245 33 299608 35 36 37 263236 232063 40 41 42 43 44 39280 46 299122 11961 380375 384513 51 318009 162567 54 55 56 27356 58 6...

output:

693

result:

ok "693"

Test #24:

score: 0
Accepted
time: 37ms
memory: 14876kb

input:

440571 1
243784 2 3 130039 61385 6 7 8 244611 260729 29014 12 326371 416098 15 293728 182717 66822 387603 156910 225815 413135 171756 315815 26444 302419 384825 37746 17634 391896 354575 426625 290920 34 49456 36 161212 212843 39 40 41 436888 43 102088 405279 46 47 77451 49 50 368530 52402 34143 54 ...

output:

665

result:

ok "665"

Test #25:

score: 0
Accepted
time: 23ms
memory: 11804kb

input:

237580 1
1 2 3 4 5 45736 171997 8 235046 10 11 186778 13 14 15 16 17 18 19 20 21 22 23 91724 25 147783 27 125261 29 30 27556 32 108919 76675 35 36 18966 212471 100584 11715 204252 77843 43 176763 18552 46 82644 48 49 50 51 191552 53 232631 160703 114013 69672 75193 59 60 207114 62 63 167312 83372 66...

output:

890

result:

ok "890"

Test #26:

score: 0
Accepted
time: 9ms
memory: 9980kb

input:

108629 1
1 2 3 35575 5 7205 104276 8 9 10 104552 12 13 99818 15 16 17 18 19 16579 21 74459 23 24 25 98758 27 30553 28622 105401 31 32 33 98277 29214 36 37 38 34671 99851 41 42 20159 65626 49334 58829 47 48 15553 50 16448 157 96610 71139 51449 24593 66195 11741 5738 45685 61 76006 91433 64 13205 66 6...

output:

549

result:

ok "549"

Test #27:

score: 0
Accepted
time: 2ms
memory: 8404kb

input:

7474 1
6087 2 3 3276 2246 1022 4790 8 9 10 11 3555 13 14 5187 16 17 18 5222 2852 21 3905 23 2069 25 26 27 6248 29 30 31 32 33 3467 35 5413 37 38 39 40 41 42 43 44 45 46 47 6366 6217 6683 4855 86 6754 7423 55 56 3421 58 7129 6415 2719 964 63 7191 6681 5871 2830 68 1114 70 71 4387 73 74 75 76 77 394 7...

output:

117

result:

ok "117"

Test #28:

score: 0
Accepted
time: 22ms
memory: 13396kb

input:

327474 1
210193 138271 6815 114087 210548 236834 247829 287541 142327 57519 226037 185228 4602 111639 172642 13926 122775 323427 276201 198051 175153 262523 182602 84772 315273 161585 146845 231049 98201 170526 58890 213780 86346 161912 320369 55154 202159 224318 92082 314469 92925 225630 89586 2190...

output:

31

result:

ok "31"

Test #29:

score: 0
Accepted
time: 23ms
memory: 10952kb

input:

170736 1
1312 68283 94512 153956 14227 44793 18760 153190 59267 3745 39898 34452 88526 153153 151245 72089 72230 139449 97869 105574 61308 52310 63909 66185 76461 57922 15750 32965 63821 123214 62562 154258 26229 154847 29694 20613 163634 112566 78733 77415 148297 8311 18695 146847 137996 128167 946...

output:

27

result:

ok "27"

Test #30:

score: 0
Accepted
time: 11ms
memory: 9324kb

input:

70972 1
42126 45376 26395 39090 6557 69493 22740 10263 3057 30503 16364 27796 52951 62922 17830 66723 34385 8039 28194 11087 10500 9835 5892 8917 21894 16673 49698 55082 66683 54472 60557 6953 739 65333 59825 23918 39644 59672 59765 31158 30188 37359 60653 64449 28747 7064 53759 15156 11687 33993 33...

output:

25

result:

ok "25"

Test #31:

score: 0
Accepted
time: 44ms
memory: 15500kb

input:

471980 1
315450 386066 223827 468592 231628 77257 181339 466496 85446 27241 269600 85959 141799 29249 162311 264524 137245 205794 349273 166576 131873 5521 368496 302373 19082 283842 82343 281817 25429 161084 307699 192224 143156 188759 279732 138312 341989 400389 280646 404120 362537 182646 194306 ...

output:

32

result:

ok "32"

Test #32:

score: 0
Accepted
time: 7ms
memory: 10908kb

input:

141837 1
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100...

output:

141837

result:

ok "141837"

Test #33:

score: 0
Accepted
time: 4ms
memory: 8924kb

input:

48198 1
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 ...

output:

48198

result:

ok "48198"

Test #34:

score: 0
Accepted
time: 8ms
memory: 8780kb

input:

28730 1
1 3 5 7 9 11 13 15 17 19 21 23 25 27 29 31 33 35 37 39 41 43 45 47 49 51 53 55 57 59 61 63 65 67 69 71 73 75 77 79 81 83 85 87 89 91 93 95 97 99 101 103 105 107 109 111 113 115 117 119 121 123 125 127 129 131 133 135 137 139 141 143 145 147 149 151 153 155 157 159 161 163 165 167 169 171 173...

output:

14366

result:

ok "14366"

Test #35:

score: 0
Accepted
time: 9ms
memory: 9668kb

input:

89450 1
1 3 5 7 9 11 13 15 17 19 21 23 25 27 29 31 33 35 37 39 41 43 45 47 49 51 53 55 57 59 61 63 65 67 69 71 73 75 77 79 81 83 85 87 89 91 93 95 97 99 101 103 105 107 109 111 113 115 117 119 121 123 125 127 129 131 133 135 137 139 141 143 145 147 149 151 153 155 157 159 161 163 165 167 169 171 173...

output:

44726

result:

ok "44726"

Subtask #3:

score: 20
Accepted

Test #36:

score: 20
Accepted
time: 7ms
memory: 8180kb

input:

1992 25
144 612 1315 1966 1779 1773 1529 625 36 1849 1783 1441 1388 1558 1258 724 137 397 542 353 1162 1213 406 792 1317 882 994 298 1864 1969 103 449 508 1501 89 1721 195 778 657 222 1152 1780 613 743 1206 694 829 142 69 1973 1465 1343 655 1540 155 146 350 491 759 1695 1082 1357 1329 1745 232 1850 ...

output:

237

result:

ok "237"

Test #37:

score: 0
Accepted
time: 0ms
memory: 8128kb

input:

1992 17
785 891 1027 155 773 587 1829 255 1239 1893 1854 158 349 370 1134 1739 1186 11 1099 1149 481 361 1101 1359 1773 1568 157 1011 79 555 254 285 1260 1722 1684 577 1054 1932 590 1804 414 1415 376 1699 26 971 1554 1504 1987 1327 1184 610 652 1432 206 129 315 1390 1946 64 910 962 1189 326 497 1580...

output:

172

result:

ok "172"

Test #38:

score: 0
Accepted
time: 0ms
memory: 8036kb

input:

46 11
41 44 2 9 30 46 28 14 12 20 38 37 19 6 13 7 26 4 34 15 32 5 35 1 25 8 29 45 31 22 18 24 33 42 21 17 39 10 43 11 23 27 36 3 40 16

output:

38

result:

ok "38"

Test #39:

score: 0
Accepted
time: 6ms
memory: 8132kb

input:

53 18
29 23 32 11 24 27 28 16 6 9 3 20 8 38 43 49 18 26 41 53 31 19 48 34 44 52 45 5 30 17 2 13 15 40 1 50 21 14 4 22 51 35 39 7 47 25 10 12 33 42 36 46 37

output:

49

result:

ok "49"

Test #40:

score: 0
Accepted
time: 3ms
memory: 8096kb

input:

55 25
42 41 51 1 6 49 28 12 33 23 31 47 19 24 48 21 54 16 14 3 26 43 18 5 45 29 50 15 44 35 7 40 9 53 10 32 17 36 4 34 20 38 37 8 55 2 11 39 30 22 52 27 13 46 25

output:

55

result:

ok "55"

Test #41:

score: 0
Accepted
time: 3ms
memory: 8096kb

input:

78 9
44 4 68 49 20 16 67 3 70 40 25 6 46 27 65 10 77 55 12 78 2 31 22 71 74 30 41 53 34 47 32 36 57 19 18 1 26 69 11 52 72 14 8 17 56 51 42 43 62 58 35 76 66 23 54 73 63 75 39 37 28 5 9 24 21 48 64 61 29 45 38 13 59 50 15 7 33 60

output:

42

result:

ok "42"

Test #42:

score: 0
Accepted
time: 3ms
memory: 8080kb

input:

17 2
11 4 3 1 5 14 17 8 7 6 2 16 9 10 13 15 12

output:

12

result:

ok "12"

Test #43:

score: 0
Accepted
time: 6ms
memory: 8304kb

input:

1998 17
333 1769 698 1064 655 451 102 8 1306 1092 213 750 1963 1122 759 890 1170 1700 87 820 175 196 1617 370 1693 1993 1927 851 832 864 299 607 1174 1994 1584 1962 1047 1000 1829 164 209 649 942 660 118 1010 1114 1291 1418 1819 540 1861 536 1745 328 1358 1394 677 59 1842 578 257 1776 770 1850 783 9...

output:

172

result:

ok "172"

Test #44:

score: 0
Accepted
time: 3ms
memory: 8284kb

input:

1995 11
781 851 1465 1961 351 876 477 1746 14 1703 68 983 1857 87 551 1314 1877 978 1821 606 244 1269 1638 1062 952 586 735 1302 1190 1644 1554 1328 1614 257 1306 1964 1232 1005 382 335 680 1725 530 1253 903 361 979 1174 1813 1811 557 1123 1580 1445 595 1098 318 1192 1406 297 463 1837 1271 325 1990 ...

output:

126

result:

ok "126"

Test #45:

score: 0
Accepted
time: 6ms
memory: 8068kb

input:

1998 20
344 764 1060 1773 951 1962 1555 1410 1263 985 1665 1666 1010 816 1462 181 1208 1574 142 583 338 1026 1336 1323 1787 134 1397 1177 1632 1445 632 871 1180 1171 716 681 1014 478 1068 1678 620 1379 1799 1256 124 569 112 1432 499 1832 1235 492 690 485 335 1860 1976 1325 1667 1505 1723 1851 1598 9...

output:

199

result:

ok "199"

Test #46:

score: 0
Accepted
time: 1ms
memory: 8116kb

input:

1996 14
1647 582 573 13 273 1391 1373 1996 1526 191 605 1254 1943 1108 1264 1306 1120 642 832 1826 1301 557 761 1170 1117 1688 982 1153 863 1879 1433 1533 981 1570 789 561 189 1830 1075 276 1444 522 168 1595 1140 1522 1532 1314 930 161 478 468 928 1850 439 681 1781 96 1836 446 669 1545 138 1040 180 ...

output:

161

result:

ok "161"

Test #47:

score: 0
Accepted
time: 0ms
memory: 8304kb

input:

1991 5
1932 254 1190 786 1024 1473 617 1462 790 1056 928 1627 1149 1452 300 957 336 1720 1157 592 1241 1750 391 1092 1007 1710 1250 362 127 655 433 876 1776 359 559 109 1053 1267 674 776 1238 1132 1060 608 988 1411 565 1868 1290 1025 1929 1712 1120 1066 1208 1940 1011 1648 980 330 397 1646 360 118 1...

output:

65

result:

ok "65"

Test #48:

score: 0
Accepted
time: 0ms
memory: 8304kb

input:

1999 2
860 1838 1580 1476 996 1339 706 873 1880 1600 1240 1220 1243 232 1690 629 217 1944 1284 1829 1693 749 1298 1342 1045 964 1910 638 697 219 420 1343 681 880 302 1224 1621 521 1988 89 1534 1514 655 1983 1574 1091 410 1881 1842 1062 1496 1739 1194 200 386 936 16 242 1513 187 1025 949 1377 589 180...

output:

33

result:

ok "33"

Test #49:

score: 0
Accepted
time: 3ms
memory: 8120kb

input:

1993 28
1506 46 293 1509 509 379 1928 76 381 1745 1712 805 1172 1908 696 362 1927 1892 1822 534 1233 1665 1100 664 1060 1458 1381 93 119 82 43 292 1360 996 907 1586 1022 1757 1482 1545 1406 303 338 1876 1635 611 1645 1485 1862 218 1303 1002 156 1649 951 1981 1992 1349 305 978 531 1195 1693 1370 1541...

output:

269

result:

ok "269"

Test #50:

score: 0
Accepted
time: 6ms
memory: 8284kb

input:

1996 3
1104 382 1454 599 258 1354 486 1288 1375 1677 413 695 1485 1733 1962 1338 13 17 150 629 937 948 1181 698 141 966 1207 286 651 434 165 519 180 1542 1009 766 1344 1112 1178 1074 1487 1944 1722 1603 1165 648 1054 1568 997 1103 1062 874 1448 750 84 1920 1898 77 1410 388 439 1996 172 807 1647 39 1...

output:

42

result:

ok "42"

Subtask #4:

score: 20
Accepted

Dependency #1:

100%
Accepted

Dependency #3:

100%
Accepted

Test #51:

score: 20
Accepted
time: 2ms
memory: 8148kb

input:

4024 15
1966 1244 3820 1634 1680 2982 3208 338 3458 1278 1663 677 694 3571 1416 2596 3369 201 577 57 3615 2954 385 602 1726 3718 903 3689 803 3000 2137 1690 709 3825 1164 2922 2270 2116 1455 2987 2587 2346 1804 1533 2673 1030 144 2297 3578 3784 2810 1792 1811 3737 2615 3729 2941 1161 2586 907 539 14...

output:

180

result:

ok "180"

Test #52:

score: 0
Accepted
time: 0ms
memory: 8164kb

input:

4572 18
1 4278 3 3749 1981 1801 2351 3247 247 1691 3511 620 13 1800 541 2023 3575 18 526 20 1154 22 2012 24 1655 264 1061 28 29 2202 4307 32 3418 3929 2167 36 37 38 39 40 41 859 43 1431 1682 3258 1147 3638 49 156 743 3225 53 54 55 4099 408 4469 1226 1462 1799 3981 3948 64 65 3386 644 68 3021 2703 71...

output:

411

result:

ok "411"

Test #53:

score: 0
Accepted
time: 2ms
memory: 8176kb

input:

4760 2
1 1962 4349 1537 1669 6 7 8 9 1273 3047 781 13 3338 1618 474 437 18 1466 3000 3392 22 1541 2898 25 946 3557 896 845 30 4323 32 33 3212 2971 1896 541 3170 3666 1067 2436 4334 43 2429 45 4431 1109 813 1510 1878 51 52 1988 2023 55 3565 57 2419 4688 3727 3125 693 4585 64 65 1914 67 140 2478 2347 ...

output:

57

result:

ok "57"

Test #54:

score: 0
Accepted
time: 2ms
memory: 8156kb

input:

1440 13
1 2 3 42 5 6 84 288 1427 1308 1146 861 1006 14 17 258 1416 314 337 20 735 22 1145 1123 1316 26 27 932 1315 550 600 640 33 432 35 531 701 38 971 899 1113 4 43 44 45 87 1407 653 976 50 802 239 1180 1202 195 679 57 58 1360 60 610 1015 1115 64 65 828 803 417 69 70 71 1121 73 257 75 76 281 567 28...

output:

202

result:

ok "202"

Test #55:

score: 0
Accepted
time: 0ms
memory: 8352kb

input:

4788 22
1 2 459 4 389 6 3335 4488 9 4350 218 3346 13 2775 15 16 17 18 19 2440 21 47 2187 4594 25 2223 27 937 29 30 471 32 33 185 4014 36 3045 38 2257 40 41 451 43 1497 45 3364 22 48 2376 50 51 52 955 85 1651 56 2225 58 2711 60 4042 2957 63 2860 65 3595 67 68 69 70 1147 72 1269 1045 2348 76 2982 78 7...

output:

715

result:

ok "715"

Test #56:

score: 0
Accepted
time: 3ms
memory: 8188kb

input:

4059 10
1 2 3 4 2713 3050 1171 2873 9 10 3333 1866 13 3439 15 2844 17 1309 2904 2173 3993 22 3553 24 25 26 27 2135 1890 742 2133 32 33 2802 95 36 37 38 39 1987 176 42 43 3556 45 46 47 48 49 50 51 52 53 54 1520 2475 57 58 59 2658 61 62 63 1546 852 1745 67 2140 69 70 657 942 73 74 75 76 77 78 1487 80 ...

output:

431

result:

ok "431"

Test #57:

score: 0
Accepted
time: 6ms
memory: 8140kb

input:

3051 6
1463 2 3 837 5 6 7 8 1307 2826 11 139 13 14 15 620 1015 18 19 2320 2756 690 23 389 2329 26 1919 28 2824 32 2611 30 1482 2700 727 465 37 931 39 40 41 3003 1155 44 45 46 47 48 49 50 1670 2942 1501 54 55 56 57 58 1713 60 832 62 128 64 65 1299 67 190 69 70 71 2940 2449 74 75 1576 556 78 2482 1767...

output:

297

result:

ok "297"

Test #58:

score: 0
Accepted
time: 0ms
memory: 8112kb

input:

1704 24
1145 844 1271 227 700 1178 167 874 1657 1368 1116 1304 705 1390 123 1687 62 147 627 952 128 1231 750 120 775 984 485 546 195 834 182 395 18 622 848 1222 415 1533 805 1404 404 560 165 1193 492 1488 712 434 954 1246 207 1435 1370 459 837 1492 64 1491 1415 914 1493 1325 692 1141 881 1529 1549 2...

output:

221

result:

ok "221"

Test #59:

score: 0
Accepted
time: 3ms
memory: 8196kb

input:

4169 2
1467 3699 2796 3828 2958 537 3803 625 809 472 341 1990 2244 1018 4158 2250 1449 2792 2607 205 2263 1090 21 1940 3976 1803 1775 3237 96 1798 2846 3955 1101 3570 1249 1821 268 2203 3232 3126 1416 2301 1259 3311 666 2104 2820 2338 2858 1754 2489 2790 2247 1228 961 1600 1156 3276 1175 3097 1371 5...

output:

35

result:

ok "35"

Test #60:

score: 0
Accepted
time: 2ms
memory: 8152kb

input:

3701 29
2878 3264 3586 2297 12 456 2203 3347 2751 3616 847 3424 1877 2520 2860 3247 589 3415 3300 3648 1028 1578 1699 156 1328 2468 2335 207 1917 3095 241 2459 2252 2201 3260 753 3154 324 2278 926 453 1689 3392 812 1886 850 251 1276 163 3249 3410 2150 951 1524 1503 2685 2950 646 2541 1590 216 3344 1...

output:

302

result:

ok "302"

Test #61:

score: 0
Accepted
time: 2ms
memory: 8136kb

input:

604 13
200 6 493 545 206 511 83 311 236 247 377 376 37 178 277 92 561 475 187 262 149 463 127 164 473 313 329 161 95 26 320 87 299 184 459 422 185 309 117 458 485 495 450 547 141 211 598 415 136 447 119 400 284 442 553 297 554 578 106 227 207 406 512 541 190 258 552 99 451 246 7 410 145 449 398 389 ...

output:

116

result:

ok "116"

Test #62:

score: 0
Accepted
time: 7ms
memory: 8120kb

input:

1558 30
1245 1469 1511 344 1200 1403 283 703 1257 616 1249 818 1002 508 1329 1294 1079 104 788 614 391 1099 846 448 1454 716 1516 1336 1536 64 758 11 1190 1518 1180 959 925 1236 1458 405 643 656 676 1341 151 654 1181 1395 1012 634 357 1102 513 160 256 981 1475 476 874 1307 85 1037 617 1072 1417 61 1...

output:

261

result:

ok "261"

Test #63:

score: 0
Accepted
time: 2ms
memory: 8168kb

input:

4810 18
1370 1518 3911 2154 1851 2253 3900 3970 3066 240 3699 742 2056 2532 2888 4168 1190 1997 1687 4714 1212 263 1513 4102 465 997 200 1114 224 1708 4281 4329 3506 1659 2055 1894 1730 3522 3406 459 1076 3772 1807 1814 3339 2155 3966 1745 624 2719 4648 267 3509 3082 2683 2613 1340 501 2413 3372 343...

output:

213

result:

ok "213"

Test #64:

score: 0
Accepted
time: 0ms
memory: 8040kb

input:

3592 7
673 3532 805 3479 2792 2409 2175 2701 1366 3096 2046 839 1368 1852 3437 3021 2144 2933 2836 1632 1488 1100 1916 3208 1607 2906 2216 1533 2993 281 2333 2917 493 142 171 2412 3384 151 61 621 1084 764 2643 2461 1918 1943 1869 1174 1241 3403 2871 1040 1113 2152 247 494 1087 1349 963 190 2437 2193...

output:

97

result:

ok "97"

Test #65:

score: 0
Accepted
time: 2ms
memory: 8156kb

input:

4984 18
2804 3306 2999 4476 3060 2753 1687 4513 3468 900 3581 2425 1332 894 4846 2388 728 2025 4583 4177 4587 3167 766 1602 3678 4968 2135 68 1551 808 234 601 1375 4042 3914 275 4348 3927 1676 734 1538 3937 1905 3439 438 4242 2039 2523 1145 943 3659 3984 1815 3347 2047 4216 2110 1293 213 3529 3634 2...

output:

221

result:

ok "221"

Test #66:

score: 0
Accepted
time: 2ms
memory: 8136kb

input:

2297 19
1758 1422 1308 1147 527 505 621 1383 287 717 1600 2287 734 2122 995 1650 2178 999 1066 2130 2151 1641 195 1335 1298 2187 1886 2119 250 606 96 518 308 966 2034 781 2266 116 2164 1205 1442 483 890 44 1644 1256 370 1351 25 1878 258 1450 91 1606 2137 1822 1084 1230 835 670 2020 1249 2167 1523 18...

output:

203

result:

ok "203"

Test #67:

score: 0
Accepted
time: 3ms
memory: 8164kb

input:

3559 7
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 1...

output:

3559

result:

ok "3559"

Test #68:

score: 0
Accepted
time: 3ms
memory: 8344kb

input:

4288 21
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 ...

output:

4288

result:

ok "4288"

Test #69:

score: 0
Accepted
time: 6ms
memory: 8160kb

input:

4009 8
4008 4009 4007 540 976 2783 1986 2755 1287 1769 2846 1525 2276 3018 1749 1580 1282 2700 2489 2300 3896 2810 397 259 2922 567 1573 1552 923 2814 2879 707 1009 860 2536 2764 2945 3227 167 1350 2857 2078 3145 462 1341 1147 2049 1663 85 1906 568 2395 2728 3657 352 1022 2584 913 1571 499 2351 1106...

output:

116

result:

ok "116"

Test #70:

score: 0
Accepted
time: 3ms
memory: 8176kb

input:

4801 18
4800 4801 4799 4439 315 737 3783 141 925 4166 4388 484 3480 3410 356 2794 2286 4281 3912 2908 1998 953 3684 4331 3049 4049 2109 3453 3360 4112 3347 2496 245 1436 25 4720 168 2871 1108 3191 1150 1473 3948 3046 2377 292 128 3836 2709 2451 1667 4167 3831 560 2741 4144 2459 577 3335 4619 3251 37...

output:

217

result:

ok "217"

Subtask #5:

score: 20
Accepted

Dependency #4:

100%
Accepted

Test #71:

score: 20
Accepted
time: 9ms
memory: 8508kb

input:

24258 28
16195 14873 33 20006 1896 3981 12124 22472 12277 6101 3559 6639 14935 11928 19344 3302 16586 6903 10338 17710 19716 18018 6246 11333 23567 20753 10585 1582 11474 3359 20357 13618 21666 20150 2028 1688 22377 4728 5493 13805 19466 18819 5193 22600 10853 20085 47 9955 20582 13589 4626 11433 23...

output:

413

result:

ok "413"

Test #72:

score: 0
Accepted
time: 2ms
memory: 8260kb

input:

3156 27
445 103 37 1677 5 1947 7 8 1691 10 11 1406 13 14 1394 16 2369 292 19 2394 2212 22 2144 2428 25 26 1105 149 127 2175 442 32 33 573 2261 1956 903 38 39 40 41 1509 740 975 45 1734 47 48 1445 2634 898 52 1844 602 55 56 2865 58 595 861 182 2231 1605 2427 774 2240 2089 2468 1321 70 71 1263 2815 27...

output:

406

result:

ok "406"

Test #73:

score: 0
Accepted
time: 10ms
memory: 8692kb

input:

41178 13
8425 2 3 4 5 6 19390 26907 3622 10 32560 12 15978 23241 16104 8542 398 16767 26810 32686 21 40230 27390 34359 21750 26793 32491 22256 27250 25068 21940 28325 40332 8054 25231 36 37 38 39 14380 24107 33145 43 44 45 46 36972 48 49 28416 12079 12444 53 54 6168 56 26529 58 59 15989 24997 23328 ...

output:

686

result:

ok "686"

Test #74:

score: 0
Accepted
time: 14ms
memory: 9004kb

input:

48172 12
1 2535 3 4 5 46640 41991 30108 32240 37217 11 2161 34351 2669 30969 30285 38372 4777 19 4204 21 22 45173 24 6616 28543 27 15731 9792 43631 13959 32 38713 6329 47486 26638 37 5311 39 5338 5404 42 43 33271 45 21708 24996 12181 47728 5527 7000 16661 40503 34647 55 33106 57 23527 3642 14248 390...

output:

642

result:

ok "642"

Test #75:

score: 0
Accepted
time: 3ms
memory: 8212kb

input:

7162 4
1 498 3 4 5 6 7 8 9 10 11 12 5697 14 15 16 2016 18 19 20 5858 22 850 24 2141 4198 27 2524 5608 30 31 32 33 34 35 1794 37 38 39 40 41 401 43 652 4854 46 6979 48 6643 50 4676 2447 53 54 55 4388 4353 51 59 60 5089 2960 63 64 65 5748 67 68 69 70 71 6524 2183 74 75 2498 77 887 2489 6307 81 4139 83...

output:

350

result:

ok "350"

Test #76:

score: 0
Accepted
time: 15ms
memory: 8712kb

input:

39950 23
4812 1856 3 35730 28893 6 38841 8 6149 10 11 4584 13 33130 15325 16 17 18 19 13038 21 31497 23 24 25 34094 29410 3358 29 30 31 32 33 34 35 36 37 38 37474 25171 41 42 43 44 10303 3393 1 48 16141 9152 51 52 53 54 28662 14656 57 58 30254 60 61 8567 28390 64 65 66 37732 68 69 70 71 3303 73 74 7...

output:

1898

result:

ok "1898"

Test #77:

score: 0
Accepted
time: 2ms
memory: 8392kb

input:

18719 6
1 2 18558 1548 10235 6 7 8 9 10 11 12 13 14 7425 10806 12782 18 19 8889 21 22 5096 200 25 26 27 3724 29 30 31 32 33 5363 35 1939 37 38 18316 40 41 3092 43 44 45 16065 7170 5483 17242 50 51 52 53 5700 4993 15478 57 58 59 60 61 62 63 8809 65 66 67 68 69 443 71 7121 73 14137 75 76 5912 9097 79 ...

output:

856

result:

ok "856"

Test #78:

score: 0
Accepted
time: 4ms
memory: 8604kb

input:

29580 18
14519 6399 18739 15980 12705 6533 2801 6584 4323 9308 16421 28784 8987 7931 15263 19253 22842 10800 26480 1468 12254 4140 23786 12144 22398 2302 11446 21712 7086 27483 398 18793 28098 5912 1115 5020 7035 13954 1855 12404 21961 22937 7844 11902 24727 25544 87 5292 8586 18210 5009 10139 22864...

output:

302

result:

ok "302"

Test #79:

score: 0
Accepted
time: 3ms
memory: 8408kb

input:

10018 2
25 4540 8967 2333 4043 8904 8482 235 7570 8778 2362 5430 8192 7331 7604 7867 5415 7448 8010 5465 5025 8054 8951 8623 7014 7669 1356 5632 4081 3921 933 227 6349 8798 6205 9285 182 6015 3076 6959 6650 7305 4860 3824 8883 6488 8503 3319 8296 6263 4131 5613 682 4434 7657 4459 6539 5393 948 4403 ...

output:

39

result:

ok "39"

Test #80:

score: 0
Accepted
time: 6ms
memory: 8500kb

input:

28932 6
3089 18681 1254 9140 2854 24238 19780 19149 22279 687 19608 17644 6984 3881 4210 24404 19264 10701 22925 19183 5240 7945 20476 7232 23630 28074 22046 13011 16764 15838 21817 11790 23126 9858 14253 16674 17952 21204 27548 28854 2686 3037 22513 6678 14241 1981 23540 24564 24237 17967 22606 160...

output:

117

result:

ok "117"

Test #81:

score: 0
Accepted
time: 6ms
memory: 8116kb

input:

1203 2
759 211 717 650 1094 319 606 172 359 464 112 259 305 372 608 400 684 385 296 263 707 142 175 841 40 353 553 732 824 529 1009 51 1004 1190 628 1058 1145 883 625 477 842 927 821 202 660 76 457 97 765 906 365 442 488 412 301 378 940 1175 817 429 762 928 819 479 24 189 600 662 695 1184 1158 1151 ...

output:

29

result:

ok "29"

Test #82:

score: 0
Accepted
time: 10ms
memory: 8640kb

input:

35579 18
19170 25227 4776 24924 10922 1445 3003 7913 31734 19041 35050 25211 25419 25806 18536 33556 7340 6806 27293 17703 17665 136 22870 28353 4712 23075 9259 3916 9834 2690 13323 12163 8248 32847 479 3387 16065 34090 32504 5285 5844 15382 25020 9876 3433 25522 34519 9192 11429 12714 29683 30415 2...

output:

314

result:

ok "314"

Test #83:

score: 0
Accepted
time: 5ms
memory: 8244kb

input:

8475 29
7682 887 7496 806 8283 1332 2273 2312 2678 6892 422 7867 237 7582 489 1014 1482 61 1518 254 4434 6069 4802 2834 1438 4788 6305 5925 3037 5046 7677 6081 7155 1071 2382 2452 6260 4931 4352 7627 4761 7041 5962 2798 6405 1481 1174 5392 7360 6915 2319 2863 1817 1834 3302 6985 8162 2384 1133 1208 ...

output:

363

result:

ok "363"

Test #84:

score: 0
Accepted
time: 3ms
memory: 8316kb

input:

2836 25
1543 1390 2556 161 1058 413 1847 947 2058 2805 1819 848 1635 2579 1409 1239 450 2248 1161 2007 515 1218 2491 1358 1383 1227 789 1138 1253 1177 397 2534 2320 2105 209 1430 742 1150 2074 811 855 1844 1410 1814 1664 1307 1188 2833 1483 611 2457 546 2727 1662 974 2131 843 2715 1973 1505 1275 753...

output:

259

result:

ok "259"

Test #85:

score: 0
Accepted
time: 9ms
memory: 8796kb

input:

44426 18
32852 42617 3656 30129 32589 19100 24472 12277 5422 20837 8419 34639 40506 20199 19187 1450 43543 12891 20696 31711 39801 7773 33559 9591 36649 14553 40633 12880 29190 10745 29247 72 42882 33691 36891 42193 16933 7813 35865 3168 2123 24249 32935 12646 40649 33682 2890 4229 36433 26445 13050...

output:

314

result:

ok "314"

Test #86:

score: 0
Accepted
time: 2ms
memory: 8120kb

input:

2126 29
658 721 381 636 145 591 1459 116 96 1329 2033 626 862 1798 1357 1727 271 134 922 1184 766 311 473 1017 1262 1978 1979 1188 1380 1827 548 1390 1011 1294 1939 1998 1465 686 499 1117 1003 301 996 225 212 1803 1213 1984 2086 1368 1081 1564 919 1637 223 39 2036 1977 1095 680 1194 1069 2121 1099 1...

output:

268

result:

ok "268"

Test #87:

score: 0
Accepted
time: 3ms
memory: 8368kb

input:

13676 3
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 ...

output:

13676

result:

ok "13676"

Test #88:

score: 0
Accepted
time: 9ms
memory: 9120kb

input:

46494 2
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 ...

output:

46494

result:

ok "46494"

Test #89:

score: 0
Accepted
time: 9ms
memory: 8868kb

input:

49818 7
49817 49818 49816 33052 5536 1092 2927 39341 49756 20060 43582 5595 34923 9128 37275 38020 1153 922 14357 26889 26308 37379 3054 32758 3448 11325 13065 41169 2116 41852 13850 27942 29862 21585 17451 48614 21670 6831 12797 37509 15023 21239 5707 44759 41572 33199 24931 23651 22500 23226 8649 ...

output:

145

result:

ok "145"

Test #90:

score: 0
Accepted
time: 18ms
memory: 9048kb

input:

49282 24
49281 49282 49280 5587 36390 3923 46396 37114 4310 44718 8153 15792 15463 18103 2420 23372 33221 43247 2062 43570 13826 2843 27706 27597 5489 23952 38834 4059 43794 157 45228 44959 24269 21678 32915 44913 21011 35638 26242 30095 36907 16885 33890 39272 27565 20580 25219 30411 26601 40083 32...

output:

413

result:

ok "413"

Subtask #6:

score: 20
Accepted

Dependency #2:

100%
Accepted

Dependency #5:

100%
Accepted

Test #91:

score: 20
Accepted
time: 6ms
memory: 8852kb

input:

48545 8
13498 42489 26830 26915 4714 38759 28009 9621 27595 8069 31935 13674 6728 3198 5508 37974 5372 36129 34433 22443 42244 27355 29611 9156 38806 18505 37889 7165 38932 6445 10334 12156 6173 13445 47054 42715 32099 26656 44414 37151 45966 21782 14480 29772 16610 46275 24790 14850 11899 17390 758...

output:

153

result:

ok "153"

Test #92:

score: 0
Accepted
time: 20ms
memory: 13812kb

input:

368741 2
6747 137488 187527 169657 212594 6 226823 56409 9 242612 339738 12 353304 14 179943 16 119809 204316 19 219812 293837 174747 336748 24 25 365013 125653 215395 29 30 348908 32 33 330591 138195 17271 37 86997 318755 96997 96633 3357 43 220612 76403 18522 47 48 311590 50 51 52 85398 180909 499...

output:

829

result:

ok "829"

Test #93:

score: 0
Accepted
time: 24ms
memory: 12952kb

input:

298523 1
92001 10609 3 263080 82597 6 7 8 9 288733 219502 53922 250568 169516 15 22305 17 18 19 20 32300 62621 23 251491 261937 280622 171399 28 33611 208337 49541 185551 175390 34 106155 36 37 197752 85174 94659 204540 270568 142747 127219 197476 28197 47 127985 160867 50 60482 255536 49534 215727 ...

output:

415

result:

ok "415"

Test #94:

score: 0
Accepted
time: 58ms
memory: 14036kb

input:

367797 13
145245 2 359420 111257 5 358051 165513 8 283077 94388 11 4758 223865 14 15 16 260678 116582 27202 20 269757 22 23 172014 242692 26 27 56415 196281 363808 84657 32 33 34 20822 36 37 240502 39 40 41 42 43 44 45 46 47 332027 81174 50 188326 52 53 54 55 56 57 58 115502 143731 61 48903 63 64 65...

output:

2187

result:

ok "2187"

Test #95:

score: 0
Accepted
time: 13ms
memory: 9256kb

input:

61835 24
49960 12266 43513 4 5 6 7 8 9 10 11 12 13 36314 9465 16 17 59373 19 20 50921 18775 23 24 25 14452 27 28 52430 30 31 32 33 15776 35 36 37 38 39 175 37854 38154 43 5337 45 48403 49368 61039 49 50 51 52 45829 54 55 18426 21534 58 59 60 61 62 63 64 65 66 67 68 69 70 57872 3191 73 8212 75 76 77 ...

output:

2508

result:

ok "2508"

Test #96:

score: 0
Accepted
time: 34ms
memory: 12176kb

input:

249135 6
1 2 3 175478 109531 6 86645 8 9 61194 241138 12 13 14 15 16 27700 18 19 142014 241496 50194 23 146652 109477 26 27 28 29 30 31 32 131113 3464 144343 36 32977 38 39 40 41 42 18379 44 45 46 226447 189123 169640 50 51 52 55209 54 55 3357 196091 88570 59 60 212362 17418 200448 64 65 82771 11056...

output:

2190

result:

ok "2190"

Test #97:

score: 0
Accepted
time: 46ms
memory: 16716kb

input:

553288 2
311674 2 194267 481369 5 465462 388029 18389 9 207632 23919 12 302313 14 15 92430 17 18 19 20 21 22 244741 24 494961 217836 27 28 29 109970 31 32 33 34 35 36 114590 410590 39 480571 41 174956 43 44 412116 46 112284 359759 328768 48936 51 52 53 87956 55 92484 57 58 59 52501 61 62 249950 7630...

output:

1634

result:

ok "1634"

Test #98:

score: 0
Accepted
time: 55ms
memory: 14524kb

input:

411674 8
118891 321153 6309 248913 264998 139995 396775 354778 202694 267680 35070 345938 224224 29222 301517 331014 111245 356979 390339 197274 300505 340044 61827 71701 20076 360081 52973 318122 211083 281861 8843 140186 62431 178468 258984 304248 278863 68428 97248 116089 6568 157807 357329 30630...

output:

203

result:

ok "203"

Test #99:

score: 0
Accepted
time: 105ms
memory: 15460kb

input:

467724 23
16006 286454 55720 432255 422501 123443 358776 149239 191455 9414 467333 394026 463951 184034 34260 320651 57838 121901 130946 18510 360686 318667 90216 284163 304334 458504 140209 423700 227765 294907 261777 23180 85287 426817 431822 74509 360798 253432 454055 251442 101999 342427 268696 ...

output:

529

result:

ok "529"

Test #100:

score: 0
Accepted
time: 78ms
memory: 12892kb

input:

305115 26
35162 62035 4914 197971 278463 178165 49566 278490 40902 56130 211876 168539 57395 244964 96838 98661 28862 49087 256106 92263 193490 250776 50198 149762 62499 86600 85310 191614 133523 69898 14224 72740 293935 217639 117455 183973 166242 107584 282124 28684 73845 304603 45245 142475 11813...

output:

563

result:

ok "563"

Test #101:

score: 0
Accepted
time: 73ms
memory: 14148kb

input:

381222 14
4234 276110 303611 36826 130476 223094 287921 127894 186940 105055 172048 153822 92001 120133 159731 246718 315347 178142 215812 341631 42096 86160 248428 124157 159104 116210 118201 115102 255012 63894 337011 364681 111642 45091 298870 189872 86832 121650 236704 235610 357496 112067 28145...

output:

325

result:

ok "325"

Test #102:

score: 0
Accepted
time: 45ms
memory: 12228kb

input:

264822 13
129659 146095 132328 234297 147191 64308 243408 73132 44881 37902 98643 31964 149449 157728 139247 178193 188703 91723 224993 170997 224454 160714 156330 58519 168983 120822 164627 69505 251221 8740 90698 11345 259555 249159 234198 235150 251665 127610 212390 263423 153282 57883 1327 46073...

output:

299

result:

ok "299"

Test #103:

score: 0
Accepted
time: 46ms
memory: 11704kb

input:

230977 12
124816 35834 119788 6685 88654 122727 139825 61521 108786 201622 42634 19618 78022 119403 20412 217068 108175 139435 107877 9994 46614 194220 208416 54054 96895 40493 67196 27955 183458 30365 76723 36050 225758 183724 220322 134293 70758 41591 130335 9246 136067 176029 2869 17527 197730 16...

output:

280

result:

ok "280"

Test #104:

score: 0
Accepted
time: 172ms
memory: 17456kb

input:

599743 30
196288 106394 358009 355266 142691 302386 268039 157710 362540 262345 38785 428265 382084 558296 3309 552578 554233 595192 171671 532564 322179 564193 319766 147079 252681 480547 499554 448483 197931 10073 373275 173344 579238 565409 332572 91997 489076 230288 49910 433040 290306 440858 39...

output:

708

result:

ok "708"

Test #105:

score: 0
Accepted
time: 177ms
memory: 17456kb

input:

599969 30
207761 183014 273654 91368 349441 463938 576498 325510 427120 311086 19900 280388 21159 547748 141010 242632 367572 279145 424465 79163 219853 513705 527203 112174 237173 439296 189968 26903 405464 196739 69712 476359 351579 350313 304083 525463 66115 160772 293925 171773 297550 475745 311...

output:

686

result:

ok "686"

Test #106:

score: 0
Accepted
time: 168ms
memory: 17444kb

input:

599496 30
167258 102729 401811 77577 547212 306282 315734 454261 565455 57889 316842 376045 65037 581864 555418 552074 454783 560576 284018 343180 291128 465572 465358 255606 254152 375184 409516 8062 457320 71717 471810 65192 305132 38044 272370 393678 154616 155023 209864 359485 344541 406372 5163...

output:

696

result:

ok "696"

Test #107:

score: 0
Accepted
time: 167ms
memory: 17472kb

input:

599805 30
195 359 508 163 601 105 383 342 224 308 86 444 184 289 64 600 434 471 489 417 500 573 533 456 544 381 420 158 396 322 270 439 318 602 122 186 380 509 50 104 511 117 583 164 409 457 591 174 142 297 135 14 594 334 256 74 35 25 585 430 517 498 512 429 486 375 559 149 556 70 427 130 4 173 94 1...

output:

7590

result:

ok "7590"

Test #108:

score: 0
Accepted
time: 178ms
memory: 17628kb

input:

599478 30
41 66 30 1 10 65 64 9 40 16 26 48 62 29 7 42 3 22 54 45 35 13 59 36 47 55 44 57 63 20 60 39 34 53 56 11 25 37 32 14 17 50 18 19 31 58 6 27 21 38 15 4 49 33 24 8 28 5 46 12 23 51 52 2 43 61 89 96 95 111 118 97 72 77 100 78 73 120 117 90 82 85 122 92 69 105 68 112 76 74 101 104 81 110 83 102...

output:

47168

result:

ok "47168"

Test #109:

score: 0
Accepted
time: 167ms
memory: 17760kb

input:

599424 30
36 14 12 11 3 22 34 32 28 2 16 29 15 10 35 8 26 9 30 19 17 31 13 33 4 6 23 20 7 18 5 1 25 21 27 24 37 50 51 42 47 38 54 39 46 49 56 40 43 41 48 52 45 55 57 44 53 64 71 59 65 63 68 69 77 61 62 66 72 60 70 73 78 67 75 76 58 74 95 101 94 114 89 108 93 91 87 79 99 96 82 100 103 113 112 80 98 8...

output:

79766

result:

ok "79766"

Test #110:

score: 0
Accepted
time: 182ms
memory: 17492kb

input:

599745 30
5536 3796 4967 3141 495 5777 2781 3704 1709 4156 119 3544 87 2949 1961 4172 4710 2247 1535 5344 2856 995 2278 2877 757 2942 4163 5736 5936 4807 3191 2524 4601 5146 606 4385 900 5676 1997 148 4650 4104 2532 5678 2587 3687 3595 5952 3992 3409 4787 2819 2721 1551 1630 4010 2282 4613 5473 3167...

output:

1540

result:

ok "1540"

Test #111:

score: 0
Accepted
time: 176ms
memory: 17508kb

input:

599843 30
183 208 175 34 140 141 163 170 4 158 45 38 200 91 67 247 136 179 191 126 89 248 252 118 105 30 161 233 94 70 256 24 54 122 92 160 142 2 61 53 197 32 85 116 132 148 238 224 47 103 243 228 262 156 154 95 111 144 196 13 181 186 21 41 58 159 125 78 113 254 152 107 48 40 165 63 218 242 5 226 20...

output:

14561

result:

ok "14561"

Test #112:

score: 0
Accepted
time: 179ms
memory: 17652kb

input:

599909 30
6 22 49 27 11 13 41 42 20 12 43 15 35 37 24 7 38 16 28 4 39 34 21 32 36 50 19 26 53 40 52 29 2 30 9 1 47 45 10 44 18 5 14 25 51 3 46 31 33 48 17 23 8 79 97 74 54 99 92 69 93 89 64 58 82 55 68 80 90 56 81 57 67 100 95 98 76 70 86 73 62 94 85 102 66 91 96 59 75 63 84 60 103 65 72 83 77 71 61...

output:

51196

result:

ok "51196"

Test #113:

score: 0
Accepted
time: 8ms
memory: 8624kb

input:

30326 23
27427 2816 16188 8042 29522 6337 10130 11939 14311 29702 25807 22042 21890 14708 7966 6541 21957 19512 27930 5456 1002 11637 24282 27071 17191 6198 23677 1957 13106 10094 11894 27000 27101 21256 22157 13216 18895 2587 19591 7034 29453 29500 491 6134 27718 13446 13185 11246 2889 17400 387 24...

output:

378

result:

ok "378"

Test #114:

score: 0
Accepted
time: 165ms
memory: 18208kb

input:

599836 30
4 10 5 8 15 13 2 16 11 14 6 7 9 3 12 1 18 26 22 23 27 21 20 28 24 17 25 19 29 32 31 35 33 30 34 39 38 40 36 37 41 48 50 42 49 46 57 55 54 58 47 53 43 51 56 52 45 44 79 72 60 75 66 59 67 61 65 73 63 71 64 78 76 70 69 74 68 62 77 83 82 89 86 87 80 81 84 85 88 91 99 96 94 90 95 100 97 98 92 9...

output:

153352

result:

ok "153352"

Test #115:

score: 0
Accepted
time: 165ms
memory: 17560kb

input:

599536 30
102 75 88 31 80 139 47 65 58 8 137 67 27 141 43 5 71 128 7 46 138 163 56 35 63 152 74 110 143 17 165 105 162 95 118 81 11 77 76 55 62 45 44 85 120 21 86 89 1 129 66 60 12 140 154 124 70 116 37 10 147 84 153 167 29 22 18 82 68 119 52 108 19 166 96 114 111 99 126 87 121 32 20 33 117 14 157 6...

output:

19634

result:

ok "19634"

Test #116:

score: 0
Accepted
time: 162ms
memory: 17708kb

input:

599680 29
81 26 13 12 6 51 71 34 78 53 54 4 50 41 56 59 40 69 83 37 72 25 5 67 57 31 28 35 63 29 39 32 17 9 79 75 23 22 60 3 43 55 2 68 73 76 49 44 58 38 52 15 74 45 84 30 14 46 7 19 27 33 8 48 80 70 1 66 47 77 62 82 36 64 61 42 16 20 10 11 21 24 18 65 123 174 178 128 150 168 142 125 180 109 126 124...

output:

37865

result:

ok "37865"

Test #117:

score: 0
Accepted
time: 166ms
memory: 17632kb

input:

599279 29
2593 4941 5455 2040 3571 2299 2866 4427 1430 6890 5489 683 3971 3745 1637 6079 703 2795 5147 885 682 6345 4230 2627 1977 5114 7773 488 7060 5862 231 1343 995 440 7340 5665 2056 1902 6156 475 4347 2974 6055 6313 2512 3872 3010 2631 4048 6708 2882 4875 782 319 2952 6906 2717 6105 6990 6772 4...

output:

1289

result:

ok "1289"

Test #118:

score: 0
Accepted
time: 176ms
memory: 17404kb

input:

599166 30
4069 1453 6829 7445 6558 3169 5536 2843 6635 5734 4726 5593 4836 5612 3318 295 3394 2952 5888 3470 6800 1026 4285 49 31 5545 3348 713 3612 2125 5705 5789 6181 374 7460 3099 6464 2299 5549 6 7680 3218 2535 5605 2162 2531 6609 7442 1362 6769 5543 4724 5607 5547 2948 6513 2476 193 3092 5940 3...

output:

1286

result:

ok "1286"

Test #119:

score: 0
Accepted
time: 174ms
memory: 17624kb

input:

599684 29
156 26 69 244 96 110 76 113 148 58 200 68 73 41 56 35 99 15 72 48 259 38 205 85 124 31 102 44 151 24 240 92 174 169 201 231 66 117 134 60 22 29 125 197 185 219 52 116 188 122 225 146 172 5 215 112 179 98 51 154 54 59 37 132 123 119 217 222 105 87 77 90 86 42 27 245 50 143 93 252 163 2 145 ...

output:

14658

result:

ok "14658"

Test #120:

score: 0
Accepted
time: 166ms
memory: 17484kb

input:

600000 30
26 115 488 50 503 278 219 471 82 263 195 275 489 541 325 118 194 414 31 534 531 28 165 364 385 381 222 390 80 169 572 530 261 93 75 156 392 193 13 84 128 519 234 250 159 90 564 349 532 184 477 442 461 200 401 394 268 478 212 561 204 60 473 116 304 227 514 570 480 457 554 300 47 244 433 518...

output:

7507

result:

ok "7507"

Test #121:

score: 0
Accepted
time: 159ms
memory: 17668kb

input:

599298 29
19 53 24 20 11 18 49 34 14 52 25 5 26 40 50 41 44 16 39 37 46 38 6 12 10 33 43 21 7 29 13 42 47 1 54 48 8 23 30 51 32 28 9 2 45 17 31 22 27 36 35 15 4 3 55 88 56 64 91 99 102 93 87 70 83 69 74 65 62 85 89 97 94 92 80 84 100 58 73 68 81 61 95 75 79 86 101 60 98 67 82 77 66 71 63 96 90 59 72...

output:

47094

result:

ok "47094"

Test #122:

score: 0
Accepted
time: 170ms
memory: 17464kb

input:

599042 30
455 49 369 164 445 288 587 415 201 27 75 246 541 178 117 416 5 604 471 461 619 614 100 398 555 251 368 479 282 20 51 165 304 278 456 261 660 475 292 586 290 667 427 592 615 141 193 322 563 40 297 119 390 42 388 573 406 300 92 35 657 182 583 273 537 238 167 396 392 584 566 377 423 194 338 4...

output:

6737

result:

ok "6737"

Test #123:

score: 0
Accepted
time: 168ms
memory: 17752kb

input:

599711 30
77 32 67 6 87 98 57 48 66 94 90 25 16 76 110 27 86 91 54 117 84 75 30 118 92 42 112 82 113 97 33 34 108 10 111 7 106 79 5 2 24 70 104 69 47 80 36 102 45 28 59 63 72 61 85 116 119 68 43 65 62 107 1 46 95 17 3 44 81 11 74 40 88 51 99 109 38 19 52 41 49 96 12 73 15 9 31 18 35 39 4 37 115 26 1...

output:

29623

result:

ok "29623"

Test #124:

score: 0
Accepted
time: 52ms
memory: 13828kb

input:

354644 14
324282 197758 190858 179680 304585 39520 312901 270580 213973 206067 63523 247676 26921 302087 133440 112923 134972 49193 330002 86426 64302 293132 116019 220913 264952 167610 338392 93403 224062 88700 336803 24559 215778 309337 270416 191333 329930 97648 241907 228248 264938 251494 100532...

output:

330

result:

ok "330"

Test #125:

score: 0
Accepted
time: 162ms
memory: 17348kb

input:

599806 29
2056 1862 572 2546 2911 1977 2140 938 502 2553 2165 1618 210 2592 2525 62 1927 2489 1675 1519 377 906 961 2163 1566 313 982 854 1871 1455 1001 1085 1483 1790 603 2608 1178 1510 1906 2362 2152 2625 1288 2319 1041 99 84 1151 2810 340 1233 1406 2444 2361 1046 124 1339 2801 134 2348 1306 2937 ...

output:

2180

result:

ok "2180"

Test #126:

score: 0
Accepted
time: 92ms
memory: 15972kb

input:

511642 16
178447 165593 310982 102370 484778 213646 286830 271695 431029 326268 10708 186615 481803 241266 358340 217486 350030 492499 246910 85062 351392 154717 188143 190028 406561 209925 49653 490650 99260 318686 402161 103689 169906 501349 255462 11710 55899 404250 397366 150133 271907 290232 28...

output:

385

result:

ok "385"

Test #127:

score: 0
Accepted
time: 129ms
memory: 16308kb

input:

420179 27
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 10...

output:

420179

result:

ok "420179"

Test #128:

score: 0
Accepted
time: 69ms
memory: 13676kb

input:

284880 23
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 10...

output:

284880

result:

ok "284880"

Test #129:

score: 0
Accepted
time: 153ms
memory: 17564kb

input:

599818 27
599817 599818 599816 522575 192273 442373 392867 257258 342092 47564 343305 408506 481351 271131 560416 170162 478798 454807 416305 237050 16620 128741 411318 7397 515054 222319 183191 221962 48433 70388 48487 570946 346476 111708 118971 328705 569957 304366 580498 216133 346557 373767 361...

output:

623

result:

ok "623"

Test #130:

score: 0
Accepted
time: 92ms
memory: 17636kb

input:

599243 10
599242 599243 599241 167078 41032 381001 457042 120849 406405 261593 427739 447637 15891 550495 493843 333849 334283 580087 415457 222096 226096 78436 422392 127383 376272 179771 8587 561447 561957 597829 322600 141150 475134 499386 419165 396446 16570 592437 106092 381318 386107 577100 26...

output:

255

result:

ok "255"