QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#203176 | #2481. Pickpockets | BoulevardDust# | AC ✓ | 34ms | 20204kb | C++20 | 2.0kb | 2023-10-06 15:58:25 | 2023-10-06 15:58:25 |
Judging History
answer
#include<bits/stdc++.h>
#define N 100005
#define re
#define ll long long
#define P 167772161
using namespace std;
int n,m,K,q,T;
inline void Rd(int &res){
re char c;res=0;
while(c=getchar(),c<48);
do res=(res<<3)+(res<<1)+(c^48);
while(c=getchar(),c>47);
}
int H,tot,u;
int w[N],a[N],Get[N],LOG[N];
int sumL[N],sumV[N];
int L[N],V[N];
void FWT(unsigned int *a,int n){
for(int d=1;d<n;d<<=1)for(int m=d<<1,i=0;i<n;i+=m)for(int j=0;j<d;j++){
int x=a[i+j],y=a[i+j+d];
a[i+j+d]=x+y;
}
}
void IFWT(unsigned int *a,int n){
for(int d=1;d<n;d<<=1)for(int m=d<<1,i=0;i<n;i+=m)for(int j=0;j<d;j++){
int x=a[i+j],y=a[i+j+d];
a[i+j+d]=y-x;
}
}
bool mk[25];
unsigned int f[17][70005],g[17][70005],h[17][70005];
int main(){
Rd(H),Rd(n);u=1<<n;
for(re int i=1;i<=H;i++){
Rd(w[i]);
if(w[i]>n){puts("0");return 0;}
}
for(re int k=1;k<=n;k++){
int res=0;
for(re int i=1;i<=H&&tot<=n;i++){
if(w[i]>=k)res++;
else if(res>0)a[++tot]=res,res=0;
}
if(res>0)a[++tot]=res,res=0;
if(tot>n)break;
}
if(tot>n){puts("0");return 0;}
for(re int i=1;i<=n;i++)Rd(L[i]),Rd(V[i]);
for(re int i=1;i<u;i++)Get[i]=Get[i&(i-1)]+1;
for(re int i=2;i<u;i++)LOG[i]=LOG[i>>1]+1;
for(re int i=1;i<u;i++)sumL[i]=sumL[i&(i-1)]+L[LOG[i&-i]+1],sumV[i]=sumV[i&(i-1)]+V[LOG[i&-i]+1];
bool flag=1;
for(re int i=1;i<=tot;i++){
for(re int s=0;s<u;s++)if(sumL[s]==a[i])g[Get[s]][s]=1,mk[Get[s]]=1;
for(re int j=1;j<=n;j++)if(mk[j])FWT(g[j],u);
if(flag){
for(re int j=1;j<=n;j++){
mk[j]=0;
for(re int s=0;s<u;s++)f[j][s]=g[j][s],g[j][s]=0;
}
flag=0;
continue;
}
for(re int j=1;j<=n;j++)
for(re int k=1;k<=n;k++)if(mk[k]&&j+k<=n)
for(re int s=0;s<u;s++)h[j+k][s]+=f[j][s]*g[k][s];
for(re int j=1;j<=n;j++){
mk[j]=0;
for(re int s=0;s<u;s++)f[j][s]=h[j][s],h[j][s]=0,g[j][s]=0;
}
}
for(re int i=1;i<=n;i++)IFWT(f[i],u);
int res=0;
for(re int i=1;i<=n;i++)
for(re int s=0;s<u;s++)
if(Get[s]==i&&f[i][s]!=0)res=max(res,sumV[s]);
printf("%d\n",res);
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 2ms
memory: 11732kb
input:
2 2 1 2 1 5 2 5
output:
10
result:
ok single line: '10'
Test #2:
score: 0
Accepted
time: 2ms
memory: 11756kb
input:
2 2 1 2 2 5 1 5
output:
10
result:
ok single line: '10'
Test #3:
score: 0
Accepted
time: 0ms
memory: 14048kb
input:
3 4 2 1 2 3 2 1 1 1 2 1 3
output:
7
result:
ok single line: '7'
Test #4:
score: 0
Accepted
time: 2ms
memory: 14024kb
input:
1 5 2 1 2 1 5 1 3 1 5 1 3
output:
10
result:
ok single line: '10'
Test #5:
score: 0
Accepted
time: 0ms
memory: 11816kb
input:
1 5 1 1 2 1 1 1 2 1 5 1 2
output:
5
result:
ok single line: '5'
Test #6:
score: 0
Accepted
time: 1ms
memory: 7660kb
input:
1 7 0 1 5 1 5 1 5 1 2 1 5 1 3 1 6
output:
0
result:
ok single line: '0'
Test #7:
score: 0
Accepted
time: 1ms
memory: 9812kb
input:
3 6 2 1 1 2 1 3 5 2 3 3 3 2 4 3 3
output:
0
result:
ok single line: '0'
Test #8:
score: 0
Accepted
time: 0ms
memory: 11772kb
input:
2 5 1 1 1 5 2 4 1 4 2 2 1 1
output:
9
result:
ok single line: '9'
Test #9:
score: 0
Accepted
time: 0ms
memory: 9968kb
input:
1 2 1 1 5 1 4
output:
5
result:
ok single line: '5'
Test #10:
score: 0
Accepted
time: 1ms
memory: 11824kb
input:
2 4 0 1 1 6 2 2 2 5 2 5
output:
6
result:
ok single line: '6'
Test #11:
score: 0
Accepted
time: 0ms
memory: 7752kb
input:
3 5 0 0 0 3 2 3 1 3 1 1 3 1 5
output:
0
result:
ok single line: '0'
Test #12:
score: 0
Accepted
time: 0ms
memory: 14028kb
input:
3 6 0 1 0 3 3 1 3 1 2 1 2 1 3 3 2
output:
3
result:
ok single line: '3'
Test #13:
score: 0
Accepted
time: 0ms
memory: 13868kb
input:
2 7 2 0 2 2 1 6 2 4 1 6 1 6 1 2 2 6
output:
12
result:
ok single line: '12'
Test #14:
score: 0
Accepted
time: 2ms
memory: 13896kb
input:
2 6 0 3 2 3 2 16 1 12 2 10 1 16 1 8
output:
36
result:
ok single line: '36'
Test #15:
score: 0
Accepted
time: 3ms
memory: 12820kb
input:
3 13 4 0 3 1 19 3 12 1 13 2 19 1 18 3 4 3 10 1 13 1 19 2 10 3 15 1 20 3 5
output:
0
result:
ok single line: '0'
Test #16:
score: 0
Accepted
time: 1ms
memory: 3368kb
input:
4 2 3 2 4 0 4 10 3 14
output:
0
result:
ok single line: '0'
Test #17:
score: 0
Accepted
time: 0ms
memory: 13860kb
input:
4 6 3 1 3 1 4 9 4 18 1 15 3 15 2 6 1 19
output:
0
result:
ok single line: '0'
Test #18:
score: 0
Accepted
time: 4ms
memory: 13768kb
input:
3 14 3 0 1 3 16 3 7 3 9 3 11 3 15 3 15 2 16 1 1 2 18 3 16 3 13 3 11 1 4 3 4
output:
0
result:
ok single line: '0'
Test #19:
score: 0
Accepted
time: 1ms
memory: 11916kb
input:
2 9 3 1 1 18 1 15 1 15 1 4 2 17 1 4 2 1 1 15 2 16
output:
63
result:
ok single line: '63'
Test #20:
score: 0
Accepted
time: 0ms
memory: 13880kb
input:
1 9 2 1 5 1 11 1 20 1 10 1 10 1 11 1 9 1 8 1 19
output:
39
result:
ok single line: '39'
Test #21:
score: 0
Accepted
time: 2ms
memory: 11744kb
input:
4 7 1 0 0 2 4 15 4 18 2 8 2 2 2 6 3 11 3 11
output:
0
result:
ok single line: '0'
Test #22:
score: 0
Accepted
time: 1ms
memory: 5476kb
input:
2 2 2 3 2 6 1 1
output:
0
result:
ok single line: '0'
Test #23:
score: 0
Accepted
time: 3ms
memory: 16992kb
input:
1 15 4 1 2 1 12 1 7 1 5 1 13 1 10 1 7 1 5 1 1 1 18 1 9 1 5 1 17 1 9 1 6
output:
60
result:
ok single line: '60'
Test #24:
score: 0
Accepted
time: 0ms
memory: 15356kb
input:
4 14 4 4 0 4 4 20 2 13 2 4 1 20 3 4 4 6 3 9 2 8 1 19 3 14 2 18 2 18 1 15 1 19
output:
130
result:
ok single line: '130'
Test #25:
score: 0
Accepted
time: 1ms
memory: 7752kb
input:
2 5 0 0 1 16 2 20 1 16 2 3 2 11
output:
0
result:
ok single line: '0'
Test #26:
score: 0
Accepted
time: 0ms
memory: 13888kb
input:
2 8 4 0 2 7 1 20 2 10 2 17 1 17 1 17 1 15 2 20
output:
69
result:
ok single line: '69'
Test #27:
score: 0
Accepted
time: 0ms
memory: 14184kb
input:
4 12 4 1 2 1 1 17 3 18 4 19 1 7 4 19 3 19 1 6 1 18 2 3 3 17 1 9 3 4
output:
76
result:
ok single line: '76'
Test #28:
score: 0
Accepted
time: 4ms
memory: 15288kb
input:
1 14 2 1 13 1 15 1 17 1 9 1 1 1 15 1 9 1 18 1 13 1 4 1 20 1 11 1 18 1 18
output:
38
result:
ok single line: '38'
Test #29:
score: 0
Accepted
time: 2ms
memory: 12040kb
input:
4 8 4 0 4 3 4 16 4 13 1 6 1 12 4 10 3 19 4 16 3 6
output:
0
result:
ok single line: '0'
Test #30:
score: 0
Accepted
time: 2ms
memory: 13884kb
input:
2 6 0 3 2 8 2 2 2 13 2 15 1 19 1 9
output:
0
result:
ok single line: '0'
Test #31:
score: 0
Accepted
time: 0ms
memory: 14524kb
input:
5 13 3 1 4 1 0 2 5 3 1 5 12 5 9 4 13 5 1 2 6 3 6 2 8 2 15 4 5 1 8 3 12
output:
0
result:
ok single line: '0'
Test #32:
score: 0
Accepted
time: 0ms
memory: 11772kb
input:
4 9 3 2 4 3 4 14 4 10 4 11 1 14 4 8 3 17 4 12 3 9 3 9
output:
0
result:
ok single line: '0'
Test #33:
score: 0
Accepted
time: 0ms
memory: 13928kb
input:
2 15 1 0 2 4 2 17 2 4 2 4 1 7 2 10 1 9 1 8 2 20 1 1 2 9 1 6 1 17 2 15 2 4
output:
17
result:
ok single line: '17'
Test #34:
score: 0
Accepted
time: 0ms
memory: 3440kb
input:
100000 16 14443 55420 45271 59540 17506 45279 49513 7118 52062 23449 62240 81654 47001 82704 81577 90132 54258 108 41873 82899 73494 8454 43677 34844 92634 48581 7109 1530 89551 44235 82584 49481 69802 20448 78330 70257 67421 71672 45574 96521 64524 43129 33599 37095 57123 69486 6307 74558 9699 1494...
output:
0
result:
ok single line: '0'
Test #35:
score: 0
Accepted
time: 0ms
memory: 3452kb
input:
100000 16 34132 25992 9700 90156 37155 60117 91934 19647 21415 98451 85854 51164 39403 80732 68947 34179 10383 43258 89748 79195 49897 93439 99072 84649 3567 21423 59855 21175 31153 43214 81799 35873 50482 75563 11972 64395 85329 14962 60476 19670 77437 86503 26544 26505 97938 98378 18263 91959 1093...
output:
0
result:
ok single line: '0'
Test #36:
score: 0
Accepted
time: 0ms
memory: 3396kb
input:
100000 16 49337 49202 98923 88065 90751 42204 62277 46326 94035 61743 11491 18245 67892 65458 14981 83057 23342 60570 53140 91901 61983 77500 5364 30637 59391 20822 7992 68913 25963 56681 75276 54999 95145 6833 64626 37669 49186 62351 47235 26430 2217 29040 8409 79387 68362 31357 19385 15922 24388 2...
output:
0
result:
ok single line: '0'
Test #37:
score: 0
Accepted
time: 0ms
memory: 3364kb
input:
100000 16 100000 0 100000 0 100000 0 100000 0 100000 0 100000 0 100000 0 100000 0 100000 0 100000 0 100000 0 100000 0 100000 0 100000 0 100000 0 100000 0 100000 0 100000 0 100000 0 100000 0 100000 0 100000 0 100000 0 100000 0 100000 0 100000 0 100000 0 100000 0 100000 0 100000 0 100000 0 100000 0 10...
output:
0
result:
ok single line: '0'
Test #38:
score: 0
Accepted
time: 18ms
memory: 19780kb
input:
1 16 16 1 813962 1 261224 1 292357 1 26638 1 342500 1 220901 1 329926 1 283296 1 444155 1 512333 1 670909 1 546612 1 398289 1 243805 1 299229 1 241034
output:
5927170
result:
ok single line: '5927170'
Test #39:
score: 0
Accepted
time: 21ms
memory: 18972kb
input:
1 16 16 1 559357 1 192158 1 650434 1 120360 1 505929 1 98087 1 596733 1 565702 1 460486 1 797314 1 77027 1 569947 1 799522 1 791499 1 794206 1 658821
output:
8237582
result:
ok single line: '8237582'
Test #40:
score: 0
Accepted
time: 3ms
memory: 14796kb
input:
12 16 1 1 1 1 1 1 1 1 1 1 1 1 12 3 10 2 3 9 9 2 3 9 3 10 7 1 8 2 2 4 9 5 12 11 7 3 12 4 5 6 6 7 12 6
output:
26
result:
ok single line: '26'
Test #41:
score: 0
Accepted
time: 7ms
memory: 14800kb
input:
12 16 1 1 1 1 1 1 1 1 1 1 1 1 10 9 7 8 4 3 7 7 3 6 9 2 1 7 1 10 12 10 2 4 3 10 2 3 4 9 8 6 8 11 9 7
output:
42
result:
ok single line: '42'
Test #42:
score: 0
Accepted
time: 4ms
memory: 16000kb
input:
10 16 1 1 1 1 1 1 1 1 1 1 3 8 3 9 8 11 3 7 2 10 6 3 10 3 9 4 8 11 8 6 10 7 8 2 5 10 1 3 7 2 10 10
output:
29
result:
ok single line: '29'
Test #43:
score: 0
Accepted
time: 7ms
memory: 16084kb
input:
18 16 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 9 9 1 4 4 3 6 6 16 3 13 6 2 3 7 5 8 4 12 4 12 6 11 3 11 3 16 1 5 4 10 2
output:
22
result:
ok single line: '22'
Test #44:
score: 0
Accepted
time: 3ms
memory: 15768kb
input:
20 16 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 11 1 3 1 4 3 14 5 7 6 10 4 11 1 17 2 8 8 3 9 8 9 5 6 10 11 17 8 8 6 3 7
output:
30
result:
ok single line: '30'
Test #45:
score: 0
Accepted
time: 3ms
memory: 16296kb
input:
7 16 1 1 1 1 1 1 1 4 9 6 11 4 6 3 11 5 1 5 3 7 9 6 8 2 10 5 5 7 1 5 4 2 10 5 9 5 7 5 11
output:
31
result:
ok single line: '31'
Test #46:
score: 0
Accepted
time: 0ms
memory: 15712kb
input:
10 16 1 1 1 1 1 1 1 1 1 1 6 5 1 11 3 1 3 10 10 9 10 11 5 9 8 7 8 2 4 1 4 11 10 9 9 5 8 11 6 1 8 1
output:
31
result:
ok single line: '31'
Test #47:
score: 0
Accepted
time: 0ms
memory: 16060kb
input:
20 16 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 9 7 20 8 1 3 10 7 18 9 10 9 16 7 20 9 12 11 3 8 4 6 3 2 2 9 13 5 17 2
output:
35
result:
ok single line: '35'
Test #48:
score: 0
Accepted
time: 7ms
memory: 15808kb
input:
2 16 1 1 1 11 2 7 1 8 1 8 2 4 1 3 2 8 2 7 1 4 1 2 2 11 1 2 2 11 1 11 1 5 1 11
output:
22
result:
ok single line: '22'
Test #49:
score: 0
Accepted
time: 8ms
memory: 16308kb
input:
4 16 1 1 1 1 1 6 3 4 4 8 2 3 2 11 4 3 4 9 1 6 3 5 3 10 2 1 1 4 3 4 1 1 3 2 3 5
output:
23
result:
ok single line: '23'
Test #50:
score: 0
Accepted
time: 7ms
memory: 15804kb
input:
6 16 1 1 1 1 1 1 2 10 5 6 2 7 5 10 3 1 5 7 1 2 5 4 3 9 1 9 1 1 5 1 4 7 3 5 5 9 1 8
output:
34
result:
ok single line: '34'
Test #51:
score: 0
Accepted
time: 4ms
memory: 18872kb
input:
20 16 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 11 10 17 11 3 11 2 4 6 4 13 9 11 3 4 11 16 8 4 4 20 1 8 9 2 6 12 11 19 6 19 5
output:
59
result:
ok single line: '59'
Test #52:
score: 0
Accepted
time: 12ms
memory: 18636kb
input:
18 16 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 9 11 13 7 4 1 8 1 10 9 13 9 14 2 7 8 14 6 17 5 9 6 17 2 12 6 8 7 3 8 3 2
output:
50
result:
ok single line: '50'
Test #53:
score: 0
Accepted
time: 9ms
memory: 18976kb
input:
10 16 4 4 4 4 4 4 4 4 4 4 10 11 10 2 1 5 1 5 9 11 9 4 9 7 5 9 1 8 3 11 6 6 5 5 2 3 6 1 8 2 7 11
output:
74
result:
ok single line: '74'
Test #54:
score: 0
Accepted
time: 15ms
memory: 19772kb
input:
15 16 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 9 2 2 6 11 8 1 4 13 11 1 3 14 4 13 3 7 8 6 6 6 6 13 11 5 1 6 5 4 4 8 9
output:
72
result:
ok single line: '72'
Test #55:
score: 0
Accepted
time: 14ms
memory: 19516kb
input:
20 16 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 2 9 8 11 10 6 13 4 7 3 16 5 19 8 14 2 3 6 16 8 2 6 20 9 16 5 10 5 12 9 8 4
output:
0
result:
ok single line: '0'
Test #56:
score: 0
Accepted
time: 16ms
memory: 19032kb
input:
4 16 7 7 7 7 3 6 1 9 4 11 4 11 4 2 3 2 4 1 1 10 3 6 4 11 2 6 2 3 4 9 4 6 2 11 1 9
output:
96
result:
ok single line: '96'
Test #57:
score: 0
Accepted
time: 19ms
memory: 19928kb
input:
13 16 8 8 8 8 8 8 8 8 8 8 8 8 8 3 11 7 8 6 3 7 5 7 1 12 6 1 7 12 3 5 3 7 5 11 9 1 5 13 4 10 5 7 7 11 4
output:
0
result:
ok single line: '0'
Test #58:
score: 0
Accepted
time: 22ms
memory: 18928kb
input:
15 16 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 1 11 15 7 11 3 7 10 3 2 2 6 7 1 7 11 13 7 15 3 10 4 11 8 8 4 9 2 9 4 15 4
output:
0
result:
ok single line: '0'
Test #59:
score: 0
Accepted
time: 15ms
memory: 18624kb
input:
2 16 10 10 2 10 2 3 2 7 1 5 1 9 1 8 2 7 1 7 2 9 2 10 1 4 2 7 1 8 1 3 1 1 1 11
output:
105
result:
ok single line: '105'
Test #60:
score: 0
Accepted
time: 7ms
memory: 14428kb
input:
20 16 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 13 6 15 9 19 7 12 6 10 7 8 11 9 7 19 5 3 8 17 4 9 8 18 6 4 2 18 9 12 10 2 8
output:
27
result:
ok single line: '27'
Test #61:
score: 0
Accepted
time: 8ms
memory: 19036kb
input:
8 16 2 2 2 2 2 2 2 2 3 5 8 3 5 8 1 7 1 5 5 5 7 7 4 5 8 6 8 8 5 11 2 1 1 1 3 11 6 2 6 6
output:
43
result:
ok single line: '43'
Test #62:
score: 0
Accepted
time: 8ms
memory: 19260kb
input:
16 16 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 4 2 11 2 9 3 11 7 6 5 5 5 6 6 6 1 1 11 7 7 15 2 9 8 6 9 2 1 12 4 16 1
output:
53
result:
ok single line: '53'
Test #63:
score: 0
Accepted
time: 12ms
memory: 18660kb
input:
18 16 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 17 5 6 1 13 2 2 2 16 2 13 3 6 8 6 11 14 7 9 9 7 4 4 7 9 7 14 8 12 7 8 7
output:
60
result:
ok single line: '60'
Test #64:
score: 0
Accepted
time: 12ms
memory: 19392kb
input:
6 16 5 5 5 5 5 5 3 2 3 11 5 3 2 1 2 7 6 10 6 2 6 1 1 9 2 8 4 11 2 5 5 7 6 5 1 7 4 5
output:
80
result:
ok single line: '80'
Test #65:
score: 0
Accepted
time: 15ms
memory: 19924kb
input:
8 16 6 6 6 6 6 6 6 6 6 9 5 3 4 4 3 11 7 6 3 4 6 1 1 4 7 5 6 9 8 5 6 8 2 5 2 1 6 7 2 6
output:
69
result:
ok single line: '69'
Test #66:
score: 0
Accepted
time: 20ms
memory: 19184kb
input:
16 16 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 1 8 7 4 15 2 14 9 15 3 16 5 10 6 15 4 1 6 15 10 4 4 14 1 15 8 2 2 13 7 14 4
output:
0
result:
ok single line: '0'
Test #67:
score: 0
Accepted
time: 26ms
memory: 18984kb
input:
8 16 8 8 8 8 8 8 8 8 8 6 2 6 1 9 5 4 8 3 3 1 5 2 8 9 7 9 4 1 8 10 7 5 8 4 5 3 2 4 3 1
output:
67
result:
ok single line: '67'
Test #68:
score: 0
Accepted
time: 25ms
memory: 19868kb
input:
8 16 9 9 9 9 9 9 9 9 3 5 3 2 6 6 1 3 3 6 8 5 2 11 5 6 7 5 8 6 4 9 6 4 6 6 5 4 8 4 2 4
output:
0
result:
ok single line: '0'
Test #69:
score: 0
Accepted
time: 23ms
memory: 19652kb
input:
6 16 10 10 10 10 10 10 3 11 6 11 6 2 6 4 1 11 2 1 3 4 2 11 3 4 1 7 4 9 4 8 2 9 2 3 4 7 4 3
output:
0
result:
ok single line: '0'
Test #70:
score: 0
Accepted
time: 16ms
memory: 18536kb
input:
5 16 5 7 6 4 0 1 2 1 22 1 6 1 29 1 30 2 25 1 21 2 17 1 24 2 20 1 12 2 9 2 24 1 1 1 19 2 13
output:
274
result:
ok single line: '274'
Test #71:
score: 0
Accepted
time: 9ms
memory: 18916kb
input:
5 16 3 4 2 2 1 2 28 1 28 3 30 1 26 1 24 1 29 3 10 3 4 4 10 2 12 2 29 1 12 1 30 2 25 1 5 2 19
output:
231
result:
ok single line: '231'
Test #72:
score: 0
Accepted
time: 15ms
memory: 18892kb
input:
5 16 5 4 3 7 3 2 24 3 19 1 13 5 27 1 10 2 24 1 29 1 22 2 22 1 25 2 22 2 15 4 21 4 5 1 15 4 9
output:
252
result:
ok single line: '252'
Test #73:
score: 0
Accepted
time: 10ms
memory: 19184kb
input:
5 16 4 3 3 2 1 2 12 1 30 2 9 2 22 1 11 2 28 5 6 2 7 3 6 4 18 1 22 1 16 1 1 2 26 3 22 2 30
output:
186
result:
ok single line: '186'
Test #74:
score: 0
Accepted
time: 8ms
memory: 19316kb
input:
5 16 3 4 4 5 2 1 1 5 7 4 1 1 10 2 18 1 20 4 8 1 3 1 25 2 13 1 16 2 18 1 9 4 10 4 12 1 19
output:
164
result:
ok single line: '164'
Test #75:
score: 0
Accepted
time: 11ms
memory: 19748kb
input:
5 16 1 3 4 2 3 1 22 2 16 3 6 1 23 1 1 2 26 1 23 1 30 1 6 1 26 1 10 2 30 2 18 3 22 3 1 1 29
output:
237
result:
ok single line: '237'
Test #76:
score: 0
Accepted
time: 15ms
memory: 19200kb
input:
5 16 2 5 5 2 4 1 28 3 11 2 14 1 12 1 18 1 12 4 9 2 21 1 11 2 16 4 23 3 28 1 23 1 26 2 27 5 19
output:
236
result:
ok single line: '236'
Test #77:
score: 0
Accepted
time: 16ms
memory: 18540kb
input:
5 16 0 4 5 3 1 1 25 3 8 1 27 1 5 2 2 1 2 2 27 1 29 1 30 3 2 3 14 1 17 2 17 1 26 1 10 1 1
output:
215
result:
ok single line: '215'
Test #78:
score: 0
Accepted
time: 18ms
memory: 19628kb
input:
5 16 5 4 6 6 0 2 21 1 5 1 23 2 27 2 15 2 13 2 3 2 18 2 28 2 25 1 22 2 19 1 30 4 13 5 10 3 15
output:
248
result:
ok single line: '248'
Test #79:
score: 0
Accepted
time: 17ms
memory: 19864kb
input:
5 16 2 2 4 4 2 2 19 2 21 1 5 2 5 2 30 1 10 1 16 1 1 2 13 1 1 2 13 2 28 4 27 1 16 1 22 3 13
output:
175
result:
ok single line: '175'
Test #80:
score: 0
Accepted
time: 20ms
memory: 19220kb
input:
10 16 4 5 0 1 3 3 6 5 5 3 2 13 3 22 2 8 2 22 2 10 1 19 2 7 3 17 1 5 2 14 6 23 7 27 1 5 1 1 1 24 2 18
output:
227
result:
ok single line: '227'
Test #81:
score: 0
Accepted
time: 12ms
memory: 19748kb
input:
10 16 0 1 4 4 4 4 3 3 1 0 1 29 3 17 4 22 1 25 1 15 3 21 2 28 6 26 4 19 4 26 5 3 2 3 4 28 4 1 2 5 3 16
output:
213
result:
ok single line: '213'
Test #82:
score: 0
Accepted
time: 14ms
memory: 19264kb
input:
10 16 1 1 4 3 4 4 2 3 3 1 2 14 4 24 2 4 2 17 3 15 2 4 9 24 1 11 2 14 5 2 3 20 7 18 7 27 5 3 1 16 4 15
output:
158
result:
ok single line: '158'
Test #83:
score: 0
Accepted
time: 8ms
memory: 19220kb
input:
10 16 0 1 4 4 1 0 2 1 0 1 1 6 2 3 8 4 3 14 1 28 1 28 4 4 1 7 1 3 2 15 5 29 2 29 6 15 4 19 2 5 1 17
output:
152
result:
ok single line: '152'
Test #84:
score: 0
Accepted
time: 14ms
memory: 18680kb
input:
10 16 1 1 2 4 5 4 5 4 1 2 1 30 1 16 2 7 1 11 2 17 1 26 2 17 1 21 2 17 5 7 2 7 3 17 1 13 3 21 1 21 1 18
output:
266
result:
ok single line: '266'
Test #85:
score: 0
Accepted
time: 4ms
memory: 19880kb
input:
10 16 2 1 1 1 1 1 1 0 1 0 2 14 6 13 10 13 1 6 2 9 9 21 1 2 1 19 1 10 8 10 2 27 8 30 5 9 6 4 1 9 3 17
output:
88
result:
ok single line: '88'
Test #86:
score: 0
Accepted
time: 14ms
memory: 18900kb
input:
10 16 0 0 2 1 0 1 5 2 4 4 1 11 1 23 4 15 1 15 5 6 1 9 7 26 1 26 1 29 4 8 2 4 1 2 4 4 2 14 9 30 2 24
output:
176
result:
ok single line: '176'
Test #87:
score: 0
Accepted
time: 11ms
memory: 19320kb
input:
10 16 2 3 1 0 1 0 2 2 4 0 5 27 1 10 1 27 2 19 1 27 2 8 8 29 2 17 3 9 4 21 3 2 3 22 7 24 1 3 9 16 3 22
output:
139
result:
ok single line: '139'
Test #88:
score: 0
Accepted
time: 9ms
memory: 19248kb
input:
10 16 0 0 3 2 3 0 1 3 4 1 2 20 2 3 2 11 8 17 5 11 1 5 1 29 1 11 2 24 8 18 3 8 3 2 1 29 1 10 2 15 1 13
output:
175
result:
ok single line: '175'
Test #89:
score: 0
Accepted
time: 7ms
memory: 18960kb
input:
10 16 0 1 2 2 4 4 3 2 2 0 1 13 1 16 7 23 2 19 3 18 2 28 3 26 3 10 8 10 1 5 4 29 5 29 3 21 2 1 5 7 9 13
output:
175
result:
ok single line: '175'
Test #90:
score: 0
Accepted
time: 17ms
memory: 19916kb
input:
20 16 0 0 1 1 2 0 0 1 1 1 4 4 6 5 5 4 1 0 1 1 2 12 3 13 5 14 1 23 5 10 1 20 2 11 4 25 5 28 3 22 3 2 1 6 4 29 3 28 9 16 1 18
output:
251
result:
ok single line: '251'
Test #91:
score: 0
Accepted
time: 22ms
memory: 20204kb
input:
20 16 1 0 3 2 1 4 4 3 2 3 4 3 0 0 0 1 1 1 2 2 2 30 2 30 1 21 14 5 1 20 10 28 1 18 2 24 5 28 1 10 2 30 7 18 6 3 2 24 1 20 2 27
output:
304
result:
ok single line: '304'
Test #92:
score: 0
Accepted
time: 22ms
memory: 19280kb
input:
20 16 2 2 2 1 2 2 3 2 3 4 4 5 2 3 3 4 4 4 1 0 3 12 2 29 13 6 4 11 1 4 4 17 17 2 3 27 3 7 9 25 7 8 2 1 3 7 6 17 3 12 1 11
output:
175
result:
ok single line: '175'
Test #93:
score: 0
Accepted
time: 13ms
memory: 19492kb
input:
20 16 1 1 1 1 3 3 0 0 0 1 3 3 3 3 1 0 0 1 1 0 5 2 8 23 1 24 9 5 2 1 2 23 2 11 2 19 2 1 1 4 2 11 2 20 2 2 2 20 4 26 2 12
output:
174
result:
ok single line: '174'
Test #94:
score: 0
Accepted
time: 19ms
memory: 18872kb
input:
20 16 0 1 2 2 1 1 0 1 2 1 2 2 4 4 4 4 3 3 1 0 1 24 6 12 1 6 2 11 1 2 13 1 11 8 2 3 2 10 1 9 2 19 2 28 8 17 3 12 9 19 10 10
output:
169
result:
ok single line: '169'
Test #95:
score: 0
Accepted
time: 24ms
memory: 20096kb
input:
100 16 0 0 0 0 0 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 2 2 3 3 3 2 2 1 1 1 1 1 1 2 2 2 2 2 1 0 0 1 1 1 1 1 1 1 1 1 0 0 1 1 1 1 1 1 1 1 1 2 2 2 2 2 4 3 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 2 7 7 17 12 28 4 4 3 15 31 24 1 24 18 6 12 7 5 19 9 13 45 12 18 7 20 16 4 27 3 2
output:
188
result:
ok single line: '188'
Test #96:
score: 0
Accepted
time: 34ms
memory: 19356kb
input:
100 16 0 0 2 2 2 2 2 2 2 2 2 2 1 0 0 0 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 2 2 2 2 4 4 3 2 2 2 1 1 2 3 3 3 2 1 1 2 4 4 4 4 4 4 5 5 5 5 4 4 4 4 4 4 4 4 2 2 2 2 2 1 1 1 0 0 0 0 7 21 2 8 3 4 10 4 50 3 5 9 55 21 11 6 4 12 9 19 18 4 10 26 3 20 18 22 17 16 2 10
output:
202
result:
ok single line: '202'
Test #97:
score: 0
Accepted
time: 29ms
memory: 19184kb
input:
100 16 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 2 2 2 3 3 3 3 3 3 3 4 3 3 3 3 4 4 4 4 3 3 3 2 2 2 2 2 1 0 0 1 1 1 1 1 1 1 0 0 0 0 0 1 1 1 2 2 2 2 1 1 1 0 0 0 0 0 1 1 1 1 3 3 2 2 2 2 1 2 2 2 2 2 2 1 1 1 1 3 3 2 1 1 0 0 19 11 3 10 27 27 3 12 35 14 1 29 4 20 2 13 6 16 2 2 7 6 26 10 3 10 6 9 4 20 4 2
output:
211
result:
ok single line: '211'
Test #98:
score: 0
Accepted
time: 20ms
memory: 18780kb
input:
1000 16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...
output:
250
result:
ok single line: '250'
Test #99:
score: 0
Accepted
time: 27ms
memory: 19080kb
input:
1000 16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...
output:
179
result:
ok single line: '179'
Test #100:
score: 0
Accepted
time: 25ms
memory: 18952kb
input:
10000 16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...
output:
242
result:
ok single line: '242'
Test #101:
score: 0
Accepted
time: 16ms
memory: 19736kb
input:
10000 16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0...
output:
201
result:
ok single line: '201'
Test #102:
score: 0
Accepted
time: 12ms
memory: 20104kb
input:
10000 16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0...
output:
92
result:
ok single line: '92'
Test #103:
score: 0
Accepted
time: 0ms
memory: 13892kb
input:
4 7 2 2 1 1 3 1 1 1 1 4 1 1 2 4 2 2 2 1
output:
11
result:
ok single line: '11'
Test #104:
score: 0
Accepted
time: 12ms
memory: 18900kb
input:
10000 16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0...
output:
127
result:
ok single line: '127'
Test #105:
score: 0
Accepted
time: 21ms
memory: 19904kb
input:
10000 16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0...
output:
198
result:
ok single line: '198'
Test #106:
score: 0
Accepted
time: 16ms
memory: 19420kb
input:
100000 16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...
output:
126
result:
ok single line: '126'
Test #107:
score: 0
Accepted
time: 20ms
memory: 20056kb
input:
100000 16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...
output:
195
result:
ok single line: '195'
Test #108:
score: 0
Accepted
time: 18ms
memory: 20072kb
input:
100000 16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...
output:
260
result:
ok single line: '260'
Test #109:
score: 0
Accepted
time: 13ms
memory: 20092kb
input:
100000 16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...
output:
76
result:
ok single line: '76'
Test #110:
score: 0
Accepted
time: 18ms
memory: 19412kb
input:
100000 16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...
output:
128
result:
ok single line: '128'
Test #111:
score: 0
Accepted
time: 22ms
memory: 19472kb
input:
100000 16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...
output:
222
result:
ok single line: '222'
Test #112:
score: 0
Accepted
time: 16ms
memory: 19152kb
input:
100000 16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...
output:
131
result:
ok single line: '131'
Test #113:
score: 0
Accepted
time: 14ms
memory: 19784kb
input:
100000 16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...
output:
138
result:
ok single line: '138'
Test #114:
score: 0
Accepted
time: 19ms
memory: 19344kb
input:
100000 16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...
output:
167
result:
ok single line: '167'
Test #115:
score: 0
Accepted
time: 15ms
memory: 19436kb
input:
100000 16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...
output:
188
result:
ok single line: '188'
Test #116:
score: 0
Accepted
time: 21ms
memory: 19160kb
input:
1 16 15 1 147725 1 124741 1 668268 1 738677 1 526318 1 43905 1 808828 1 712002 1 658642 1 888891 1 821788 1 337618 1 861167 1 212156 1 897260 1 919338
output:
9323419
result:
ok single line: '9323419'
Test #117:
score: 0
Accepted
time: 20ms
memory: 18868kb
input:
1 16 14 1 82504 1 162233 1 982848 1 882411 1 751159 1 573594 1 722666 1 338731 1 885120 1 934410 1 409588 1 424453 1 375437 1 509987 1 827932 1 512818
output:
9131154
result:
ok single line: '9131154'
Test #118:
score: 0
Accepted
time: 14ms
memory: 19616kb
input:
1 16 13 1 246090 1 564516 1 455808 1 831067 1 223984 1 486988 1 249960 1 521806 1 312477 1 756770 1 958092 1 288411 1 542535 1 269755 1 909635 1 799580
output:
7697440
result:
ok single line: '7697440'
Test #119:
score: 0
Accepted
time: 16ms
memory: 19636kb
input:
1 16 12 1 351931 1 47320 1 793152 1 818458 1 115689 1 320862 1 844146 1 695945 1 658626 1 793817 1 853221 1 311400 1 4415 1 727372 1 970136 1 329598
output:
8157264
result:
ok single line: '8157264'
Test #120:
score: 0
Accepted
time: 15ms
memory: 19212kb
input:
1 16 11 1 918067 1 909984 1 142126 1 27349 1 635711 1 658919 1 271334 1 715218 1 797190 1 522790 1 785302 1 846878 1 395672 1 122535 1 838549 1 383536
output:
8024280
result:
ok single line: '8024280'
Test #121:
score: 0
Accepted
time: 11ms
memory: 18784kb
input:
1 16 10 1 816487 1 648818 1 123552 1 588481 1 851294 1 438897 1 633240 1 852489 1 636582 1 862724 1 239725 1 406781 1 322584 1 798302 1 908612 1 19858
output:
7597029
result:
ok single line: '7597029'
Test #122:
score: 0
Accepted
time: 13ms
memory: 18664kb
input:
1 16 9 1 14454 1 768245 1 855505 1 140031 1 587728 1 377078 1 849917 1 130112 1 184306 1 84066 1 427096 1 342710 1 988916 1 922374 1 721974 1 806087
output:
6927842
result:
ok single line: '6927842'
Test #123:
score: 0
Accepted
time: 16ms
memory: 18760kb
input:
5 16 5 5 0 2 2 1 18 1 23 1 9 1 15 1 29 1 17 1 28 1 30 1 8 3 15 1 25 1 28 1 21 3 15 1 17 1 19
output:
287
result:
ok single line: '287'
Test #124:
score: 0
Accepted
time: 13ms
memory: 20156kb
input:
5 16 5 5 3 2 0 1 8 1 29 1 25 1 22 1 9 2 17 2 25 3 1 4 13 1 16 2 23 2 30 1 16 1 30 1 22 3 29
output:
255
result:
ok single line: '255'
Test #125:
score: 0
Accepted
time: 15ms
memory: 19768kb
input:
5 16 0 8 8 1 0 1 14 1 3 1 28 2 24 1 29 1 8 1 15 1 2 1 23 1 18 1 28 1 14 1 14 1 15 1 20 1 26
output:
281
result:
ok single line: '281'
Test #126:
score: 0
Accepted
time: 12ms
memory: 19616kb
input:
5 16 0 2 3 8 8 2 28 1 19 1 1 1 8 2 3 1 12 2 23 1 8 1 15 1 28 1 1 2 16 1 11 1 18 1 23 2 11
output:
225
result:
ok single line: '225'
Test #127:
score: 0
Accepted
time: 13ms
memory: 19940kb
input:
5 16 4 4 0 2 2 1 23 1 5 1 6 2 27 1 24 2 4 1 12 1 6 1 25 5 25 3 5 1 6 1 19 1 28 1 16 1 5
output:
192
result:
ok single line: '192'
Test #128:
score: 0
Accepted
time: 20ms
memory: 19348kb
input:
20 16 0 0 3 3 3 4 4 4 3 3 1 2 2 2 1 1 1 1 0 0 1 17 7 18 2 7 4 10 4 5 1 10 3 17 1 29 7 3 7 14 3 5 2 21 1 16 1 5 1 19 3 26
output:
214
result:
ok single line: '214'
Test #129:
score: 0
Accepted
time: 19ms
memory: 18964kb
input:
20 16 0 0 0 1 1 0 1 1 0 1 1 1 0 1 3 3 2 4 4 3 1 19 3 8 1 4 1 23 2 12 1 4 1 28 1 28 2 25 1 17 1 14 1 6 3 1 1 26 4 22 3 20
output:
257
result:
ok single line: '257'
Test #130:
score: 0
Accepted
time: 11ms
memory: 20080kb
input:
20 16 0 1 1 1 1 2 3 4 4 4 2 1 1 1 1 1 2 2 2 2 1 23 3 1 5 6 2 18 1 2 2 7 3 24 1 29 1 15 3 9 2 18 2 2 2 19 1 23 3 10 4 11
output:
217
result:
ok single line: '217'
Test #131:
score: 0
Accepted
time: 9ms
memory: 19296kb
input:
20 16 0 0 0 0 1 1 1 1 2 2 1 0 1 1 1 0 0 2 2 0 1 10 6 1 1 9 2 12 2 5 1 7 1 16 1 16 2 21 10 24 1 13 6 1 1 11 13 20 1 17 2 26
output:
163
result:
ok single line: '163'
Test #132:
score: 0
Accepted
time: 17ms
memory: 20128kb
input:
20 16 1 1 0 1 1 1 1 2 2 1 2 2 2 2 2 2 0 0 1 1 3 21 1 9 1 7 1 27 3 22 2 26 2 5 1 1 2 4 1 7 1 29 1 19 3 25 1 23 1 21 1 24
output:
270
result:
ok single line: '270'
Test #133:
score: 0
Accepted
time: 14ms
memory: 20076kb
input:
100 16 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 1 2 2 2 2 2 2 2 1 1 1 1 1 1 1 0 25 16 4 7 3 28 9 26 10 24 7 21 3 22 9 7 40 9 4 2 3 14 26 3 40 23 81 23 9 13 7 21
output:
190
result:
ok single line: '190'
Test #134:
score: 0
Accepted
time: 13ms
memory: 19628kb
input:
100 16 1 1 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 1 1 2 2 2 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 1 1 1 1 3 3 3 3 3 3 2 2 2 2 2 2 2 2 2 2 2 2 1 0 3 16 12 24 9 13 11 19 37 11 22 29 4 12 2 21 5 12 21 27 3 8 3 25 2 14 3 15 9 2 4 23
output:
252
result:
ok single line: '252'
Test #135:
score: 0
Accepted
time: 12ms
memory: 18696kb
input:
100 16 0 0 0 0 0 0 0 0 0 1 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 21 28 13 20 39 13 26 22 83 23 21 3 1 11 72 25 12 17 9 2 10 28 1 30 42 3 83 9 55 6 41 3
output:
139
result:
ok single line: '139'
Test #136:
score: 0
Accepted
time: 15ms
memory: 19612kb
input:
100 16 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 2 2 3 3 2 2 2 2 2 1 1 1 1 0 0 0 0 4 15 32 30 2 25 1 16 1 19 6 20 5 25 9 17 21 6 26 26 31 22 1 28 1 25 1 1 24 13 10 24
output:
263
result:
ok single line: '263'
Test #137:
score: 0
Accepted
time: 13ms
memory: 18584kb
input:
100 16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 2 2 2 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 8 28 59 1 7 2 1 23 7 17 7 27 8 5 7 10 1 19 2 3 15 18 7 1 14 26 48 11 21 4 1 17
output:
191
result:
ok single line: '191'
Test #138:
score: 0
Accepted
time: 15ms
memory: 19948kb
input:
100000 16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...
output:
173
result:
ok single line: '173'
Test #139:
score: 0
Accepted
time: 10ms
memory: 19492kb
input:
100000 16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...
output:
184
result:
ok single line: '184'
Test #140:
score: 0
Accepted
time: 14ms
memory: 20112kb
input:
100000 16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...
output:
191
result:
ok single line: '191'
Test #141:
score: 0
Accepted
time: 10ms
memory: 19712kb
input:
100000 16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...
output:
190
result:
ok single line: '190'
Test #142:
score: 0
Accepted
time: 10ms
memory: 19048kb
input:
100000 16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...
output:
312
result:
ok single line: '312'
Test #143:
score: 0
Accepted
time: 3ms
memory: 15592kb
input:
610 16 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...
output:
515
result:
ok single line: '515'
Test #144:
score: 0
Accepted
time: 3ms
memory: 15604kb
input:
885 16 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...
output:
443
result:
ok single line: '443'
Test #145:
score: 0
Accepted
time: 7ms
memory: 18944kb
input:
430 16 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2...
output:
80
result:
ok single line: '80'
Test #146:
score: 0
Accepted
time: 12ms
memory: 18780kb
input:
407 16 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2...
output:
110
result:
ok single line: '110'
Test #147:
score: 0
Accepted
time: 3ms
memory: 18712kb
input:
1 16 3 1 4 1 7 1 4 1 8 1 2 1 5 1 1 1 2 1 7 1 9 1 5 1 10 1 5 1 8 1 3 1 8
output:
27
result:
ok single line: '27'
Test #148:
score: 0
Accepted
time: 5ms
memory: 19788kb
input:
2 16 1 2 1 2 2 5 1 6 2 2 1 6 2 9 1 10 2 9 1 4 2 4 1 10 2 8 1 10 2 1 1 5 2 2
output:
30
result:
ok single line: '30'
Test #149:
score: 0
Accepted
time: 10ms
memory: 18888kb
input:
3 16 5 1 5 1 6 2 1 3 9 1 4 2 4 3 9 1 5 2 4 3 1 1 5 2 8 3 8 1 4 2 7 3 1 1 2
output:
0
result:
ok single line: '0'
Test #150:
score: 0
Accepted
time: 8ms
memory: 19804kb
input:
4 16 4 3 2 5 1 7 2 6 3 10 4 8 1 6 2 6 3 8 4 3 1 6 2 2 3 2 4 10 1 10 2 6 3 5 4 6
output:
57
result:
ok single line: '57'
Test #151:
score: 0
Accepted
time: 7ms
memory: 19428kb
input:
5 16 2 5 2 1 2 1 2 2 1 3 4 4 2 5 10 1 3 2 5 3 4 4 4 5 7 1 6 2 9 3 1 4 8 5 2 1 9
output:
37
result:
ok single line: '37'
Test #152:
score: 0
Accepted
time: 12ms
memory: 19036kb
input:
6 16 2 5 1 3 3 2 1 4 2 8 3 8 4 7 5 1 6 9 1 8 2 1 3 5 4 3 5 9 6 10 1 3 2 1 3 8 4 7
output:
45
result:
ok single line: '45'
Test #153:
score: 0
Accepted
time: 18ms
memory: 19792kb
input:
7 16 5 2 4 1 4 2 4 1 5 2 6 3 7 4 2 5 7 6 5 7 1 1 4 2 4 3 2 4 2 5 6 6 7 7 3 1 6 2 4
output:
0
result:
ok single line: '0'
Test #154:
score: 0
Accepted
time: 16ms
memory: 19476kb
input:
8 16 3 2 3 5 5 4 5 5 1 2 2 5 3 5 4 6 5 3 6 3 7 9 8 6 1 5 2 2 3 4 4 8 5 4 6 9 7 6 8 2
output:
50
result:
ok single line: '50'
Test #155:
score: 0
Accepted
time: 29ms
memory: 18976kb
input:
9 16 5 2 2 4 4 2 4 5 4 1 5 2 1 3 1 4 3 5 3 6 10 7 5 8 4 9 10 1 1 2 10 3 5 4 6 5 8 6 8 7 9
output:
0
result:
ok single line: '0'
Test #156:
score: 0
Accepted
time: 19ms
memory: 19864kb
input:
10 16 3 5 1 4 2 4 2 4 1 2 1 5 2 7 3 10 4 5 5 5 6 5 7 6 8 6 9 4 10 2 1 3 2 2 3 2 4 2 5 4 6 5
output:
0
result:
ok single line: '0'
Test #157:
score: 0
Accepted
time: 21ms
memory: 19020kb
input:
15 16 1 5 4 3 3 5 3 1 3 5 5 2 3 1 2 1 2 2 2 3 8 4 9 5 8 6 1 7 4 8 5 9 4 10 3 11 10 12 4 13 3 14 8 15 5 1 5
output:
0
result:
ok single line: '0'
Test #158:
score: 0
Accepted
time: 1ms
memory: 5652kb
input:
22 16 5 5 4 2 4 3 1 3 1 3 3 5 4 3 2 4 2 2 5 2 2 5 1 2 2 1 3 10 4 6 5 4 6 2 7 6 8 7 9 10 10 5 11 5 12 6 13 3 14 3 15 1 16 4
output:
0
result:
ok single line: '0'
Test #159:
score: 0
Accepted
time: 0ms
memory: 5360kb
input:
22 16 2 4 1 4 2 3 4 2 3 5 5 4 2 1 5 2 4 5 5 5 3 5 1 7 2 6 3 2 4 2 5 2 6 3 7 1 8 2 9 4 10 7 11 6 12 3 13 2 14 9 15 5 16 4
output:
0
result:
ok single line: '0'
Test #160:
score: 0
Accepted
time: 1ms
memory: 5612kb
input:
22 16 2 4 1 2 2 1 3 1 2 1 4 4 5 3 1 1 3 4 2 2 1 4 1 10 2 9 3 10 4 2 5 7 6 5 7 10 8 4 9 5 10 6 11 5 12 9 13 4 14 8 15 9 16 3
output:
0
result:
ok single line: '0'
Test #161:
score: 0
Accepted
time: 4ms
memory: 14256kb
input:
907 16 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...
output:
0
result:
ok single line: '0'
Test #162:
score: 0
Accepted
time: 3ms
memory: 14664kb
input:
570 16 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...
output:
0
result:
ok single line: '0'
Test #163:
score: 0
Accepted
time: 3ms
memory: 15016kb
input:
770 16 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...
output:
0
result:
ok single line: '0'