QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#396654#7988. 史莱姆工厂zyxawaAC ✓24ms11640kbC++141.6kb2024-04-22 23:06:252024-04-22 23:06:25

Judging History

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

  • [2024-04-22 23:06:25]
  • 评测
  • 测评结果:AC
  • 用时:24ms
  • 内存:11640kb
  • [2024-04-22 23:06:25]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int n,s,w,c[151],m[151],p[21];
ll f[151][151],fl[151][151][21],fr[151][151][21];
void upd(ll &x,ll y){x=max(x,y);}
int main(){
	memset(f,-0x3f,sizeof(f)),memset(fl,-0x3f,sizeof(fl)),memset(fr,-0x3f,sizeof(fr));
	scanf("%d%d%d",&n,&s,&w);
	for(int i=1;i<=n;i++) scanf("%d",&c[i]);
	for(int i=1;i<=n;i++) scanf("%d",&m[i]);
	for(int i=s;i<=2*s-2;i++) scanf("%d",&p[i]);
	for(int i=1;i<s;i++) p[i]=p[s]-(s-i)*w;
	for(int i=1;i<=n;i++) f[i][i]=p[m[i]],fl[i][i][m[i]]=fr[i][i][m[i]]=f[i][i-1]=0;
	for(int t=2;t<=n;t++){
		for(int l=1;l+t-1<=n;l++){
			int r=l+t-1;
			upd(fl[l][r][m[l]],f[l+1][r]);
			for(int k=l;k<=r;k++) if(c[k]==c[l]) for(int i=1;i<s-m[k];i++) upd(fl[l][r][i+m[k]],fl[l][k-1][i]+f[k+1][r]);
			upd(fr[l][r][m[r]],f[l][r-1]);
			for(int k=l;k<=r;k++) if(c[k]==c[r]) for(int i=1;i<s-m[k];i++) upd(fr[l][r][i+m[k]],fr[k+1][r][i]+f[l][k-1]);
			// if(c[l-1]==c[r+1]) continue;
			for(int k=l;k<r;k++) if(c[k]!=c[r+1]||c[k+1]!=c[l-1]) upd(f[l][r],f[l][k]+f[k+1][r]);
			if(c[l]!=c[r]) continue;
			upd(f[l][r],f[l+1][r-1]+p[m[l]+m[r]]);
			// for(int k=l+1;k<r;k++){
			// 	if(c[k]==c[l]){
			// 		for(int i=1;i<s;i++){
			// 			for(int j=1;j<s;j++){
			// 				if(i+m[k]<s||j+m[k]<s) upd(f[l][r],fl[l][k-1][i]+fr[k+1][r][j]+p[i+j+m[k]]);
			// 			}
			// 		}
			// 	}
			// }
			for(int k=l;k<r;k++){
				for(int i=1;i<s;i++){
					for(int j=1;j<s;j++){
						upd(f[l][r],fl[l][k][i]+fr[k+1][r][j]+p[i+j]);
					}
				}
			}
		}
	}
	printf("%lld",f[1][n]);
	return 0;
}
//dp[l][r][k][c]区间[l,r]剩下一个重量k,颜色为c的最大值

詳細信息

Test #1:

score: 100
Accepted
time: 0ms
memory: 11636kb

input:

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

output:

-1

result:

ok single line: '-1'

Test #2:

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

input:

5 7 500
2 3 2 3 2
5 6 6 6 4
1000 900 800 400 200 50

output:

1400

result:

ok single line: '1400'

Test #3:

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

input:

150 10 465782
6 1 4 3 2 6 1 3 5 3 4 6 1 2 1 5 1 6 2 1 5 4 6 1 3 2 6 5 4 3 1 6 3 4 1 4 1 6 3 6 1 4 2 4 6 4 3 1 5 6 4 2 1 4 6 2 5 1 3 1 4 6 5 6 3 2 3 4 2 3 6 3 5 2 6 1 5 4 5 2 4 1 4 3 4 1 3 2 6 1 4 5 4 6 2 1 3 1 2 1 3 5 2 3 2 6 5 3 1 4 1 5 1 6 2 5 4 2 4 1 4 2 5 6 4 3 5 1 3 2 5 4 6 4 3 5 3 4 5 3 2 1 4 ...

output:

392867316

result:

ok single line: '392867316'

Test #4:

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

input:

150 10 10105
8 6 8 6 8 3 8 5 8 5 1 5 1 5 6 5 6 5 6 7 6 5 6 1 6 4 6 4 3 4 9 4 1 4 1 4 1 5 1 9 1 4 1 9 1 9 3 9 1 9 5 9 8 9 8 5 8 7 8 4 8 6 8 6 2 6 9 6 4 6 5 6 5 3 5 1 5 4 5 8 5 8 9 8 7 8 6 8 1 8 1 8 1 8 1 6 1 7 1 7 2 7 4 7 6 7 4 7 4 5 4 7 4 7 4 3 4 3 7 3 2 3 8 3 4 3 4 8 4 7 4 9 4 2 4 2 7 2 8 2 7 2 9 2...

output:

9262990

result:

ok single line: '9262990'

Test #5:

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

input:

150 10 491282
5 7 1 4 5 3 5 3 5 6 7 3 6 3 4 5 4 2 3 7 3 4 7 2 3 7 5 4 6 1 7 5 2 6 4 1 6 2 5 4 1 3 6 7 5 6 2 1 3 2 1 7 1 2 6 1 2 6 4 3 7 6 5 3 5 4 1 2 7 1 5 6 2 6 5 1 3 5 6 3 4 5 1 3 7 4 6 4 2 6 3 7 5 7 1 2 7 4 3 2 1 4 2 7 4 6 2 3 6 4 7 1 5 3 2 1 3 4 3 6 7 3 7 5 6 2 4 2 1 3 2 3 7 5 3 5 6 4 6 1 2 6 7 ...

output:

300542698

result:

ok single line: '300542698'

Test #6:

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

input:

150 10 999660
2 1 7 4 6 1 6 2 1 3 4 6 2 7 2 3 2 4 8 3 5 8 7 8 3 5 7 3 4 6 7 6 3 5 6 8 4 2 3 7 6 5 8 7 5 2 4 8 4 8 3 6 4 6 2 8 4 5 3 5 6 3 5 4 5 2 7 5 1 8 1 3 2 1 7 5 7 8 2 5 1 4 3 7 5 8 6 3 7 2 1 5 2 3 5 3 7 2 7 8 5 8 1 5 6 1 6 4 7 5 1 5 1 2 5 2 8 7 5 6 7 6 7 6 2 7 6 8 6 5 4 3 8 7 2 8 6 3 6 1 2 6 8 ...

output:

670043245

result:

ok single line: '670043245'

Test #7:

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

input:

150 10 657385
9 8 2 1 8 2 3 8 9 7 1 9 1 7 3 2 3 9 3 1 6 2 4 1 8 1 7 3 2 8 7 6 8 2 3 9 8 5 1 7 8 1 3 5 8 5 6 3 9 6 5 8 3 4 1 3 8 1 8 6 2 5 2 9 8 5 2 4 7 3 2 3 1 3 7 2 5 1 2 9 8 9 8 6 8 4 7 6 3 8 5 7 2 8 5 8 6 5 1 3 8 2 1 7 3 6 3 5 2 7 8 1 9 5 8 3 6 2 7 3 8 7 4 1 7 5 3 4 1 4 6 5 4 7 3 9 3 9 7 5 8 7 5 ...

output:

617669855

result:

ok single line: '617669855'

Test #8:

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

input:

150 10 610355
10 1 7 9 8 2 9 4 10 8 9 3 5 1 10 5 10 4 5 6 7 6 10 9 7 9 3 4 7 5 2 6 10 3 2 10 8 3 5 2 5 8 6 2 9 6 3 8 6 5 4 9 3 1 5 3 2 9 4 2 4 10 9 4 5 2 3 5 9 3 5 1 5 3 7 5 3 9 6 1 7 3 7 5 1 3 9 1 6 4 10 7 9 5 9 7 3 7 4 9 2 3 4 9 10 3 1 4 3 1 6 9 1 8 1 3 8 2 8 1 6 1 5 4 10 2 9 3 9 5 2 6 8 3 9 5 2 3...

output:

531487920

result:

ok single line: '531487920'

Test #9:

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

input:

150 10 213291
5 2 9 4 11 7 1 6 11 7 4 10 8 5 11 6 11 9 8 3 6 3 8 7 3 6 4 9 5 2 7 11 2 8 5 1 11 2 3 1 10 8 7 4 11 9 7 5 3 10 9 6 7 5 4 9 3 8 10 8 3 11 3 5 6 8 10 1 5 3 1 9 2 7 3 7 2 5 6 2 11 5 11 6 7 1 7 3 7 8 11 5 4 10 3 8 7 5 1 10 5 2 1 7 3 8 7 2 9 2 1 10 4 7 8 11 6 4 10 1 2 9 5 4 8 11 3 7 1 11 1 7...

output:

152312585

result:

ok single line: '152312585'

Test #10:

score: 0
Accepted
time: 19ms
memory: 11588kb

input:

150 10 217802
1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 ...

output:

-11543506

result:

ok single line: '-11543506'

Test #11:

score: 0
Accepted
time: 19ms
memory: 11632kb

input:

150 10 173796
1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 ...

output:

-5909064

result:

ok single line: '-5909064'

Test #12:

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

input:

150 10 750989
2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 ...

output:

-28537582

result:

ok single line: '-28537582'

Test #13:

score: 0
Accepted
time: 19ms
memory: 11592kb

input:

150 10 475760
1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 ...

output:

-27594080

result:

ok single line: '-27594080'

Test #14:

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

input:

5 7 300
2 3 2 3 2
5 6 6 6 4
1000 900 800 400 200 50

output:

2600

result:

ok single line: '2600'

Test #15:

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

input:

150 10 795836
2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 ...

output:

-58891864

result:

ok single line: '-58891864'

Test #16:

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

input:

150 10 634984
1 3 2 1 3 2 1 2 3 1 3 1 2 3 1 2 3 2 3 1 3 2 1 3 2 1 2 3 1 2 1 2 1 3 2 1 3 2 3 1 2 1 2 1 3 1 3 2 3 1 2 1 2 3 1 2 1 2 1 2 3 1 2 1 3 1 2 1 3 1 2 3 2 3 1 2 3 1 2 1 3 2 3 2 3 1 2 1 2 1 3 2 1 3 2 3 2 3 1 2 1 3 2 1 2 3 1 3 1 2 3 1 2 3 1 2 1 2 3 2 1 3 1 3 1 3 1 3 2 1 3 1 3 2 3 2 3 2 3 1 3 1 2 ...

output:

-53338656

result:

ok single line: '-53338656'

Test #17:

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

input:

150 10 171347
1 3 1 3 1 3 1 3 2 1 3 1 3 2 1 2 1 3 1 2 1 2 3 1 3 1 3 1 3 1 3 2 3 2 3 1 2 3 1 3 2 1 2 1 3 1 2 1 2 1 2 1 3 1 2 1 3 2 1 3 1 3 1 2 3 2 3 1 2 3 2 1 2 3 1 2 3 2 3 2 3 1 2 3 1 2 1 2 1 3 2 3 2 1 2 3 2 1 2 3 1 2 3 1 3 1 2 1 3 2 1 2 1 3 2 3 2 1 3 2 1 3 2 3 2 3 2 3 1 2 3 2 1 3 1 3 1 2 1 3 1 3 2 ...

output:

-19362211

result:

ok single line: '-19362211'

Test #18:

score: 0
Accepted
time: 17ms
memory: 11592kb

input:

150 10 963860
3 2 1 3 2 1 2 3 2 3 1 2 1 3 2 3 2 1 2 1 2 1 3 1 3 2 3 2 1 2 1 2 3 2 1 3 1 2 1 2 3 1 3 2 1 3 2 3 1 3 1 3 2 3 2 1 2 1 3 2 3 1 3 2 1 3 2 1 2 1 3 1 3 2 1 2 3 2 3 1 3 1 2 3 2 1 2 3 1 3 2 3 1 3 2 1 3 1 2 3 2 1 3 2 3 2 3 1 2 3 1 3 1 3 1 3 1 2 1 3 2 3 2 3 2 3 2 3 1 3 1 2 3 2 1 3 1 3 1 2 3 1 2 ...

output:

-80964240

result:

ok single line: '-80964240'

Test #19:

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

input:

150 10 255588
2 3 1 3 2 1 2 1 2 3 1 2 1 2 3 2 1 3 1 3 2 1 2 1 2 1 3 1 2 1 3 2 3 2 1 2 1 3 2 1 2 1 2 1 3 2 3 2 1 2 3 2 3 1 2 3 2 1 2 3 2 1 2 3 2 1 2 1 2 1 3 2 1 2 1 2 1 2 1 2 1 3 2 3 1 2 3 1 2 3 1 2 1 3 1 3 1 3 1 3 2 1 3 2 1 2 3 1 2 3 2 3 1 3 1 2 3 1 3 1 3 2 1 2 3 2 3 1 2 1 3 2 3 1 3 1 2 3 1 3 1 2 3 ...

output:

-24792036

result:

ok single line: '-24792036'

Test #20:

score: 0
Accepted
time: 17ms
memory: 11632kb

input:

150 10 12700
1 2 1 3 2 3 2 1 2 1 2 1 3 2 1 2 3 2 1 3 2 3 1 3 2 1 3 2 3 1 3 1 2 1 3 2 1 3 2 1 3 1 2 3 1 3 2 3 2 3 1 3 1 3 2 1 3 2 3 1 2 3 2 1 3 1 2 3 1 2 1 2 3 2 1 3 2 3 2 3 1 3 2 3 1 2 3 1 3 1 3 1 2 3 2 1 3 1 2 3 2 3 2 3 1 3 2 1 3 2 3 2 1 3 1 2 3 1 2 1 2 1 2 3 2 1 2 3 2 1 2 1 2 3 2 1 2 1 3 1 2 1 2 1...

output:

-1193800

result:

ok single line: '-1193800'

Test #21:

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

input:

150 10 9220
3 4 1 3 4 1 4 1 3 2 3 2 1 2 3 4 2 4 2 4 3 4 2 4 2 1 4 2 4 1 2 3 4 2 4 3 1 3 4 3 4 1 3 4 3 1 2 4 2 1 4 1 4 1 2 4 3 1 2 4 1 2 3 4 2 4 2 4 1 2 4 2 4 1 3 2 3 2 1 2 3 4 1 3 1 3 2 1 4 3 1 4 2 4 2 1 2 1 3 1 4 1 4 3 1 4 1 2 4 2 1 4 2 4 3 2 4 1 2 4 3 2 4 3 4 2 1 2 4 3 2 1 3 4 3 4 2 4 2 3 4 2 3 1 ...

output:

-1051080

result:

ok single line: '-1051080'

Test #22:

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

input:

150 10 777451
2 5 4 5 3 2 4 5 1 3 1 3 4 5 1 4 2 3 1 3 2 4 5 1 3 1 4 5 2 3 5 3 2 4 3 4 2 1 5 4 3 2 1 5 3 1 4 2 4 5 1 4 3 2 4 3 1 2 3 1 2 5 4 3 5 2 3 5 1 3 5 4 3 5 4 1 4 1 3 4 3 4 2 1 5 3 2 5 3 1 2 5 2 5 4 5 2 5 3 4 5 2 5 2 3 2 5 3 4 1 4 2 5 2 5 4 2 3 2 5 2 3 5 4 2 1 3 1 4 2 3 2 5 1 2 5 2 4 2 3 5 1 5 ...

output:

-166374514

result:

ok single line: '-166374514'

Test #23:

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

input:

150 10 506806
2 6 5 6 3 1 5 4 2 3 1 4 5 6 1 6 1 6 1 4 2 1 6 5 4 5 4 1 4 3 2 1 4 1 5 2 6 5 2 5 6 5 6 1 3 1 4 1 3 5 2 3 4 1 2 3 1 6 3 2 3 4 6 5 1 4 2 4 6 3 4 3 6 3 1 2 1 2 6 2 5 4 1 4 5 3 6 2 1 5 6 2 3 4 1 3 1 3 5 6 2 1 3 2 5 1 5 1 6 4 5 1 4 2 1 3 2 3 4 3 5 4 1 3 1 2 1 2 5 3 5 1 4 1 4 5 4 1 2 5 2 1 4 ...

output:

-97306752

result:

ok single line: '-97306752'

Test #24:

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

input:

150 10 30952
1 2 6 1 6 4 1 7 2 5 2 6 2 3 1 2 7 4 3 4 1 4 5 3 6 2 5 6 5 7 2 7 5 4 6 1 2 1 3 2 1 6 3 4 1 5 7 4 2 6 3 7 3 1 6 2 7 1 5 1 5 2 3 6 1 3 4 6 4 3 1 6 5 2 1 4 3 7 2 6 1 4 3 4 6 1 6 5 1 6 4 1 3 5 3 7 5 6 7 5 7 3 4 7 3 2 5 2 6 3 7 6 3 2 4 6 5 6 5 6 1 5 1 4 1 5 1 7 5 2 7 6 2 5 3 1 5 1 5 3 4 2 1 4...

output:

-7118960

result:

ok single line: '-7118960'

Test #25:

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

input:

5 7 600
2 3 2 3 2
5 6 6 6 4
1000 900 800 400 200 50

output:

1250

result:

ok single line: '1250'

Test #26:

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

input:

150 10 933510
6 1 4 2 6 5 4 8 2 5 8 7 4 7 2 7 5 3 7 1 8 7 2 7 1 8 4 3 4 8 6 1 6 2 4 7 3 4 3 7 2 4 1 4 7 1 8 3 5 4 3 6 1 5 6 1 3 1 8 5 2 3 6 5 3 5 6 5 1 5 2 8 7 5 6 3 6 1 3 5 7 6 8 7 6 3 1 5 1 2 3 4 5 6 8 3 4 6 2 8 4 8 3 8 1 7 6 4 6 1 2 1 3 2 8 6 5 8 1 7 6 3 4 1 6 3 4 2 1 7 6 8 7 3 8 4 7 8 6 3 4 5 8 ...

output:

-237111540

result:

ok single line: '-237111540'

Test #27:

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

input:

150 10 559439
102 55 121 23 37 91 88 31 8 33 19 63 61 99 53 117 58 17 9 42 25 123 80 19 47 10 143 85 125 24 44 55 18 136 44 37 26 71 76 26 149 11 126 97 140 67 147 121 106 123 59 49 130 14 114 132 41 112 23 97 145 122 95 146 27 68 76 17 105 150 33 120 48 37 113 81 21 86 109 53 142 131 3 117 128 144 ...

output:

-281406698

result:

ok single line: '-281406698'

Test #28:

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

input:

150 10 464217
100 121 30 43 78 43 122 3 5 102 115 23 54 8 90 91 39 137 58 144 1 131 66 78 25 20 30 20 11 136 93 149 123 138 145 57 141 17 12 135 64 110 119 109 87 78 50 16 141 86 66 140 107 125 78 145 79 36 28 80 15 141 138 32 16 129 111 18 8 46 126 92 59 6 110 58 86 104 80 3 82 59 19 105 110 31 135...

output:

-249900168

result:

ok single line: '-249900168'

Test #29:

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

input:

150 10 773730
9 137 64 108 71 59 34 8 87 35 40 36 20 50 64 32 25 50 1 33 124 100 130 114 55 20 29 127 68 59 74 147 126 60 123 65 115 101 60 61 49 128 142 84 35 122 134 109 34 148 132 40 46 53 111 32 1 77 44 77 82 52 37 57 34 36 97 145 114 101 110 4 124 31 12 2 116 38 55 129 150 78 145 147 102 32 9 4...

output:

-447169365

result:

ok single line: '-447169365'

Test #30:

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

input:

150 10 938948
146 28 57 1 96 11 38 93 127 8 3 84 28 85 24 25 32 44 36 121 43 113 137 119 136 56 135 37 92 34 8 123 142 114 7 29 47 25 145 126 53 136 42 43 137 71 141 111 54 117 63 1 64 142 110 81 94 64 56 29 126 46 55 103 44 48 104 125 126 42 70 28 37 109 86 113 114 3 72 19 135 36 12 71 103 48 124 6...

output:

-389813962

result:

ok single line: '-389813962'

Test #31:

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

input:

150 10 595767
133 28 91 35 36 103 25 80 116 42 147 143 97 112 95 27 102 10 114 64 125 103 94 126 84 32 67 2 138 37 144 14 32 47 146 28 112 117 31 135 87 109 21 38 20 28 10 27 15 38 45 46 134 141 52 29 98 86 27 46 51 113 112 114 119 125 105 137 27 75 135 112 12 25 44 4 143 89 78 70 88 44 129 31 9 73 ...

output:

-283037629

result:

ok single line: '-283037629'

Test #32:

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

input:

150 2 698976
3 4 2 3 1 2 4 1 4 1 3 4 3 2 1 4 2 4 1 4 1 4 3 4 3 4 3 2 1 2 1 4 3 4 1 2 3 1 3 1 3 4 2 3 4 1 2 1 4 2 1 4 3 1 4 2 4 3 4 2 3 1 4 2 1 2 1 2 1 3 4 1 4 3 2 4 3 1 3 1 3 1 4 2 1 3 4 3 2 1 2 1 4 1 3 1 4 3 2 4 3 4 1 3 1 3 4 3 2 3 1 4 1 4 1 2 4 3 1 2 4 3 1 2 1 3 1 3 1 4 2 1 4 2 4 1 3 1 3 2 3 2 4 2...

output:

90368904

result:

ok single line: '90368904'

Test #33:

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

input:

150 3 611547
4 3 1 2 1 4 3 4 3 4 1 4 1 4 1 3 1 3 1 2 4 3 4 1 4 3 2 3 4 3 4 3 4 1 2 4 1 3 1 3 1 4 2 1 2 4 2 1 2 3 1 3 1 3 4 3 1 3 1 4 3 1 2 4 2 3 2 1 4 3 2 4 3 1 4 1 2 3 4 1 4 3 2 1 4 2 3 2 1 4 3 2 3 1 4 3 4 3 2 1 4 2 3 4 2 3 1 4 1 4 2 3 2 4 3 4 2 4 2 1 4 2 4 3 1 2 3 2 4 3 4 2 4 3 1 4 1 3 2 4 3 2 3 2...

output:

100207797

result:

ok single line: '100207797'

Test #34:

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

input:

150 4 287241
3 4 3 2 4 1 3 2 3 1 2 1 3 2 3 4 3 1 4 3 4 1 4 3 2 4 2 1 3 4 1 3 4 1 3 1 2 1 4 3 4 1 3 1 2 4 2 4 3 2 4 2 4 3 1 2 4 3 4 1 3 1 2 4 2 1 4 1 2 3 4 3 2 3 2 3 1 4 1 2 4 2 1 3 4 1 2 3 1 2 1 4 3 2 4 1 4 1 2 4 3 2 1 3 4 3 2 4 3 2 3 4 3 2 1 3 4 1 4 2 4 1 2 4 2 3 4 3 4 3 1 3 2 4 2 3 2 1 4 3 2 4 1 4...

output:

75840267

result:

ok single line: '75840267'

Test #35:

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

input:

150 5 653082
3 2 3 4 2 1 4 1 3 1 3 1 4 1 4 1 2 1 2 4 1 4 3 4 3 2 3 2 3 2 4 1 3 2 1 2 1 4 3 4 1 4 1 3 4 2 4 3 1 2 1 2 3 2 4 2 4 2 1 4 3 1 4 2 4 2 4 3 1 3 1 4 2 3 2 4 3 1 3 2 4 3 4 3 4 2 3 4 1 4 2 3 1 4 1 2 1 3 2 3 2 1 2 3 1 4 2 3 2 4 2 1 2 1 4 3 4 3 2 3 1 4 3 4 3 1 3 1 2 4 2 4 2 3 2 4 3 1 2 4 2 4 3 4...

output:

191322355

result:

ok single line: '191322355'

Test #36:

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

input:

1 10 351493
1
1
11 12 13 14 15 16 17 18 19

output:

-3163426

result:

ok single line: '-3163426'

Test #37:

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

input:

150 6 859111
3 4 3 4 3 2 4 1 2 1 2 1 2 4 1 2 3 1 4 1 4 3 2 4 2 1 2 4 3 4 2 1 4 2 1 2 4 1 4 2 4 3 2 1 4 2 3 2 3 2 3 4 2 3 4 3 4 2 3 4 3 4 3 2 4 2 4 3 1 2 3 1 2 3 4 1 2 4 1 2 4 2 3 4 3 1 3 1 2 1 3 1 4 3 2 4 1 3 2 4 3 2 3 1 2 1 2 4 1 3 2 3 2 1 2 1 3 4 1 4 3 4 1 2 4 2 4 2 4 1 4 1 2 1 3 2 1 4 2 1 3 2 4 3...

output:

489613108

result:

ok single line: '489613108'

Test #38:

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

input:

150 10 1000000
104 92 48 121 48 13 48 15 48 138 48 61 48 3 16 48 67 48 16 48 87 48 15 48 144 48 140 48 2 5 90 48 86 50 48 57 48 64 48 114 48 40 48 39 48 123 61 57 48 136 63 48 127 48 62 64 63 48 134 47 48 97 48 52 48 104 65 48 29 119 48 57 111 48 149 48 51 48 23 48 50 48 147 48 130 48 27 48 112 48 4...

output:

112249839

result:

ok single line: '112249839'

Test #39:

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

input:

150 10 1000000
111 14 58 146 43 14 59 2 14 107 78 14 73 14 52 14 54 14 74 14 82 14 1 68 143 14 3 14 123 14 137 14 33 14 121 18 14 69 136 14 46 75 14 69 14 66 48 131 3 14 91 127 14 109 14 23 14 115 121 14 109 14 50 21 36 127 21 2 14 98 14 102 14 76 14 97 132 14 118 47 14 71 14 17 14 33 14 67 14 43 14...

output:

118249836

result:

ok single line: '118249836'

Test #40:

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

input:

150 10 1000000
16 111 76 51 111 85 124 111 77 111 120 111 97 111 140 111 37 39 111 76 111 62 75 25 7 111 10 111 47 111 44 11 33 111 75 111 60 111 35 111 15 7 124 102 94 22 111 43 111 149 18 51 24 111 8 111 55 111 57 111 1 111 30 67 77 111 24 103 111 12 111 46 119 111 31 117 111 73 111 38 111 6 111 1...

output:

121874833

result:

ok single line: '121874833'

Test #41:

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

input:

150 10 1000000
77 146 99 55 77 64 77 130 77 101 77 119 72 77 61 77 89 77 72 110 77 143 53 77 112 149 77 3 77 138 77 116 77 126 77 43 77 74 127 29 77 150 93 77 11 58 77 62 77 112 77 42 77 44 109 77 38 77 109 77 14 77 22 77 43 77 102 77 128 47 77 136 77 43 124 77 103 77 83 77 123 77 52 81 77 139 77 61...

output:

137749851

result:

ok single line: '137749851'

Test #42:

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

input:

150 10 1000000
43 129 43 8 43 54 138 44 43 114 142 43 70 43 59 43 65 43 54 43 145 43 34 16 110 43 12 43 130 43 105 101 43 130 43 124 136 43 138 145 43 142 43 51 43 49 43 87 30 96 44 125 43 49 76 110 43 7 133 43 87 43 98 53 43 150 43 61 115 7 43 86 43 57 43 51 73 43 126 43 112 113 43 150 17 100 43 54...

output:

108124862

result:

ok single line: '108124862'

Test #43:

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

input:

150 10 1000000
9 128 15 31 9 74 9 92 9 127 9 39 5 9 77 9 79 128 9 56 47 9 12 70 42 9 134 9 18 9 33 9 33 102 127 9 104 9 73 56 9 42 123 17 9 19 9 141 9 56 9 122 42 9 100 24 9 76 9 92 40 9 37 9 25 9 141 9 22 9 29 9 56 9 143 9 23 22 9 62 9 137 9 86 9 20 9 80 9 66 57 42 9 84 9 60 9 149 18 148 9 45 9 57 ...

output:

146624853

result:

ok single line: '146624853'

Test #44:

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

input:

150 10 1000000
95 106 134 106 58 106 131 106 66 106 72 106 92 67 81 101 106 25 106 147 6 97 106 145 106 28 21 106 31 106 66 106 35 122 106 150 106 7 106 71 27 111 106 137 106 87 114 106 122 145 106 90 106 2 106 40 106 61 65 7 106 63 56 128 106 17 106 142 106 83 75 131 106 1 23 106 75 106 76 106 22 1...

output:

142249835

result:

ok single line: '142249835'

Test #45:

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

input:

150 10 1000000
72 30 72 61 72 11 72 69 72 146 72 19 72 61 72 18 122 72 44 72 86 81 72 12 72 135 72 45 72 4 72 103 72 88 72 78 72 37 72 17 72 67 72 56 7 72 111 72 132 72 3 72 31 72 9 110 18 54 94 72 121 72 29 72 138 39 72 61 72 32 59 72 56 72 62 146 72 5 72 15 72 43 72 115 72 140 72 98 72 32 72 88 76...

output:

150624824

result:

ok single line: '150624824'

Test #46:

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

input:

150 10 1000000
126 73 117 38 148 38 122 84 113 54 38 57 38 2 38 85 128 38 130 38 106 89 139 38 123 38 43 38 91 38 3 38 111 143 38 41 98 83 38 98 13 131 38 123 38 123 1 38 81 22 38 109 102 38 94 38 103 38 128 33 38 108 38 122 38 73 38 21 38 87 38 73 38 86 140 38 112 38 6 14 38 127 38 125 65 134 121 3...

output:

124624843

result:

ok single line: '124624843'

Test #47:

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

input:

150 10 1
2 4 1 4 1 4 3 2 4 3 2 4 2 3 1 3 1 3 1 2 4 3 2 4 1 2 3 1 4 1 3 2 4 2 3 4 2 4 3 4 3 1 3 1 3 4 2 4 3 2 1 2 1 2 4 3 1 2 4 2 4 3 1 2 1 4 1 2 1 4 2 4 2 4 1 3 2 3 4 3 2 1 2 1 4 2 4 3 2 4 1 3 2 4 2 4 3 1 4 1 2 4 3 4 2 3 4 3 4 2 3 1 4 3 2 3 4 3 4 2 3 1 2 3 4 3 1 4 3 4 3 4 2 1 3 2 3 1 3 1 4 3 1 3 1 3...

output:

149999998650

result:

ok single line: '149999998650'

Test #48:

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

input:

150 10 1000000
4 116 4 129 4 68 131 136 4 41 4 41 4 11 4 122 4 17 103 94 4 54 4 111 64 4 67 85 4 150 15 4 140 29 4 75 4 68 4 112 70 4 107 108 112 6 4 57 4 147 4 5 4 33 4 141 4 59 4 14 4 58 4 120 4 30 8 4 71 4 18 4 11 4 87 4 2 4 123 4 52 85 56 4 65 72 4 82 4 68 4 41 4 120 4 118 4 120 4 36 38 4 40 4 6...

output:

138249860

result:

ok single line: '138249860'

Test #49:

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

input:

150 10 10149
3 2 3 1 3 2 3 1 3 2 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 2 3 1 3 1 3 2 1 3 1 2 1 3 1 3 2 1 3 2 3 1 2 3 2 1 3 2 3 2 3 2 3 1 2 3 1 3 1 3 1 2 3 1 3 2 3 2 3 1 3 2 1 3 2 3 1 2 1 3 2 3 1 3 1 3 2 3 1 3 1 3 1 2 3 2 3 1 2 3 1 2 3 2 3 1 2 1 3 1 3 1 3 1 2 3 2 3 2 3 1 3 2 1 2 3 1 3 1 3 2 3 2 3 2 3 1 3 2 3...

output:

10134355

result:

ok single line: '10134355'

Test #50:

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

input:

150 10 10069
1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2...

output:

9730616

result:

ok single line: '9730616'

Test #51:

score: 0
Accepted
time: 12ms
memory: 11632kb

input:

150 10 10072
8 3 8 3 8 1 8 4 8 4 8 5 8 4 8 7 2 3 8 2 8 7 8 4 1 4 7 8 4 8 2 8 6 8 7 6 8 7 2 8 3 8 1 8 2 8 5 8 6 1 6 8 1 8 7 8 2 8 1 8 4 2 8 7 8 6 8 4 7 1 8 1 8 5 1 8 1 8 1 8 2 5 8 2 7 8 5 8 6 8 1 5 7 8 4 8 3 2 8 5 8 3 8 5 4 8 6 8 6 8 2 4 8 1 8 4 1 8 5 3 8 1 8 7 4 6 8 5 2 4 8 6 7 8 4 8 7 1 8 1 5 8 6 2...

output:

10571936

result:

ok single line: '10571936'

Test #52:

score: 0
Accepted
time: 17ms
memory: 11632kb

input:

150 10 10149
1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2...

output:

9670481

result:

ok single line: '9670481'

Test #53:

score: 0
Accepted
time: 17ms
memory: 11572kb

input:

150 10 10182
1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2...

output:

9717068

result:

ok single line: '9717068'

Test #54:

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

input:

150 10 10167
2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1...

output:

9688457

result:

ok single line: '9688457'

Test #55:

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

input:

150 10 10099
8 2 8 4 8 4 8 6 8 4 3 8 3 8 1 8 4 7 8 2 4 8 4 8 2 8 4 8 7 8 3 8 2 8 6 8 6 8 3 2 8 3 8 1 5 8 6 4 8 5 8 2 8 7 8 1 8 3 8 1 8 2 8 1 7 8 5 8 4 8 4 8 3 8 2 8 3 8 2 8 3 8 7 4 8 2 8 1 3 8 7 8 7 8 6 8 1 4 8 1 8 4 6 8 7 4 8 3 8 1 6 7 8 7 8 6 1 2 8 4 6 8 7 6 1 8 3 8 4 8 5 4 8 2 8 1 8 5 8 3 8 6 2 7...

output:

10338615

result:

ok single line: '10338615'

Test #56:

score: 0
Accepted
time: 21ms
memory: 11588kb

input:

150 10 10084
2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1...

output:

9748744

result:

ok single line: '9748744'

Test #57:

score: 0
Accepted
time: 21ms
memory: 11528kb

input:

150 10 10196
1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2...

output:

9694912

result:

ok single line: '9694912'

Test #58:

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

input:

150 10 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:

149999998650

result:

ok single line: '149999998650'

Test #59:

score: 0
Accepted
time: 21ms
memory: 11572kb

input:

150 10 10154
2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1...

output:

9729210

result:

ok single line: '9729210'

Test #60:

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

input:

150 10 10160
2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1...

output:

9708080

result:

ok single line: '9708080'

Test #61:

score: 0
Accepted
time: 21ms
memory: 11588kb

input:

150 10 10126
1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2...

output:

9684880

result:

ok single line: '9684880'

Test #62:

score: 0
Accepted
time: 21ms
memory: 11584kb

input:

150 10 10080
2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1...

output:

9550080

result:

ok single line: '9550080'

Test #63:

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

input:

150 10 10151
2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1...

output:

9871729

result:

ok single line: '9871729'

Test #64:

score: 0
Accepted
time: 21ms
memory: 11632kb

input:

150 10 10069
1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2...

output:

9831306

result:

ok single line: '9831306'

Test #65:

score: 0
Accepted
time: 21ms
memory: 11432kb

input:

150 10 10084
1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2...

output:

9759668

result:

ok single line: '9759668'

Test #66:

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

input:

150 10 10094
6 4 2 3 6 1 4 6 3 6 2 4 2 6 3 2 6 2 3 5 6 4 6 4 2 3 6 2 6 4 5 6 1 6 4 6 5 4 1 6 3 6 4 6 1 6 5 6 5 6 1 6 3 5 6 3 4 1 2 6 1 6 1 3 6 5 6 3 6 1 2 6 2 6 2 6 5 6 4 6 5 6 5 4 1 6 2 6 1 6 3 2 6 5 6 5 6 2 6 2 6 3 6 2 6 1 6 2 4 2 6 1 6 5 3 6 2 6 1 6 1 6 3 6 3 6 2 3 6 4 2 6 4 6 4 5 6 3 6 1 6 2 6 5...

output:

10389660

result:

ok single line: '10389660'

Test #67:

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

input:

150 10 10080
4 2 3 1 4 2 4 3 4 1 4 2 4 3 4 3 4 1 4 1 4 1 4 3 4 3 4 1 4 1 4 2 4 1 4 2 1 4 3 1 2 3 4 1 4 3 4 1 4 2 3 4 3 2 4 2 4 2 4 1 2 3 2 4 2 4 2 4 2 4 1 3 4 3 4 3 4 2 4 1 4 3 4 3 2 4 1 4 3 4 2 4 1 2 4 2 4 2 4 2 4 3 4 1 4 1 4 2 4 1 4 1 4 1 4 2 4 1 4 2 4 1 4 3 4 1 4 1 4 2 4 3 4 2 4 1 4 2 1 4 3 4 1 3...

output:

10071840

result:

ok single line: '10071840'

Test #68:

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

input:

150 10 10083
2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1...

output:

9739625

result:

ok single line: '9739625'

Test #69:

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

input:

150 10 398360
1 3 1 2 3 1 2 3 1 2 1 2 3 1 3 1 3 2 3 1 2 1 3 1 3 1 3 2 1 2 3 1 2 3 2 1 2 3 1 3 1 3 1 2 3 2 1 2 1 3 1 2 1 3 2 3 2 3 1 3 2 3 1 3 1 2 3 1 2 3 1 2 3 2 1 3 2 3 2 1 2 1 3 2 1 3 2 3 1 3 2 3 1 2 3 2 3 1 2 3 2 1 2 1 2 1 3 2 1 3 1 2 3 2 1 3 2 3 2 3 1 2 3 2 1 3 2 3 1 2 3 2 3 1 3 1 2 1 2 3 1 2 3 ...

output:

317953828

result:

ok single line: '317953828'

Test #70:

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

input:

150 10 10126
1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2...

output:

9803872

result:

ok single line: '9803872'

Test #71:

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

input:

150 10 10156
3 1 3 2 3 2 3 2 3 4 3 2 3 4 3 4 3 4 1 4 1 4 1 4 2 4 3 4 2 4 2 4 2 3 2 1 2 1 2 3 2 3 2 3 2 3 4 3 1 3 1 3 1 3 4 3 2 3 2 3 4 3 4 1 4 2 4 3 4 1 4 2 4 3 4 3 2 3 2 3 1 3 2 3 1 3 2 3 2 3 1 2 1 4 1 4 1 4 1 3 1 2 1 2 1 3 4 3 4 3 1 3 4 3 4 3 1 3 1 3 1 4 1 3 1 4 1 2 1 4 1 4 1 3 1 4 3 4 1 4 1 4 1 4...

output:

9420344

result:

ok single line: '9420344'

Test #72:

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

input:

150 10 10186
1 5 1 2 1 5 1 3 1 4 1 4 1 4 1 4 5 4 5 4 3 4 3 4 1 4 2 4 2 4 1 5 1 4 1 2 1 3 1 5 1 3 1 2 1 4 3 4 1 4 5 4 3 4 1 4 3 4 2 4 2 4 2 4 2 4 2 3 2 4 2 3 2 5 2 3 2 3 1 3 1 3 1 3 1 3 2 3 5 3 5 3 5 4 5 4 5 4 5 4 5 1 5 1 5 1 5 1 4 1 5 1 3 1 3 1 5 1 5 1 3 5 3 2 3 1 3 5 3 4 3 5 3 5 3 1 3 1 2 1 2 1 2 1...

output:

9667494

result:

ok single line: '9667494'

Test #73:

score: 0
Accepted
time: 12ms
memory: 11580kb

input:

150 10 10169
5 4 5 3 5 2 5 2 5 1 5 3 5 2 5 1 3 1 2 1 4 1 3 1 2 1 5 1 3 1 3 1 3 4 3 1 3 2 3 4 3 4 3 5 3 1 3 1 5 1 5 1 5 1 2 1 4 1 4 1 5 4 5 1 5 1 5 3 5 2 5 1 5 1 5 1 4 1 3 1 3 1 5 1 5 1 4 1 2 1 5 1 5 3 5 2 5 1 5 1 5 1 5 4 5 3 4 3 1 3 2 3 5 3 1 3 2 3 2 3 2 3 2 3 2 3 2 1 2 5 2 3 2 5 2 4 5 4 5 4 5 4 1 4...

output:

9467861

result:

ok single line: '9467861'

Test #74:

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

input:

150 10 10073
4 2 4 1 4 2 4 2 4 3 4 2 4 1 4 1 2 1 3 1 3 1 3 1 2 1 4 1 3 1 2 1 2 4 2 4 2 3 2 3 2 3 2 3 2 1 3 1 2 1 2 1 3 1 3 1 4 1 2 1 4 1 4 2 4 2 4 3 4 3 4 2 4 2 4 3 1 3 2 3 2 3 4 3 4 3 4 3 2 3 4 2 4 1 4 3 4 2 4 3 4 1 4 2 4 2 4 2 1 2 4 2 1 2 1 2 4 2 3 2 3 2 3 4 3 2 3 4 3 4 3 4 3 2 3 2 4 2 4 2 3 2 1 2...

output:

9391240

result:

ok single line: '9391240'

Test #75:

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

input:

150 10 10050
5 4 5 7 5 1 5 4 5 3 5 6 5 7 5 3 6 3 6 3 7 3 2 3 7 3 4 3 5 3 4 1 4 8 4 3 4 3 4 7 4 6 4 3 4 1 6 1 2 1 6 1 2 1 4 1 5 1 7 1 8 7 8 4 8 5 8 2 8 3 8 5 8 2 8 4 3 4 3 4 6 4 6 4 7 4 6 4 8 4 2 5 2 8 2 1 2 5 2 7 2 8 2 6 2 1 5 1 5 1 2 1 4 1 3 1 5 1 2 1 2 7 2 8 2 3 2 7 2 5 2 8 2 1 2 8 5 8 3 8 5 8 4 8...

output:

9473900

result:

ok single line: '9473900'

Test #76:

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

input:

150 10 10163
5 1 5 8 5 1 5 8 5 3 5 6 5 3 5 8 7 8 7 8 7 8 6 8 3 8 6 8 4 8 2 7 2 1 2 7 2 6 2 3 2 3 2 7 2 6 1 6 7 6 1 6 7 6 3 6 2 6 8 6 1 2 1 5 1 5 1 7 1 4 1 8 1 5 1 4 7 4 2 4 6 4 1 4 6 4 7 4 6 4 6 8 6 8 6 1 6 4 6 1 6 8 6 5 6 3 6 3 7 3 6 3 4 3 1 3 4 3 8 3 4 7 4 8 4 8 4 5 4 6 4 8 4 3 4 7 1 7 3 7 5 7 8 7...

output:

9467017

result:

ok single line: '9467017'

Test #77:

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

input:

150 10 10150
3 8 3 4 3 8 3 1 3 8 3 1 3 7 3 5 4 5 3 5 7 5 2 5 6 5 3 5 6 5 8 5 8 2 8 3 8 2 8 3 8 7 8 1 8 4 1 4 7 4 5 4 2 4 1 4 5 4 6 4 3 6 3 7 3 7 3 5 3 8 3 4 3 1 3 6 4 6 5 6 5 6 7 6 1 6 8 6 2 6 5 7 5 1 5 3 5 1 5 4 5 2 5 1 5 8 1 8 4 8 4 8 7 8 6 8 1 8 7 8 4 1 4 6 4 8 4 3 4 3 4 5 4 8 4 7 8 7 2 7 6 7 1 7...

output:

9512450

result:

ok single line: '9512450'

Test #78:

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

input:

150 10 10072
1 4 1 4 1 2 1 4 1 4 1 3 1 2 1 2 3 2 1 2 3 2 4 2 4 2 1 2 1 2 1 2 1 4 1 3 1 3 1 4 1 4 1 2 1 3 4 3 1 3 1 3 4 3 1 3 1 3 2 3 1 3 1 2 1 3 1 3 1 3 1 2 1 3 1 2 3 2 3 2 1 2 4 2 3 2 1 2 4 2 4 2 4 2 4 3 4 3 4 2 4 3 4 2 4 2 1 2 4 2 3 2 3 2 3 2 3 2 3 2 4 3 4 3 4 3 4 1 4 2 4 1 4 3 4 1 4 1 2 1 3 1 2 1...

output:

9531648

result:

ok single line: '9531648'

Test #79:

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

input:

150 10 10083
5 2 5 4 5 1 5 3 5 1 5 1 5 1 5 3 5 3 5 3 5 3 1 3 1 3 2 3 1 3 1 4 1 4 1 3 1 2 1 4 1 4 1 4 1 5 1 5 4 5 1 5 2 5 3 5 4 5 1 5 2 5 2 3 2 4 2 3 2 1 2 1 2 5 2 5 1 5 3 5 3 5 2 5 1 5 4 5 3 5 2 1 2 5 2 5 2 1 2 3 2 4 2 4 2 5 1 5 3 5 4 5 4 5 4 5 3 5 1 5 1 4 1 3 1 3 1 4 1 2 1 3 1 3 1 2 1 2 3 2 3 2 5 2...

output:

9390040

result:

ok single line: '9390040'

Test #80:

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

input:

150 10 339449
1 2 3 1 2 4 1 3 2 3 2 1 4 2 4 1 3 2 1 3 4 3 1 3 2 4 3 2 4 2 3 4 1 2 3 1 4 2 1 2 1 2 3 1 2 1 3 2 3 4 3 4 1 3 4 2 1 3 4 2 1 4 2 3 4 2 4 1 4 3 4 3 2 1 2 1 3 1 4 1 3 1 2 3 4 1 2 3 1 4 2 1 3 1 3 1 4 2 4 2 4 2 4 3 1 4 3 1 3 1 2 3 1 2 4 3 2 1 2 4 2 4 2 1 2 1 3 2 1 4 3 1 3 2 1 2 4 3 4 2 3 1 4 ...

output:

290970857

result:

ok single line: '290970857'

Test #81:

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

input:

150 10 10093
4 3 4 2 4 3 4 5 4 5 4 7 4 3 4 5 2 5 7 5 6 5 7 5 4 5 6 5 3 5 1 6 1 3 1 7 1 7 1 3 1 6 1 3 1 5 6 5 6 5 7 5 7 5 6 5 2 5 7 5 1 3 1 4 1 7 1 6 1 3 1 6 1 5 1 2 1 2 4 2 6 2 1 2 7 2 3 2 1 2 5 1 5 6 5 2 5 7 5 3 5 1 5 3 5 7 1 7 2 7 3 7 4 7 6 7 4 7 5 7 3 2 3 7 3 7 3 6 3 1 3 4 3 6 3 4 3 4 6 4 6 4 7 4...

output:

9418189

result:

ok single line: '9418189'

Test #82:

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

input:

150 10 10086
5 2 5 2 5 4 5 6 5 4 5 6 5 4 5 6 5 6 5 6 1 6 2 6 3 6 1 6 7 6 4 2 4 6 4 3 4 2 4 1 4 1 4 2 4 1 5 1 4 1 3 1 7 1 4 1 3 1 3 1 7 5 7 6 7 2 7 1 7 1 7 2 7 4 7 6 5 6 1 6 1 6 5 6 1 6 4 6 5 6 2 4 2 4 2 5 2 4 2 6 2 3 2 3 2 4 1 4 1 4 6 4 7 4 6 4 7 4 5 4 2 5 2 1 2 3 2 5 2 6 2 5 2 7 2 5 6 5 2 5 7 5 6 5...

output:

9469508

result:

ok single line: '9469508'

Test #83:

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

input:

150 10 10118
3 4 3 4 3 1 3 5 3 5 3 5 3 5 3 1 3 1 2 1 3 1 4 1 3 1 3 1 2 1 5 4 5 3 5 2 5 1 5 1 5 2 5 3 5 4 1 4 1 4 2 4 2 4 1 4 5 4 2 4 2 1 2 1 2 1 2 3 2 5 2 3 2 1 2 1 4 1 4 1 3 1 4 1 4 1 5 1 4 1 5 2 5 1 5 3 5 2 5 1 5 4 5 3 5 4 5 4 1 4 5 4 3 4 5 4 2 4 1 4 2 1 2 3 2 1 2 5 2 3 2 4 2 5 2 3 5 3 5 3 4 3 5 3...

output:

9565604

result:

ok single line: '9565604'

Test #84:

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

input:

150 10 10145
4 2 4 1 4 1 4 5 4 5 4 3 4 5 4 2 6 2 5 2 6 2 5 2 6 2 1 2 6 2 3 2 3 1 3 1 3 6 3 2 3 4 3 2 3 6 4 6 5 6 4 6 4 6 2 6 4 6 2 6 1 3 1 4 1 3 1 2 1 2 1 3 1 2 1 3 2 3 1 3 6 3 5 3 4 3 6 3 1 3 6 3 6 3 6 4 6 4 6 5 6 1 6 5 6 2 3 2 3 2 3 2 3 2 4 2 4 2 4 2 1 4 1 2 1 4 1 5 1 4 1 5 1 4 1 5 4 5 6 5 6 5 4 5...

output:

9531875

result:

ok single line: '9531875'

Test #85:

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

input:

150 10 10069
3 7 3 1 3 1 3 7 3 1 3 7 3 4 3 7 3 7 2 7 2 7 2 7 2 7 1 7 1 7 3 2 3 6 3 4 3 2 3 1 3 5 3 2 3 6 7 6 5 6 4 6 7 6 4 6 4 6 3 6 4 5 4 2 4 7 4 1 4 1 4 3 4 6 4 6 5 6 2 6 7 6 5 6 2 6 2 6 2 6 4 2 4 3 4 5 4 7 4 1 4 2 4 1 4 3 2 3 5 3 7 3 5 3 4 3 7 3 4 3 1 3 1 3 1 4 1 2 1 5 1 6 1 5 1 5 3 5 2 5 3 5 3 5...

output:

9541375

result:

ok single line: '9541375'

Test #86:

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

input:

150 10 10053
5 4 5 6 5 3 5 6 5 1 5 8 5 8 5 2 3 2 5 2 7 2 5 2 4 2 4 2 3 2 3 2 3 8 3 6 3 7 3 5 3 4 3 5 3 4 6 4 8 4 8 4 1 4 8 4 7 4 3 4 1 2 1 7 1 8 1 5 1 2 1 3 1 5 1 6 7 6 1 6 5 6 3 6 1 6 3 6 2 6 1 5 1 2 1 7 1 3 1 4 1 5 1 7 1 2 3 2 7 2 4 2 1 2 4 2 5 2 4 2 5 1 5 3 5 2 5 6 5 6 5 3 5 6 5 1 2 1 8 1 7 1 2 1...

output:

9663481

result:

ok single line: '9663481'

Test #87:

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

input:

150 10 10194
11 4 11 6 11 8 11 8 11 8 5 8 2 8 2 8 5 8 5 10 5 3 5 6 5 3 5 3 2 3 10 3 10 3 10 3 10 1 10 5 10 6 10 6 10 6 8 6 1 6 3 6 4 6 4 9 4 6 4 2 4 9 4 9 2 9 11 9 4 9 2 9 2 10 2 8 2 10 2 10 2 10 2 10 8 10 11 10 3 10 3 11 3 7 3 11 3 4 3 4 1 4 10 4 3 4 3 4 3 11 3 10 3 9 3 6 3 6 3 6 8 6 7 6 10 6 10 4 ...

output:

9209736

result:

ok single line: '9209736'

Test #88:

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

input:

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

output:

9248896

result:

ok single line: '9248896'

Test #89:

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

input:

150 10 10054
3 5 3 4 3 2 3 7 3 7 2 7 2 7 1 7 6 7 6 4 6 3 6 7 6 1 6 1 5 1 3 1 3 1 5 1 5 4 5 3 5 7 5 6 5 6 4 6 3 6 4 6 4 6 4 3 4 3 4 2 4 5 4 5 7 5 1 5 6 5 6 5 6 7 6 3 6 4 6 1 6 1 4 1 2 1 7 1 3 1 3 7 3 7 3 6 3 6 3 6 2 6 4 6 2 6 2 6 2 3 2 1 2 6 2 4 2 4 3 4 7 4 2 4 3 4 3 2 3 2 3 1 3 7 3 7 2 7 2 7 3 7 5 7...

output:

9480766

result:

ok single line: '9480766'

Test #90:

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

input:

150 10 10090
12 8 12 5 12 10 12 10 12 10 9 10 2 10 5 10 5 10 5 8 5 6 5 2 5 4 5 4 10 4 8 4 9 4 9 4 9 3 9 4 9 11 9 6 9 6 8 6 10 6 7 6 8 6 8 12 8 9 8 4 8 1 8 1 6 1 6 1 12 1 5 1 5 11 5 11 5 4 5 11 5 11 8 11 7 11 3 11 10 11 10 4 10 1 10 3 10 8 10 8 6 8 2 8 3 8 2 8 2 11 2 4 2 7 2 4 2 4 3 4 2 4 1 4 7 4 7 1...

output:

9346140

result:

ok single line: '9346140'

Test #91:

score: 0
Accepted
time: 12ms
memory: 11588kb

input:

150 10 284774
2 4 1 3 4 1 3 2 3 4 1 4 5 1 3 1 2 5 1 3 1 2 4 3 5 4 5 1 3 4 3 1 2 5 4 5 3 1 3 1 2 4 1 5 3 5 4 5 2 3 4 3 5 3 1 5 4 2 4 5 3 1 4 1 4 2 3 5 2 3 1 3 1 2 3 5 3 1 2 4 1 4 3 5 4 3 4 1 2 3 4 5 3 2 1 2 3 5 2 1 2 5 3 5 3 2 3 5 4 3 4 5 4 1 5 3 2 4 2 3 1 3 4 3 1 2 1 2 5 2 3 1 5 4 1 3 1 5 2 4 5 3 1 ...

output:

231264944

result:

ok single line: '231264944'

Test #92:

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

input:

150 10 10081
3 4 3 6 3 5 3 8 3 8 3 8 4 8 5 8 1 8 1 2 1 5 1 5 1 2 1 2 4 2 7 2 7 2 5 2 5 6 5 2 5 3 5 6 5 6 5 6 2 6 4 6 3 6 3 1 3 2 3 6 3 4 3 4 1 4 2 4 1 4 3 4 3 2 3 7 3 2 3 5 3 5 2 5 3 5 6 5 8 5 8 5 8 2 8 3 8 5 8 5 1 5 2 5 7 5 8 5 8 4 8 1 8 7 8 4 8 4 5 4 6 4 7 4 8 4 8 3 8 3 8 5 8 5 8 5 7 5 4 5 1 5 8 5...

output:

9339065

result:

ok single line: '9339065'

Test #93:

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

input:

150 10 10085
10 9 10 5 10 4 10 2 10 2 6 2 11 2 5 2 11 2 11 8 11 9 11 12 11 9 11 9 11 9 8 9 7 9 4 9 4 5 4 1 4 2 4 5 4 5 9 5 9 5 9 5 6 5 6 11 6 10 6 2 6 3 6 3 7 3 1 3 5 3 2 3 2 7 2 3 2 9 2 3 2 3 8 3 1 3 12 3 7 3 7 8 7 12 7 8 7 10 7 10 11 10 7 10 9 10 9 10 9 11 9 3 9 5 9 5 9 5 3 5 1 5 7 5 1 5 1 10 1 12...

output:

9484700

result:

ok single line: '9484700'

Test #94:

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

input:

150 10 10093
5 6 5 7 5 9 5 10 5 10 1 10 7 10 8 10 11 10 11 10 11 2 11 2 11 8 11 8 9 8 9 8 4 8 3 8 3 5 3 11 3 10 3 7 3 7 3 7 9 7 5 7 8 7 8 5 8 1 8 4 8 3 8 3 1 3 2 3 10 3 5 3 5 11 5 1 5 9 5 7 5 7 4 7 3 7 1 7 6 7 6 10 6 3 6 9 6 7 6 7 3 7 3 7 1 7 2 7 2 11 2 5 2 3 2 3 2 3 9 3 7 3 11 3 2 3 2 4 2 11 2 11 2...

output:

9364934

result:

ok single line: '9364934'

Test #95:

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

input:

150 10 10137
5 3 5 8 5 8 5 3 5 3 4 3 6 3 9 3 8 3 8 3 8 4 8 4 8 10 8 10 9 10 9 10 7 10 4 10 4 9 4 6 4 8 4 1 4 1 3 1 5 1 8 1 7 1 7 4 7 4 7 1 7 2 7 2 4 2 3 2 3 2 1 2 1 3 1 5 1 2 1 2 1 2 8 2 1 2 5 2 4 2 4 9 4 10 4 9 4 10 4 10 5 10 1 10 1 10 3 10 3 9 3 4 3 9 3 9 3 9 6 9 7 9 3 9 7 9 7 2 7 3 7 2 7 6 7 6 4 ...

output:

9267943

result:

ok single line: '9267943'

Test #96:

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

input:

150 10 10175
1 5 1 7 1 5 1 2 1 2 1 2 7 2 6 2 4 2 4 1 4 2 4 7 4 3 4 3 1 3 7 3 1 3 5 3 5 3 5 1 5 7 5 4 5 4 1 4 7 4 5 4 1 4 1 7 1 3 1 2 1 3 1 3 7 3 4 3 7 3 7 3 7 5 7 3 7 4 7 1 7 1 3 1 3 1 3 1 4 1 4 1 4 6 4 1 4 3 4 3 6 3 2 3 1 3 2 3 2 1 2 3 2 7 2 6 2 6 1 6 5 6 3 6 7 6 7 2 7 6 7 1 7 1 7 1 3 1 5 1 3 1 4 1...

output:

9433050

result:

ok single line: '9433050'

Test #97:

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

input:

150 10 10178
5 8 5 6 5 2 5 2 5 2 6 2 9 2 7 2 6 2 6 4 6 7 6 1 6 5 6 5 9 5 8 5 8 5 2 5 2 7 2 1 2 7 2 8 2 8 9 8 2 8 9 8 3 8 3 4 3 4 3 8 3 5 3 5 8 5 7 5 7 5 1 5 1 7 1 4 1 6 1 7 1 7 8 7 1 7 5 7 9 7 9 3 9 5 9 4 9 6 9 6 3 6 5 6 1 6 4 6 4 2 4 7 4 7 4 8 4 8 2 8 4 8 1 8 9 8 9 7 9 4 9 5 9 6 9 6 9 6 4 6 2 6 7 6...

output:

9473300

result:

ok single line: '9473300'

Test #98:

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

input:

150 10 10078
5 4 5 4 5 4 5 8 5 8 6 8 3 8 6 8 1 8 1 7 1 4 1 6 1 4 1 4 5 4 7 4 3 4 2 4 2 5 2 1 2 4 2 1 2 1 8 1 7 1 3 1 2 1 2 4 2 4 2 1 2 6 2 6 3 6 4 6 8 6 2 6 2 3 2 1 2 4 2 1 2 1 5 1 8 1 3 1 7 1 7 1 7 6 7 6 7 5 7 5 2 5 2 5 2 5 1 5 1 5 1 3 1 7 1 4 1 4 2 4 7 4 5 4 7 4 7 4 7 6 7 6 7 4 7 4 8 4 1 4 3 4 5 4...

output:

9338690

result:

ok single line: '9338690'

Test #99:

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

input:

150 10 10173
8 4 8 5 8 1 8 4 8 4 7 4 3 4 3 4 8 4 8 7 8 3 8 1 8 7 8 7 2 7 5 7 1 7 8 7 8 1 8 2 8 2 8 3 8 3 1 3 8 3 5 3 1 3 1 6 1 3 1 3 1 5 1 5 2 5 4 5 2 5 3 5 3 1 3 6 3 2 3 2 3 2 6 2 6 2 8 2 6 2 6 1 6 1 6 4 6 2 6 2 6 2 6 2 1 2 6 2 6 5 6 5 6 5 6 7 6 7 6 7 5 7 3 7 4 7 4 1 4 7 4 8 4 6 4 6 2 6 8 6 2 6 1 6...

output:

9136818

result:

ok single line: '9136818'

Test #100:

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

input:

150 10 10082
7 4 7 3 7 1 7 4 7 4 1 4 2 4 6 4 2 4 2 3 2 7 2 4 2 7 2 7 4 7 5 7 4 7 5 7 5 4 5 4 5 4 5 3 5 3 4 3 5 3 5 3 7 3 7 2 7 1 7 6 7 6 7 6 4 6 4 6 1 6 1 6 1 2 1 3 1 7 1 5 1 5 2 5 2 5 6 5 2 5 2 5 2 5 2 5 2 4 2 4 6 4 1 4 5 4 3 4 3 2 3 2 3 7 3 7 3 7 1 7 2 7 3 7 6 7 6 1 6 5 6 7 6 5 6 5 7 5 6 5 7 5 4 5...

output:

9328848

result:

ok single line: '9328848'

Test #101:

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

input:

150 10 10100
10 1 10 11 10 3 10 7 10 7 10 7 1 7 4 7 1 7 1 5 1 8 1 8 1 9 1 9 7 9 3 9 7 9 6 9 6 7 6 10 6 7 6 1 6 1 9 1 4 1 11 1 11 1 11 2 11 4 11 8 11 4 11 4 9 4 9 4 7 4 10 4 10 3 10 3 10 6 10 8 10 8 9 8 10 8 1 8 10 8 10 6 10 4 10 4 10 9 10 9 8 9 5 9 3 9 7 9 7 5 7 9 7 8 7 9 7 9 2 9 2 9 11 9 1 9 1 10 1...

output:

9445600

result:

ok single line: '9445600'