QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#352014#5035. foo~ANIG50 545ms351780kbC++232.1kb2024-03-12 19:24:522024-03-12 19:24:54

Judging History

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

  • [2024-03-12 19:24:54]
  • 评测
  • 测评结果:50
  • 用时:545ms
  • 内存:351780kb
  • [2024-03-12 19:24:52]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
#define int long long
#define F(i,l,r) for(int i=(l);i<=(r);i++)
#define D(i,l,r) for(int i=(l);i>=(r);i--)
const int N=1.2e6+5,inf=1e9,M=35;
struct tr{
    int fa[N];
    int f(int x){
        if(x==fa[x])return x;
        return fa[x]=f(fa[x]);
    }
    void hb(int a,int b){
        if(f(a)!=f(b))fa[f(b)]=f(a);
    }
}t1,t2;
struct node{
    int lst,nxt,laz;
}l1[N],l2[N];
int n,k,w[N],p[N],lst[N],nxt[N],res,f[M][N],f1[N],f2[N];
vector<int>st,g1[N],g2[N];
deque<int>qs;
void del(node*q,int x){
    if(q[x].laz)q[q[x].nxt].laz+=q[x].laz;
    q[q[x].lst].nxt=q[x].nxt;
    q[q[x].nxt].lst=q[x].lst;
}
void upt(node*q,int x,int*g){
    while(q[x].lst&&g[q[x].lst]<=g[x]+q[x].laz)del(q,q[x].lst);
}
void Solve(){
    F(i,1,n)g1[i].clear(),g2[i].clear();
    qs.clear();
    for(int i=1;i<=n;i++)qs.push_back(w[i]);
    while(qs.front()!=n)qs.push_front(qs.back()),qs.pop_back();
    for(int i=1;i<=n;i++)p[i]=qs[i-1],t1.fa[i]=t2.fa[i]=i;
    p[0]=p[n+1]=inf;
    st.clear();
    st.push_back(0);
    F(i,1,n){
        while(p[st.back()]<p[i])st.pop_back();
        lst[i]=st.back();
        st.push_back(i);
    }
    st.clear();
    st.push_back(n+1);
    D(i,n,1){
        while(p[st.back()]<p[i])st.pop_back();
        nxt[i]=st.back();
        st.push_back(i);
    }
    F(i,1,n)g1[lst[i]].push_back(i),g2[nxt[i]].push_back(i);
    memset(f,-0x3f,sizeof(f));
    f[0][0]=0;
    F(t,1,k){
        memset(f1,0,sizeof(f1));
        memset(f2,0,sizeof(f2));
        int tg=0;
        F(i,1,n)l1[i]={i-1,i+1,0},l2[i]={i-1,i+1,0};
        F(i,1,n){
            f1[i]+=f[t-1][i-1]-(i-1);
            f2[i]=f[t-1][i-1]-i+1;
            D(u,n,lst[i]+1)f1[u]++;
            for(auto u:g2[i]){F(v,1,u)f2[v]--;}
            F(u,1,i)f[t][i]=max(f[t][i],max(f1[u],f2[u]+i));
        }
    }
    F(i,1,n)res=max(res,f[k][i]);
}
signed main(){
    #ifdef zzafanti
    freopen("in.txt","r",stdin);
    #endif
    #ifdef orz
    freopen("out.txt","w",stdout);
    #endif
    cin>>n>>k;
    F(i,1,n)cin>>w[i];
    Solve();
    reverse(w+1,w+n+1);
    Solve();
    cout<<res;
}

詳細信息

Subtask #1:

score: 10
Accepted

Test #1:

score: 10
Accepted
time: 59ms
memory: 350672kb

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: 50ms
memory: 350692kb

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: 48ms
memory: 350400kb

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: 51ms
memory: 350516kb

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: 44ms
memory: 350744kb

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: 54ms
memory: 350476kb

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: 56ms
memory: 350500kb

input:

8 2
1 2 5 6 3 4 7 8

output:

8

result:

ok "8"

Test #8:

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

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: 44ms
memory: 350744kb

input:

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

output:

6

result:

ok "6"

Test #10:

score: 0
Accepted
time: 56ms
memory: 350448kb

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: 51ms
memory: 350392kb

input:

6 3
4 1 5 6 2 3

output:

6

result:

ok "6"

Test #12:

score: 0
Accepted
time: 48ms
memory: 350512kb

input:

1 1
1

output:

1

result:

ok "1"

Test #13:

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

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: 64ms
memory: 350736kb

input:

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

output:

9

result:

ok "9"

Test #15:

score: 0
Accepted
time: 60ms
memory: 350496kb

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: 55ms
memory: 350512kb

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: 52ms
memory: 350524kb

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: 43ms
memory: 350512kb

input:

4 2
1 2 3 4

output:

4

result:

ok "4"

Test #19:

score: 0
Accepted
time: 48ms
memory: 350728kb

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: 59ms
memory: 350476kb

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: 0
Time Limit Exceeded

Test #21:

score: 0
Time Limit Exceeded

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:


result:


Subtask #3:

score: 20
Accepted

Test #36:

score: 20
Accepted
time: 173ms
memory: 351148kb

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: 119ms
memory: 351100kb

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: 60ms
memory: 350456kb

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: 64ms
memory: 350456kb

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: 92ms
memory: 350484kb

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: 52ms
memory: 350520kb

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: 55ms
memory: 350704kb

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: 140ms
memory: 350908kb

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: 98ms
memory: 350860kb

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: 136ms
memory: 350920kb

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: 100ms
memory: 350920kb

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: 71ms
memory: 350924kb

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: 51ms
memory: 350924kb

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: 171ms
memory: 350860kb

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: 76ms
memory: 350888kb

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: 283ms
memory: 351576kb

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: 431ms
memory: 351464kb

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: 83ms
memory: 351656kb

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: 88ms
memory: 350804kb

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: 545ms
memory: 351460kb

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: 205ms
memory: 351404kb

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: 108ms
memory: 351376kb

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: 138ms
memory: 351024kb

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: 72ms
memory: 351372kb

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: 434ms
memory: 351304kb

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: 76ms
memory: 350624kb

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: 148ms
memory: 351056kb

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: 449ms
memory: 351444kb

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: 155ms
memory: 351248kb

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: 479ms
memory: 351780kb

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: 186ms
memory: 350964kb

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: 131ms
memory: 351288kb

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: 430ms
memory: 351776kb

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: 180ms
memory: 351224kb

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: 441ms
memory: 351440kb

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: 0
Time Limit Exceeded

Dependency #4:

100%
Accepted

Test #71:

score: 0
Time Limit Exceeded

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:


result:


Subtask #6:

score: 0
Skipped

Dependency #2:

0%