QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#407056#5100. 卡牌游戏zwh2008100 ✓1668ms99044kbC++142.4kb2024-05-07 21:49:462024-05-07 21:49:46

Judging History

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

  • [2024-05-07 21:49:46]
  • 评测
  • 测评结果:100
  • 用时:1668ms
  • 内存:99044kb
  • [2024-05-07 21:49:46]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
using ll=long long;
using pi=pair<int,int>;
#define fi first
#define se second
const int N=5e5+5,M=750;
int n,S,type,tid,a[N],b[N],lst[N],G[M][M];
ll f[N],g[N],mx[N],mx1[N],w[20][N];
template<class T>inline void gmax(T&x,T y){x=(x>y?x:y);}
void upd(int l,int r,ll v) {
	if(l>r)return;int k=__lg(r-l+1);
	gmax(w[k][l],v),gmax(w[k][r-(1<<k)+1],v);
} 
int main() {
	ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
	cin>>n>>S>>type>>tid;
	for(int i=1;i<=n;i++)cin>>a[i],a[i]=min(a[i],S+1);
	for(int i=1;i<=S+1;i++)b[i]=S/i*i;
	int B=sqrt(S);
	for(int i=1;i<=B;i++)for(int j=0;j<i;j++)G[i][j]=i/__gcd(i,j);
	memset(mx,-0x3f,sizeof(mx));
	for(int i=1;i<=n;i++) {
		if(a[i]<=B) {
			for(int j=i-1,k=(a[j]<=B);j&&k<3;j--,k+=a[j]<=B)gmax(f[i],f[j]+b[min(S+1,a[j]*G[a[i]][a[j]%a[i]])]);
			for(int j=i+1,k=(a[j]<=B);j<=n&&k<3;j++,k+=a[j]<=B)gmax(f[j],f[i]+b[min(S+1,a[j]*G[a[i]][a[j]%a[i]])]);
		}else {
			f[i]=max(f[i],f[i-1]);
			int st=(S/2+a[i]-1)/a[i]*a[i]; 
			for(int j=st;j<=S;j+=a[i])gmax(f[i],mx[j]+j);
			for(int j=st;j<=S;j+=a[i])mx[j]=f[i];
		}
	}
	cout<<f[n]<<' ';
	if(!type)return 0;
	memset(mx,-0x3f,sizeof(mx)),memset(mx1,-0x3f,sizeof(mx1));
	for(int i=n;i;i--) {
		if(a[i]<=B) {
			for(int j=i+1,k=(a[j]<=B);j<=n&&k<3;j++,k+=a[j]<=B)gmax(g[i],g[j]+b[min(S+1,a[j]*G[a[i]][a[j]%a[i]])]);
			for(int j=i-1,k=(a[j]<=B);j&&k<3;j--,k+=a[j]<=B)gmax(g[j],g[i]+b[min(S+1,a[j]*G[a[i]][a[j]%a[i]])]);
		}else {
			gmax(g[i],g[i+1]);
			int st=(S/2+a[i]-1)/a[i]*a[i]; 
			for(int j=st;j<=S;j+=a[i])if(lst[j])upd(i+1,lst[j]-1,mx[j]+f[i]+j),gmax(w[0][lst[j]],mx1[j]+f[i]+j),gmax(g[i],mx[j]+j);
			for(int j=st;j<=S;j+=a[i])mx1[j]=mx[j],lst[j]=i,mx[j]=g[i];
		}
	}
	memset(lst,0,sizeof(lst));
	for(int i=1;i<=n;i++)if(a[i]<=B) {
		int l=max(1,i-1),r=min(n,i+1);
		for(int k=(a[l]<=B);l>1&&k<3;l--,k+=a[l]<=B);
		for(int k=(a[r]<=B);r<n&&k<3;r++,k+=a[r]<=B);
		ll mx=0;for(int j=l;j<i;j++)gmax(w[0][j],mx),gmax(mx,f[j]+g[i]+b[min(S+1,a[j]*G[a[i]][a[j]%a[i]])]);
		mx=0;for(int j=r;j>i;j--)gmax(w[0][j],mx),gmax(mx,f[i]+g[j]+b[min(S+1,a[j]*G[a[i]][a[j]%a[i]])]);
	}
	for(int i=19;i;i--)for(int j=1;j<=n-(1<<i)+1;j++)gmax(w[i-1][j],w[i][j]),gmax(w[i-1][j+(1<<i-1)],w[i][j]); 
	ll ans=0;
	for(int i=1;i<=n;i++)ans^=max(f[i-1]+g[i+1],w[0][i])*i;
	cout<<ans<<'\n';
	return 0;
}
/*
5 10 1 1
3 2 1 4 5

10 9999 1 1
93 120 538 410 1 248 100 11 45 14
*/

详细

Subtask #1:

score: 5
Accepted

Test #1:

score: 5
Accepted
time: 6ms
memory: 22040kb

input:

1000 100000 1 1
69 99 297 63 277 271 109 268 209 181 100 195 282 137 211 270 87 10 247 294 138 108 33 258 152 265 304 154 201 66 269 189 5 162 134 276 144 187 107 170 16 135 253 67 156 138 299 165 70 258 158 239 186 168 277 261 86 173 153 14 35 226 158 258 129 152 295 235 271 31 192 92 153 236 142 1...

output:

91045064 83613761529

result:

ok 2 number(s): "91045064 83613761529"

Test #2:

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

input:

1000 100000 1 1
321 320 321 317 321 318 317 320 321 319 321 319 319 320 318 321 318 318 321 317 320 321 317 320 321 317 319 320 321 318 321 319 320 318 321 321 317 319 317 317 320 317 320 320 318 317 317 318 317 317 317 320 320 321 319 317 319 317 321 318 318 318 319 321 318 318 320 318 319 318 317 ...

output:

47161139 35531159417

result:

ok 2 number(s): "47161139 35531159417"

Test #3:

score: 5
Accepted
time: 2ms
memory: 20884kb

input:

1000 100000 1 1
99877 99767 99920 99843 99851 99963 99786 99705 99796 99956 99963 99798 99935 99958 99723 99706 99715 99776 99965 99896 99929 99842 99966 99985 99943 99733 99923 99778 99996 99906 99963 99745 99743 99747 99888 99938 99842 99806 99845 99754 99882 99895 99946 99697 99976 99709 99864 99...

output:

4095958 479501822

result:

ok 2 number(s): "4095958 479501822"

Test #4:

score: 5
Accepted
time: 6ms
memory: 21564kb

input:

1000 100000 1 1
320 309 63 99695 99794 169 99996 317 106 267 107 99695 313 99978 89384 99822 318 99933 319 99739 127 320 318 99850 310 318 99971 99979 178 30887 6 201 99947 317 99959 317 99998 319 320 99879 249 99722 317 318 99932 99789 318 191 99881 99997 99685 274 321 63 317 99816 99892 99905 54 6...

output:

43731669 67894711639

result:

ok 2 number(s): "43731669 67894711639"

Test #5:

score: 5
Accepted
time: 5ms
memory: 22108kb

input:

1000 100000 1 1
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 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:

99900000 3727441920

result:

ok 2 number(s): "99900000 3727441920"

Test #6:

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

input:

1000 100000 1 1
47056 64606 80365 51432 4398 82949 47347 64531 65262 51075 61750 34446 67252 41755 87833 65693 90044 83309 66032 6673 12256 45956 16923 77519 5850 42663 6076 99999 29835 6795 98954 28352 27218 13709 79670 84178 45987 96158 25403 79350 4228 50229 38558 48779 40997 80758 69748 72967 94...

output:

1234850 1818497071

result:

ok 2 number(s): "1234850 1818497071"

Test #7:

score: 5
Accepted
time: 5ms
memory: 20120kb

input:

1000 100000 1 1
100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 1000...

output:

99900000 3727441920

result:

ok 2 number(s): "99900000 3727441920"

Subtask #2:

score: 5
Accepted

Test #8:

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

input:

10000 100000 1 2
91 50 303 100 42 100 36 306 191 90 99 45 196 144 64 35 98 147 180 115 16 209 62 315 270 295 26 60 139 135 98 39 148 7 239 133 268 218 179 225 253 289 289 279 31 244 288 68 128 275 147 2 222 146 303 215 51 212 84 4 64 183 153 58 230 13 34 58 45 237 301 303 241 92 140 306 60 83 273 23...

output:

913775751 7945799038884

result:

ok 2 number(s): "913775751 7945799038884"

Test #9:

score: 5
Accepted
time: 14ms
memory: 21200kb

input:

10000 100000 1 2
318 318 319 317 321 319 317 317 321 317 321 317 318 317 318 321 317 319 320 318 319 321 319 318 321 321 320 317 319 318 318 321 320 319 321 321 319 317 319 318 318 321 318 320 319 318 319 317 319 317 321 318 318 320 320 321 319 321 320 320 319 319 319 320 318 319 320 319 321 320 318...

output:

469042863 1882597477661

result:

ok 2 number(s): "469042863 1882597477661"

Test #10:

score: 5
Accepted
time: 3ms
memory: 22620kb

input:

10000 100000 1 2
99740 99967 99960 99968 99791 99719 99973 99800 99938 99993 99722 99725 99827 99856 99832 99964 99685 99711 99977 99788 99749 99953 99993 99697 99819 99920 99709 99856 99929 99798 99904 99906 99972 99722 99831 99765 99815 99786 99738 99842 99729 99771 99747 99984 99686 99843 99962 9...

output:

45542751 549641140557

result:

ok 2 number(s): "45542751 549641140557"

Test #11:

score: 5
Accepted
time: 12ms
memory: 22384kb

input:

10000 100000 1 2
99949 2652 99988 321 310 320 147 92755 12400 99918 319 99885 99887 266 317 96 99933 275 62 235 95061 319 58 319 99688 93 99844 99759 318 320 199 320 321 45 56 133 1 219 317 11 319 99897 6 319 99739 99973 317 206 203 99698 297 99935 99747 177 99848 282 75 319 317 317 99836 321 49677 ...

output:

457516012 6963544902652

result:

ok 2 number(s): "457516012 6963544902652"

Test #12:

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

input:

10000 100000 1 2
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 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:

999900000 15211989839872

result:

ok 2 number(s): "999900000 15211989839872"

Test #13:

score: 5
Accepted
time: 3ms
memory: 21144kb

input:

10000 100000 1 2
23116 47839 17159 89633 92321 79346 91726 9187 25700 1822 38065 31425 4726 16424 37940 33163 86935 45568 85913 21785 3614 29374 49916 65182 66713 58482 80865 26747 49190 90712 75248 67760 4805 97675 57006 44327 12438 13670 64258 55118 29826 72614 14615 97359 88998 47612 53851 93379 ...

output:

12515422 40333478543

result:

ok 2 number(s): "12515422 40333478543"

Test #14:

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

input:

10000 100000 1 2
100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100...

output:

999900000 15211989839872

result:

ok 2 number(s): "999900000 15211989839872"

Subtask #3:

score: 10
Accepted

Test #15:

score: 10
Accepted
time: 26ms
memory: 35168kb

input:

100000 300000 1 3
274679 257449 79355 22007 205440 219549 7516 102115 226913 157081 9451 228050 8862 198356 270934 221218 162391 221194 235433 234134 70219 45552 211652 248648 164511 74601 168682 139466 189586 258255 264158 218369 21734 195969 71728 299881 104633 21390 36649 25670 121247 41503 20806...

output:

226109485 23395571928369

result:

ok 2 number(s): "226109485 23395571928369"

Subtask #4:

score: 10
Accepted

Test #16:

score: 10
Accepted
time: 17ms
memory: 34840kb

input:

100000 300000 1 4
22 98 92 49 86 56 11 69 100 65 99 79 39 97 40 88 47 28 79 43 75 13 43 41 69 56 62 47 21 28 69 95 1 92 92 60 78 15 3 20 96 15 95 82 38 9 80 26 64 21 19 48 17 27 79 7 25 66 100 70 94 16 21 61 13 57 42 60 66 18 99 97 69 63 89 20 73 22 64 41 19 9 9 45 64 97 4 71 41 93 65 49 81 23 4 52 ...

output:

29908227273 3183540118634089

result:

ok 2 number(s): "29908227273 3183540118634089"

Test #17:

score: 10
Accepted
time: 17ms
memory: 35048kb

input:

100000 300000 1 4
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 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:

29999700000 3893585367590912

result:

ok 2 number(s): "29999700000 3893585367590912"

Test #18:

score: 10
Accepted
time: 18ms
memory: 34788kb

input:

100000 300000 1 4
100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 10...

output:

29999700000 3893585367590912

result:

ok 2 number(s): "29999700000 3893585367590912"

Subtask #5:

score: 10
Accepted

Test #19:

score: 10
Accepted
time: 10ms
memory: 18672kb

input:

100000 100000 0 5
160 79 241 305 285 252 135 178 99 105 215 136 248 256 255 309 149 226 295 99 253 269 40 126 95 232 201 201 275 306 119 314 91 222 89 135 62 240 100 178 274 99 107 278 238 193 222 311 218 242 46 74 180 253 141 100 33 54 267 90 274 199 64 279 132 183 135 266 258 208 169 89 194 114 11...

output:

9112169164 

result:

ok 1 number(s): "9112169164"

Test #20:

score: 10
Accepted
time: 32ms
memory: 15000kb

input:

100000 100000 0 5
321 321 321 318 320 318 317 321 319 320 317 318 321 317 317 318 319 321 321 319 319 317 319 321 318 319 318 317 321 320 317 321 318 317 319 319 318 319 321 321 319 317 321 319 317 321 318 318 317 317 320 317 319 319 317 321 317 319 317 320 321 317 319 318 317 321 320 317 319 319 32...

output:

4644520350 

result:

ok 1 number(s): "4644520350"

Test #21:

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

input:

100000 100000 0 5
99741 99785 99945 99814 99716 99908 99993 99894 99992 99727 99769 99900 99825 99721 99912 99721 99888 99996 99842 99772 99841 99748 99895 99698 99839 99706 99883 99905 99751 99761 99711 99779 99864 99935 99927 99930 99715 99687 99987 99861 99830 99791 99929 99904 99687 99755 99802 ...

output:

461415122 

result:

ok 1 number(s): "461415122"

Test #22:

score: 10
Accepted
time: 11ms
memory: 18688kb

input:

100000 100000 0 5
99994 321 174 99919 154 22327 319 99768 99776 251 167 26 136 204 238 94 318 99949 13887 320 317 99776 319 239 24 162 183 99805 321 270 93 321 63 32 117 320 317 99820 63 99877 193 99825 320 321 99753 99858 99911 318 319 99884 319 99800 93 99737 99740 60184 99885 99950 317 99939 320 ...

output:

4590723790 

result:

ok 1 number(s): "4590723790"

Test #23:

score: 10
Accepted
time: 9ms
memory: 18688kb

input:

100000 100000 0 5
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 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:

9999900000 

result:

ok 1 number(s): "9999900000"

Test #24:

score: 10
Accepted
time: 7ms
memory: 14964kb

input:

100000 100000 0 5
87564 98687 95082 86046 59414 92993 1441 87994 42233 49845 91114 32159 31160 50038 67919 29885 82383 87674 3363 86912 54853 14045 25007 87793 44557 70863 70455 8631 19993 83876 70320 64268 29173 6914 73921 56750 67652 13938 49602 6379 43284 13161 12319 72250 50131 47821 87829 49558...

output:

128441922 

result:

ok 1 number(s): "128441922"

Test #25:

score: 10
Accepted
time: 10ms
memory: 16680kb

input:

100000 100000 0 5
100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 10...

output:

9999900000 

result:

ok 1 number(s): "9999900000"

Subtask #6:

score: 10
Accepted

Test #26:

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

input:

100000 100000 1 6
99 254 235 123 310 237 248 278 100 34 213 275 66 242 297 120 272 185 140 149 276 165 163 162 119 142 79 6 66 163 134 296 176 12 45 96 152 200 59 127 279 249 67 111 208 49 161 121 153 72 280 164 310 266 228 23 101 197 88 245 32 23 51 140 206 112 207 164 207 40 262 245 224 258 167 15...

output:

9115701137 222488541689194

result:

ok 2 number(s): "9115701137 222488541689194"

Test #27:

score: 10
Accepted
time: 141ms
memory: 34932kb

input:

100000 100000 1 6
321 317 317 318 320 317 318 320 317 318 320 321 317 320 320 318 319 318 318 319 321 319 318 317 318 317 321 321 320 317 317 320 320 320 321 320 317 320 318 317 321 320 319 318 318 318 317 321 318 318 318 320 320 321 317 319 321 318 319 317 318 320 320 317 319 318 317 319 320 317 31...

output:

4641094174 115910832136071

result:

ok 2 number(s): "4641094174 115910832136071"

Test #28:

score: 10
Accepted
time: 7ms
memory: 32980kb

input:

100000 100000 1 6
99888 99743 99856 99974 99980 99898 99982 99697 99982 99820 99811 99892 99830 99779 99833 99984 99977 99876 99748 99781 99929 99746 99923 99768 99893 99922 99760 99744 99794 99895 99908 99962 99760 99999 99797 99915 99913 99945 99817 99895 99782 99880 99913 99870 99779 99853 99916 ...

output:

451426545 36848667765574

result:

ok 2 number(s): "451426545 36848667765574"

Test #29:

score: 10
Accepted
time: 65ms
memory: 34452kb

input:

100000 100000 1 6
174 155 99873 317 317 99944 319 256 316 321 317 99948 87951 99843 99803 284 80330 317 311 317 8 44199 61 99952 319 99775 320 318 2885 321 31 99731 259 318 321 46992 320 99697 73580 23 42 99829 116 242 261 99820 99833 99915 319 99995 318 115 99919 99963 99987 64 318 99965 50 319 90 ...

output:

4561136138 189925237741223

result:

ok 2 number(s): "4561136138 189925237741223"

Test #30:

score: 10
Accepted
time: 7ms
memory: 33316kb

input:

100000 100000 1 6
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 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:

9999900000 84007555313664

result:

ok 2 number(s): "9999900000 84007555313664"

Test #31:

score: 10
Accepted
time: 24ms
memory: 34296kb

input:

100000 100000 1 6
68060 68061 45842 90656 82697 69614 74684 47322 48026 15884 8737 95356 27611 91159 4487 55620 92802 61899 94480 46171 51478 32853 91728 44549 55976 74456 33656 81259 9011 41975 36818 40284 55052 73832 7587 87283 47876 79722 98733 80875 28010 58148 80512 60554 33402 90145 87902 8049...

output:

128038596 6144603462848

result:

ok 2 number(s): "128038596 6144603462848"

Test #32:

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

input:

100000 100000 1 6
100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 10...

output:

9999900000 84007555313664

result:

ok 2 number(s): "9999900000 84007555313664"

Subtask #7:

score: 10
Accepted

Test #33:

score: 10
Accepted
time: 21ms
memory: 20316kb

input:

300000 300000 0 7
101 52 102 151 14 514 86 100 239 399 486 520 239 489 176 112 517 478 215 539 134 46 200 54 307 48 78 220 205 433 509 312 381 13 457 515 481 223 326 300 193 103 289 203 393 25 506 137 7 239 201 343 165 107 135 487 16 162 177 369 415 246 59 169 127 522 207 465 418 287 311 248 298 311...

output:

82066272311 

result:

ok 1 number(s): "82066272311"

Test #34:

score: 10
Accepted
time: 138ms
memory: 20868kb

input:

300000 300000 0 7
548 549 551 548 548 551 552 548 548 549 552 549 548 551 549 549 552 550 551 548 549 549 550 551 551 550 550 550 548 550 548 549 549 550 549 548 549 548 552 548 548 549 550 552 552 548 549 551 550 551 549 551 552 552 550 550 552 552 552 551 548 552 549 548 551 548 551 549 550 552 55...

output:

47202787514 

result:

ok 1 number(s): "47202787514"

Test #35:

score: 10
Accepted
time: 15ms
memory: 20316kb

input:

300000 300000 0 7
299530 299495 299739 299518 299807 299905 299934 299986 299534 299485 299609 299687 299648 299548 299730 299512 299495 299793 299748 299841 299978 299927 299766 299761 299987 299956 299664 299825 299911 299707 299843 299937 299755 299773 299493 299624 299755 299529 299758 299955 29...

output:

3100324815 

result:

ok 1 number(s): "3100324815"

Test #36:

score: 10
Accepted
time: 57ms
memory: 20796kb

input:

300000 300000 0 7
28021 299647 548 129 182 551 547 548 550 548 270461 548 205 488 288422 549 60 552 299571 299932 299833 299954 552 299586 552 551 391 299854 162 551 536 548 548 148224 299919 548 106 44 299457 551 87084 299538 235 297634 299456 148998 142 530 230 551 551 394 548 550 36 549 293 29985...

output:

42391062037 

result:

ok 1 number(s): "42391062037"

Test #37:

score: 10
Accepted
time: 12ms
memory: 20296kb

input:

300000 300000 0 7
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 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:

89999700000 

result:

ok 1 number(s): "89999700000"

Test #38:

score: 10
Accepted
time: 19ms
memory: 20696kb

input:

300000 300000 0 7
49016 283378 24015 196970 139037 102956 274684 138710 124923 210684 271874 271496 102773 233268 67436 2679 79610 112733 65364 127903 252055 96203 90553 106788 148812 249122 99415 127681 288582 107599 78243 194704 156102 133180 65183 173765 210005 80178 267168 244002 97690 6195 2220...

output:

705473848 

result:

ok 1 number(s): "705473848"

Test #39:

score: 10
Accepted
time: 16ms
memory: 20276kb

input:

300000 300000 0 7
300000 300000 300000 300000 300000 300000 300000 300000 300000 300000 300000 300000 300000 300000 300000 300000 300000 300000 300000 300000 300000 300000 300000 300000 300000 300000 300000 300000 300000 300000 300000 300000 300000 300000 300000 300000 300000 300000 300000 300000 30...

output:

89999700000 

result:

ok 1 number(s): "89999700000"

Subtask #8:

score: 10
Accepted

Test #40:

score: 10
Accepted
time: 50ms
memory: 65332kb

input:

300000 300000 1 8
404 482 307 14 397 186 112 173 197 389 278 419 417 196 138 264 161 330 395 465 84 516 235 507 515 247 222 268 105 119 435 328 514 337 356 246 204 370 364 174 512 538 129 135 203 348 247 58 430 238 165 397 203 145 175 435 158 297 443 446 467 3 493 294 394 375 157 405 385 449 116 361...

output:

82044763846 90530803002082

result:

ok 2 number(s): "82044763846 90530803002082"

Test #41:

score: 10
Accepted
time: 802ms
memory: 63544kb

input:

300000 300000 1 8
551 549 551 550 552 552 551 550 548 548 549 552 549 548 548 548 552 549 550 552 549 549 549 548 548 551 548 549 551 552 549 551 550 551 549 549 552 552 548 550 551 549 548 550 550 551 549 549 548 549 552 549 552 548 552 550 550 551 550 549 549 551 549 550 549 548 549 548 549 550 55...

output:

47145191788 708865367875858

result:

ok 2 number(s): "47145191788 708865367875858"

Test #42:

score: 10
Accepted
time: 19ms
memory: 64428kb

input:

300000 300000 1 8
299642 299842 299924 299514 299699 299559 299941 299803 299876 299504 299602 299733 299887 299533 299931 299641 299731 299758 299585 299768 299640 299684 299463 299950 299543 299968 299891 299661 299529 299761 299801 299508 299658 299585 299482 299733 299949 299809 299932 299590 29...

output:

3094926766 190060447614196

result:

ok 2 number(s): "3094926766 190060447614196"

Test #43:

score: 10
Accepted
time: 296ms
memory: 66224kb

input:

300000 300000 1 8
27 299674 299973 22 299646 299488 299564 289 302 549 299568 542 299626 373 299504 259813 552 550 552 299609 391 314 299993 173 16960 299505 546 549 6 299662 300000 419 456 166129 46831 299862 299849 551 65283 548 148 299893 299804 249 299827 548 186298 551 145706 542 332 70092 548 ...

output:

42376193965 15621782934853978

result:

ok 2 number(s): "42376193965 15621782934853978"

Test #44:

score: 10
Accepted
time: 40ms
memory: 64952kb

input:

300000 300000 1 8
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 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:

89999700000 31270091296978944

result:

ok 2 number(s): "89999700000 31270091296978944"

Test #45:

score: 10
Accepted
time: 73ms
memory: 66532kb

input:

300000 300000 1 8
122849 26994 125469 31193 281505 293479 5907 70850 297036 127431 113505 264502 215392 70820 18281 236218 157483 218401 99754 228846 25433 27224 237932 165178 112883 275562 143857 175855 131317 127959 68622 62690 260895 156367 128041 215132 70112 96604 297063 190490 87834 128959 313...

output:

698452548 184893424662221

result:

ok 2 number(s): "698452548 184893424662221"

Test #46:

score: 10
Accepted
time: 31ms
memory: 65004kb

input:

300000 300000 1 8
300000 300000 300000 300000 300000 300000 300000 300000 300000 300000 300000 300000 300000 300000 300000 300000 300000 300000 300000 300000 300000 300000 300000 300000 300000 300000 300000 300000 300000 300000 300000 300000 300000 300000 300000 300000 300000 300000 300000 300000 30...

output:

89999700000 31270091296978944

result:

ok 2 number(s): "89999700000 31270091296978944"

Subtask #9:

score: 15
Accepted

Test #47:

score: 15
Accepted
time: 43ms
memory: 21716kb

input:

500000 500000 0 9
464 653 212 650 549 203 500 292 366 468 464 660 240 393 279 587 405 403 148 638 438 251 441 92 302 270 56 271 559 639 474 193 644 310 48 548 559 289 163 439 372 425 121 459 620 636 282 610 133 283 215 317 451 166 431 21 139 229 261 260 9 112 71 468 287 312 680 330 95 140 92 44 238 ...

output:

227886764436 

result:

ok 1 number(s): "227886764436"

Test #48:

score: 15
Accepted
time: 278ms
memory: 21696kb

input:

500000 500000 0 9
708 709 709 709 711 711 708 712 708 712 711 710 711 712 708 710 708 711 708 710 710 708 711 712 710 708 709 711 710 710 711 709 708 709 712 710 710 711 710 708 712 709 709 711 711 708 710 711 709 708 711 708 708 708 710 709 708 708 710 712 712 708 709 712 709 709 711 708 712 710 71...

output:

131022284688 

result:

ok 1 number(s): "131022284688"

Test #49:

score: 15
Accepted
time: 33ms
memory: 21740kb

input:

500000 500000 0 9
499461 499989 499588 499771 499583 499588 499416 499874 499345 499373 499956 499737 499996 499492 499806 499879 499558 499463 499974 499970 499586 499736 499527 499607 499569 499403 499368 499460 499523 499722 499637 499319 499928 499794 499501 499329 499314 499585 499840 499739 49...

output:

7549726882 

result:

ok 1 number(s): "7549726882"

Test #50:

score: 15
Accepted
time: 128ms
memory: 21720kb

input:

500000 500000 0 9
712 202 139 708 76 710 499465 499848 367902 474 708 500000 218 473708 620 712 255 499782 708 710 492 710 712 499654 499374 499318 430 499325 711 708 710 687 627 499504 499968 499879 499684 222 226 343895 499917 88 499555 132 710 499443 710 269 15847 499927 272 712 711 617 495 710 4...

output:

117720124105 

result:

ok 1 number(s): "117720124105"

Test #51:

score: 15
Accepted
time: 28ms
memory: 21704kb

input:

500000 500000 0 9
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 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:

249999500000 

result:

ok 1 number(s): "249999500000"

Test #52:

score: 15
Accepted
time: 49ms
memory: 21608kb

input:

500000 500000 0 9
112488 386312 349251 434653 211351 475440 126897 443781 131445 384146 244795 429244 458108 165837 3792 251955 295769 135173 297519 112848 46032 407556 403454 420371 433741 184741 269561 155879 328973 370459 199582 404722 42642 239834 411425 238901 39442 177539 480059 396995 325553 ...

output:

1548559325 

result:

ok 1 number(s): "1548559325"

Test #53:

score: 15
Accepted
time: 24ms
memory: 21680kb

input:

500000 500000 0 9
500000 500000 500000 500000 500000 500000 500000 500000 500000 500000 500000 500000 500000 500000 500000 500000 500000 500000 500000 500000 500000 500000 500000 500000 500000 500000 500000 500000 500000 500000 500000 500000 500000 500000 500000 500000 500000 500000 500000 500000 50...

output:

249999500000 

result:

ok 1 number(s): "249999500000"

Subtask #10:

score: 15
Accepted

Test #54:

score: 15
Accepted
time: 66ms
memory: 96620kb

input:

500000 500000 1 10
508 318 336 300 675 515 168 520 687 644 236 670 590 176 478 99 119 556 430 385 117 89 483 321 194 194 314 236 438 142 18 499 161 495 649 255 190 667 396 600 165 376 547 145 390 43 485 645 32 685 54 276 322 353 659 516 102 440 476 351 282 94 222 594 98 399 22 434 50 76 84 504 2 173...

output:

227911469762 141022772149339708

result:

ok 2 number(s): "227911469762 141022772149339708"

Test #55:

score: 15
Accepted
time: 1668ms
memory: 95924kb

input:

500000 500000 1 10
708 712 709 712 709 709 712 711 708 711 710 710 709 708 708 710 712 712 708 712 712 708 712 710 710 711 712 709 711 711 710 709 711 712 712 710 709 712 710 710 711 710 709 712 712 709 712 712 710 709 712 710 710 708 709 710 709 711 712 712 709 712 712 710 708 709 711 709 709 712 7...

output:

131136023661 36493119792999304

result:

ok 2 number(s): "131136023661 36493119792999304"

Test #56:

score: 15
Accepted
time: 61ms
memory: 97276kb

input:

500000 500000 1 10
499783 499468 499756 499897 499870 499331 499846 499873 499379 499547 499952 499797 499334 499318 499345 499368 499456 499405 499495 499980 499509 499840 499986 499533 499311 499474 499676 499300 499448 499995 499955 499765 499355 499553 499942 499665 499327 499518 499378 499337 4...

output:

7592199660 2412048903911772

result:

ok 2 number(s): "7592199660 2412048903911772"

Test #57:

score: 15
Accepted
time: 635ms
memory: 99044kb

input:

500000 500000 1 10
211 481 712 499885 256 91 709 165 708 548 499983 388533 708 528 401883 102 712 712 499564 624 712 14 499608 631 712 710 499980 499452 103521 575 709 499862 433 499394 499963 710 278417 712 456 709 500000 710 708 712 712 499328 580 646 289 159 499605 709 499747 711 37 499374 709 68...

output:

117610370227 13032029682986888

result:

ok 2 number(s): "117610370227 13032029682986888"

Test #58:

score: 15
Accepted
time: 63ms
memory: 96280kb

input:

500000 500000 1 10
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 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:

249999500000 115501353786146816

result:

ok 2 number(s): "249999500000 115501353786146816"

Test #59:

score: 15
Accepted
time: 123ms
memory: 98036kb

input:

500000 500000 1 10
138515 366717 315914 296623 409128 444200 86121 194861 343316 109508 141861 457734 214204 430462 76549 394163 318509 155931 48271 200073 366869 296607 145069 156325 29337 217993 458319 324986 75162 457056 297742 10799 96464 110291 10869 327957 469835 326155 333779 209430 354468 73...

output:

1576654258 1105845674965451

result:

ok 2 number(s): "1576654258 1105845674965451"

Test #60:

score: 15
Accepted
time: 42ms
memory: 97012kb

input:

500000 500000 1 10
500000 500000 500000 500000 500000 500000 500000 500000 500000 500000 500000 500000 500000 500000 500000 500000 500000 500000 500000 500000 500000 500000 500000 500000 500000 500000 500000 500000 500000 500000 500000 500000 500000 500000 500000 500000 500000 500000 500000 500000 5...

output:

249999500000 115501353786146816

result:

ok 2 number(s): "249999500000 115501353786146816"