QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#100383#6339. Cookieschenshi100 ✓979ms445496kbC++1.4kb2023-04-25 19:11:322023-04-25 19:11:33

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-04-25 19:11:33]
  • 评测
  • 测评结果:100
  • 用时:979ms
  • 内存:445496kb
  • [2023-04-25 19:11:32]
  • 提交

answer

#pragma GCC optimize("O3,unroll-loops")
#include<cstdio>
#include<algorithm>
#include<vector>
using namespace std;
const int o=15010;
int n,m,a[o],a_[o],b[o],p[o],s,f[o][o],cnt[o],st[o],tp,q[o];vector<int> vec[o];
inline bool cmp(int A,int B){return a[A]>a[B];}
inline bool Cmp(int A,int B){return st[A]>st[B];}
int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;++i) scanf("%d",&a[i]),p[i]=i,s+=a[i];
	sort(p+1,p+n+1,cmp);
	scanf("%d",&m);
	for(int i=1;i<=m;++i) scanf("%d",&b[i]);
	for(int i=n;i;--i) a_[i]=a_[i+1]+a[p[i]];
	f[m+1][0]=1;
	for(int i=m,j,L=0,R=s,l,r,lim;i;--i,L=l,R=r) for(j=L,l=s,r=0;j<=R;++j) if(f[i+1][j]){
		lim=(s-j)/b[i];
		for(int k=b[i];k>b[i-1];--k) lim=min(lim,(a_[k]-j)/(b[i]-k+1));
		if(f[i+1][j]-1>lim) continue;
		l=min(l,j+(b[i]-b[i-1])*(f[i+1][j]-1));r=max(r,j+(b[i]-b[i-1])*lim);
		for(int k=f[i+1][j]-1,t=j+(b[i]-b[i-1])*k;k<=lim;++k,t+=b[i]-b[i-1]) f[i][t]=k+1;
	}
	if(!f[1][s]){printf("-1");return 0;}
	printf("%d\n",f[1][s]-1);
	for(int i=1,j=s;i<=m;++i) cnt[i]=--f[i][j],j-=(b[i]-b[i-1])*f[i][j];
	for(int i=1;i<=m;++i) for(int j=cnt[i]-cnt[i+1];j--;) st[++tp]=b[i];
	for(int i=1;i<=tp;++i) q[i]=i;
	for(int i=1;i<=n;++i){
		nth_element(q+1,q+a[p[i]],q+tp+1,Cmp);
		for(int j=1;j<=a[p[i]];++j) vec[q[j]].push_back(p[i]),--st[q[j]];
	}
	for(int i=1;i<=tp;++i,putchar('\n')){
		printf("%llu ",vec[i].size());
		for(int j=vec[i].size();j--;) printf("%d ",vec[i][j]);
	}
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 6
Accepted

Test #1:

score: 6
Accepted
time: 3ms
memory: 5484kb

input:

1
1
1
1

output:

1
1 1 

result:

ok good!

Test #2:

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

input:

2
1 1
1
1

output:

2
1 1 
1 2 

result:

ok good!

Test #3:

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

input:

2
1 1
1
2

output:

1
2 2 1 

result:

ok good!

Test #4:

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

input:

2
1 1
2
1 2

output:

1
2 2 1 

result:

ok good!

Test #5:

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

input:

4
1 1 1 1
2
2 3

output:

2
2 4 1 
2 3 2 

result:

ok good!

Test #6:

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

input:

8
1 1 1 1 1 1 1 1
3
1 4 5

output:

2
4 8 5 4 1 
4 7 6 3 2 

result:

ok good!

Test #7:

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

input:

500
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 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:

500
1 468 
1 91 
1 27 
1 214 
1 405 
1 266 
1 244 
1 151 
1 57 
1 314 
1 500 
1 122 
1 435 
1 312 
1 133 
1 182 
1 228 
1 282 
1 389 
1 75 
1 453 
1 330 
1 11 
1 198 
1 41 
1 361 
1 484 
1 106 
1 419 
1 296 
1 167 
1 288 
1 179 
1 304 
1 427 
1 114 
1 492 
1 369 
1 49 
1 206 
1 19 
1 338 
1 461 
1 8...

result:

ok good!

Test #8:

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

input:

500
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 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:

1
500 158 159 160 161 162 163 164 165 166 167 168 169 170 171 1 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 172 127 128 129 130 131 132 133 134 135 136 137 138 139 140 157 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 141 221 222 223 224 225 226 227 228 229 230 231 232 ...

result:

ok good!

Test #9:

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

input:

500
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 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:

2
1 158 
499 159 160 161 162 163 164 165 166 167 168 169 170 171 1 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 172 127 128 129 130 131 132 133 134 135 136 137 138 139 140 157 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 141 221 222 223 224 225 226 227 228 229 230 231 2...

result:

ok good!

Test #10:

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

input:

500
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 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:

-1

result:

ok no solution

Test #11:

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

input:

500
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 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:

11
40 168 177 187 135 142 152 225 239 194 203 213 35 42 52 62 14 16 104 114 124 68 78 88 414 432 379 389 399 406 479 489 440 458 467 289 299 306 254 264 278 
46 164 171 181 129 143 224 233 243 190 197 207 217 43 61 8 18 28 98 108 118 69 87 408 418 428 435 383 393 391 488 497 444 470 461 283 293 307 ...

result:

ok good!

Test #12:

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

input:

500
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 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
2 197 266 
2 209 469 
2 66 500 
2 91 406 
2 136 297 
2 187 314 
2 111 389 
2 121 437 
2 74 484 
2 94 330 
2 212 267 
2 205 453 
2 79 376 
2 175 361 
2 99 427 
2 143 251 
2 177 381 
2 72 369 
2 231 305 
2 1 461 
2 196 275 
2 70 338 
2 41 492 
2 56 398 
2 150 476 
2 203 322 
2 239 259 
2 159 445 
...

result:

ok good!

Test #13:

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

input:

484
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 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:

22
22 160 129 152 224 187 208 55 31 104 69 78 243 417 383 468 428 275 296 263 350 359 327 
22 156 132 147 221 190 36 45 8 105 120 72 404 372 381 465 440 439 286 256 345 354 316 
22 171 136 145 238 202 211 46 26 96 67 76 403 375 461 424 441 284 293 265 351 360 331 
22 155 178 215 230 228 212 58 7 30 ...

result:

ok good!

Test #14:

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

input:

495
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 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:

55
9 146 191 43 16 417 382 439 256 319 
9 181 244 205 123 431 475 460 307 323 
9 177 229 209 28 404 479 436 343 324 
9 167 200 61 98 87 472 437 308 311 
9 161 227 125 122 79 481 462 265 365 
9 144 204 47 110 81 468 456 274 326 
9 156 152 10 95 85 374 440 259 334 
9 160 188 211 32 415 376 490 270 355...

result:

ok good!

Test #15:

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

input:

500
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 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:

4
125 160 162 169 171 176 178 185 187 130 132 139 157 146 148 155 141 225 227 234 236 241 243 250 189 194 196 203 205 210 212 219 33 38 40 126 49 54 56 47 3 8 10 17 19 24 26 96 98 103 105 112 114 119 121 65 67 72 74 81 83 88 90 409 411 416 418 425 427 432 434 379 381 386 388 395 397 402 404 474 476 ...

result:

ok good!

Test #16:

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

input:

499
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 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:

27
5 176 157 230 195 35 
5 171 149 233 190 43 
5 168 131 235 193 37 
5 169 133 220 200 33 
17 165 137 151 192 215 54 26 113 119 74 418 406 477 483 438 283 255 
21 158 128 221 199 36 126 18 107 122 80 417 388 393 480 458 468 308 271 353 370 326 
21 167 145 231 242 210 46 25 98 110 88 426 434 405 494 ...

result:

ok good!

Test #17:

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

input:

499
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 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:

19
13 167 133 147 220 243 209 36 126 8 99 113 124 84 
27 173 180 151 225 236 192 217 48 10 18 116 71 78 422 421 396 474 495 447 468 295 254 269 353 368 326 341 
27 163 186 152 228 239 200 41 55 4 27 118 69 80 414 426 382 400 481 499 454 284 302 258 276 357 359 330 
27 174 130 137 232 244 193 211 49 ...

result:

ok good!

Test #18:

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

input:

499
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 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:

7
18 164 171 178 185 130 137 144 151 220 227 188 241 248 193 200 207 214 34 
64 158 165 1 179 186 131 138 145 152 221 228 235 242 249 194 201 208 215 35 43 52 54 47 3 11 20 22 31 96 104 113 115 124 110 71 80 82 91 93 412 250 423 432 434 380 389 391 400 402 473 482 437 493 495 440 449 451 460 462 282...

result:

ok good!

Test #19:

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

input:

499
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 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:

4
56 160 162 169 171 176 178 185 187 130 132 139 157 146 148 155 141 224 226 233 235 240 242 249 189 194 196 219 205 210 212 203 34 39 41 48 50 55 57 2 4 9 11 18 20 25 27 97 99 104 106 113 115 120 122 66 68 
56 161 163 168 170 177 179 184 186 131 133 138 140 147 149 154 156 225 227 232 188 241 243 2...

result:

ok good!

Test #20:

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

input:

499
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 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:

2
11 158 161 162 165 166 169 170 173 174 177 178 
488 159 160 163 164 167 168 171 1 175 176 179 180 181 182 183 184 185 186 187 172 127 128 129 130 131 132 133 134 135 136 137 138 139 140 157 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 141 220 221 222 223 224 225 226 227 228 229 230 ...

result:

ok good!

Test #21:

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

input:

499
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 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:

-1

result:

ok no solution

Test #22:

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

input:

499
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 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:

-1

result:

ok no solution

Test #23:

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

input:

493
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 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:

17
1 161 
1 163 
1 171 
1 169 
1 162 
1 168 
1 156 
1 167 
1 159 
1 158 
1 165 
1 164 
1 166 
1 1 
1 172 
1 157 
477 160 173 174 175 176 177 178 179 180 181 182 183 184 170 125 126 127 128 129 130 131 132 133 134 135 136 137 138 155 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 139 217...

result:

ok good!

Test #24:

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

input:

493
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 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:

17
1 161 
1 163 
1 171 
1 169 
1 162 
1 168 
1 156 
1 167 
1 159 
1 158 
1 165 
1 164 
1 166 
1 1 
1 172 
1 157 
477 160 173 174 175 176 177 178 179 180 181 182 183 184 170 125 126 127 128 129 130 131 132 133 134 135 136 137 138 155 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 139 217...

result:

ok good!

Test #25:

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

input:

493
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 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:

17
16 164 125 134 148 228 241 206 43 58 9 25 100 123 93 408 247 
16 1 170 136 152 227 188 204 42 51 4 23 97 108 83 407 419 
16 163 179 132 139 232 192 201 215 50 2 29 111 64 76 92 415 
16 156 183 143 219 185 231 199 38 54 15 24 99 118 69 405 426 
16 172 127 140 223 239 190 212 44 57 18 95 62 68 84 4...

result:

ok good!

Test #26:

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

input:

493
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 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:

17
16 164 125 134 148 228 241 206 43 58 9 25 100 123 93 408 247 
16 1 170 136 152 227 188 204 42 51 4 23 97 108 83 407 419 
16 163 179 132 139 232 192 201 215 50 2 29 111 64 76 92 415 
16 156 183 143 219 185 231 199 38 54 15 24 99 118 69 405 426 
16 172 127 140 223 239 190 212 44 57 18 95 62 68 84 4...

result:

ok good!

Test #27:

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

input:

493
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 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:

17
16 164 125 134 148 228 241 206 43 58 9 25 100 123 93 408 247 
16 1 170 136 152 227 188 204 42 51 4 23 97 108 83 407 419 
16 163 179 132 139 232 192 201 215 50 2 29 111 64 76 92 415 
16 156 183 143 219 185 231 199 38 54 15 24 99 118 69 405 426 
16 172 127 140 223 239 190 212 44 57 18 95 62 68 84 4...

result:

ok good!

Subtask #2:

score: 7
Accepted

Test #28:

score: 7
Accepted
time: 2ms
memory: 5328kb

input:

1
15
1
1

output:

15
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 

result:

ok good!

Test #29:

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

input:

1
500
1
1

output:

500
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1...

result:

ok good!

Test #30:

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

input:

1
3000
1
1

output:

3000
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
...

result:

ok good!

Test #31:

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

input:

1
15000
1
1

output:

15000
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 ...

result:

ok good!

Test #32:

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

input:

2
2 1
1
1

output:

3
1 1 
1 1 
1 2 

result:

ok good!

Test #33:

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

input:

2
1 2
1
2

output:

-1

result:

ok no solution

Test #34:

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

input:

3
1 2 3
1
2

output:

3
2 2 3 
2 2 3 
2 1 3 

result:

ok good!

Test #35:

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

input:

3
3 2 1
1
3

output:

-1

result:

ok no solution

Test #36:

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

input:

3
2 2 2
1
2

output:

3
2 2 1 
2 3 1 
2 3 2 

result:

ok good!

Test #37:

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

input:

15
50 49 48 47 46 45 44 43 42 41 40 2 1 1 1
1
10

output:

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

result:

ok good!

Test #38:

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

input:

15
51 49 48 47 46 45 44 43 42 41 40 1 1 1 1
1
10

output:

-1

result:

ok no solution

Test #39:

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

input:

10
430 3078 390 349 3750 906 377 3374 1795 551
1
4

output:

3750
4 6 2 8 5 
4 1 9 8 5 
4 1 9 8 5 
4 1 9 8 5 
4 1 9 8 5 
4 1 9 8 5 
4 1 9 8 5 
4 1 9 8 5 
4 1 9 8 5 
4 1 9 8 5 
4 1 9 8 5 
4 1 9 8 5 
4 1 9 8 5 
4 1 9 8 5 
4 1 9 8 5 
4 1 9 8 5 
4 1 9 8 5 
4 1 9 8 5 
4 1 9 8 5 
4 1 9 8 5 
4 1 9 8 5 
4 1 9 8 5 
4 1 9 8 5 
4 1 9 8 5 
4 1 9 8 5 
4 1 9 8 5 
4 1 9 8 5...

result:

ok good!

Test #40:

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

input:

500
4 99 56 16 7 39 5 8 3 18 15 30 19 27 46 47 24 55 1 7 21 1 13 5 53 32 12 98 12 121 3 118 25 15 8 32 29 7 13 3 29 94 22 4 12 37 15 52 14 9 59 22 3 16 9 77 5 17 41 22 16 6 3 32 33 34 18 1 28 4 72 4 3 40 21 13 22 16 42 77 2 16 1 1 10 11 3 34 21 28 4 173 24 57 17 9 20 116 21 72 17 165 28 30 6 13 86 1...

output:

5000
3 377 316 249 
3 284 395 282 
3 483 395 282 
3 483 395 282 
3 483 395 282 
3 483 395 282 
3 47 395 282 
3 200 395 282 
3 200 395 282 
3 105 395 282 
3 441 395 282 
3 200 395 282 
3 70 395 282 
3 1 395 282 
3 53 395 282 
3 462 395 282 
3 333 46 282 
3 72 395 282 
3 462 395 282 
3 462 395 282 
3 ...

result:

ok good!

Test #41:

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

input:

500
30 23 12 48 4 11 119 12 15 24 33 9 22 46 42 7 18 49 9 1 43 3 4 43 31 11 4 7 33 30 13 5 36 3 20 2 40 37 7 1 8 43 34 12 2 37 99 38 59 36 24 18 68 23 9 24 33 1 13 10 12 2 7 7 1 5 73 7 7 32 2 13 7 49 41 20 160 69 11 61 25 35 15 22 32 66 47 45 34 14 12 7 9 43 4 42 2 24 29 16 11 6 5 5 8 11 42 3 48 20 ...

output:

200
75 189 92 41 204 332 91 168 323 334 495 237 314 180 182 299 277 221 179 403 445 198 266 11 312 358 33 253 379 478 37 254 96 21 212 246 14 421 109 18 124 424 485 302 361 407 274 465 467 327 458 86 53 368 442 398 391 303 397 484 401 131 366 200 389 47 265 196 447 489 470 316 336 297 77 284 
75 468...

result:

ok good!

Test #42:

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

input:

500
6 60 24 11 17 58 8 42 30 60 38 34 54 23 5 12 32 6 35 11 60 42 35 60 25 60 37 40 5 22 24 26 17 17 60 21 7 29 13 7 56 12 8 16 8 20 11 60 12 60 32 56 30 55 12 23 26 60 60 6 18 60 60 21 21 16 28 23 60 9 16 4 8 5 20 4 60 59 39 20 8 27 8 7 6 8 10 30 18 15 60 60 41 48 17 24 17 60 10 42 6 13 22 21 14 18...

output:

60
250 72 380 101 379 219 263 369 7 121 395 99 467 411 376 488 499 225 111 497 105 185 224 203 264 443 118 34 295 110 5 362 89 298 374 328 367 249 80 496 64 409 417 438 194 103 254 431 152 317 351 31 167 158 165 424 299 240 57 490 198 475 157 255 275 67 434 156 440 233 277 38 402 53 176 125 464 244 ...

result:

ok good!

Test #43:

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

input:

122
121 121 121 121 121 121 121 121 121 121 121 121 121 121 121 121 121 121 121 121 121 121 121 121 121 121 121 121 121 121 121 121 121 121 121 121 121 121 121 121 121 121 121 121 121 121 121 121 121 121 121 121 121 121 121 121 121 121 121 121 121 121 121 121 121 121 121 121 121 121 121 121 121 121 ...

output:

122
121 33 34 35 36 37 38 39 40 41 42 43 44 45 46 1 48 49 50 51 52 53 54 55 56 57 58 59 60 61 47 2 3 4 5 6 7 8 9 10 11 12 13 14 15 32 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 16 94 95 96 97 98 99 100 101 102 103 104 105 106 107 62 109 110 111 112 113 114 115 116 117 118 119 120 121 122 108 63 65...

result:

ok good!

Test #44:

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

input:

498
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 2 ...

output:

3
332 158 159 162 163 164 165 168 169 170 171 174 175 176 177 180 181 182 183 186 187 172 127 130 131 132 133 136 137 138 139 142 143 144 145 148 149 150 151 154 155 156 141 222 223 224 225 228 229 230 231 188 235 236 237 240 241 242 243 246 247 248 249 190 191 192 193 196 197 198 199 202 219 204 20...

result:

ok good!

Subtask #3:

score: 12
Accepted

Test #45:

score: 12
Accepted
time: 2ms
memory: 3460kb

input:

2
7 8
2
1 2

output:

8
1 2 
2 1 2 
2 1 2 
2 1 2 
2 1 2 
2 1 2 
2 1 2 
2 1 2 

result:

ok good!

Test #46:

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

input:

3
5 4 6
2
2 3

output:

6
2 2 3 
2 1 3 
2 1 3 
3 2 1 3 
3 2 1 3 
3 2 1 3 

result:

ok good!

Test #47:

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

input:

3
4 2 9
3
1 2 3

output:

9
1 3 
1 3 
1 3 
1 3 
1 3 
2 1 3 
2 1 3 
3 2 1 3 
3 2 1 3 

result:

ok good!

Test #48:

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

input:

4
3 5 4 3
2
3 4

output:

5
3 1 3 2 
3 4 3 2 
3 1 3 2 
3 4 3 2 
3 4 1 2 

result:

ok good!

Test #49:

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

input:

4
1 4 5 5
3
1 3 4

output:

5
3 2 4 3 
3 1 4 3 
3 2 4 3 
3 2 4 3 
3 2 4 3 

result:

ok good!

Test #50:

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

input:

4
3 3 6 3
3
2 3 4

output:

6
2 2 3 
2 1 3 
2 2 3 
2 4 3 
3 4 1 3 
4 4 2 1 3 

result:

ok good!

Test #51:

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

input:

5
4 3 3 3 1
3
2 4 5

output:

4
2 4 1 
4 4 3 2 1 
4 5 3 2 1 
4 4 3 2 1 

result:

ok good!

Test #52:

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

input:

5
4 3 3 3 2
3
3 4 5

output:

4
3 4 3 1 
3 4 2 1 
4 5 3 2 1 
5 5 4 3 2 1 

result:

ok good!

Test #53:

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

input:

5
4 4 4 2 1
3
2 4 5

output:

5
2 3 1 
2 3 2 
2 2 1 
4 4 3 2 1 
5 5 4 3 2 1 

result:

ok good!

Test #54:

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

input:

5
3 3 3 3 3
3
1 2 4

output:

5
1 4 
2 5 3 
4 4 3 2 1 
4 5 3 2 1 
4 5 4 2 1 

result:

ok good!

Test #55:

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

input:

6
3 3 3 2 2 2
3
2 4 6

output:

-1

result:

ok no solution

Test #56:

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

input:

6
3 3 3 2 2 2
3
2 5 6

output:

3
5 5 4 3 2 1 
5 6 4 3 2 1 
5 6 5 3 2 1 

result:

ok good!

Test #57:

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

input:

6
4 4 3 2 1 1
3
1 3 5

output:

5
1 1 
1 2 
3 3 2 1 
5 5 4 3 2 1 
5 6 4 3 2 1 

result:

ok good!

Test #58:

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

input:

6
7 2 2 2 1 1
5
2 3 4 5 6

output:

7
2 3 1 
2 4 1 
2 2 1 
2 6 1 
2 3 1 
2 4 1 
3 5 2 1 

result:

ok good!

Test #59:

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

input:

7
3 3 3 2 2 1 1
3
1 4 6

output:

4
1 4 
4 7 3 2 1 
4 5 3 2 1 
6 6 5 4 3 2 1 

result:

ok good!

Test #60:

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

input:

7
4 4 3 1 1 1 1
3
1 4 6

output:

6
1 1 
1 2 
1 5 
4 6 3 2 1 
4 4 3 2 1 
4 7 3 2 1 

result:

ok good!

Test #61:

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

input:

8
2 2 2 2 2 2 2 1
6
1 2 3 4 6 7

output:

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

result:

ok good!

Test #62:

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

input:

8
3 3 3 2 1 1 1 1
4
4 6 7 8

output:

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

result:

ok good!

Test #63:

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

input:

8
4 3 3 1 1 1 1 1
4
1 6 7 8

output:

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

result:

ok good!

Test #64:

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

input:

9
4 3 2 1 1 1 1 1 1
4
3 4 5 7

output:

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

result:

ok good!

Test #65:

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

input:

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

output:

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

result:

ok good!

Test #66:

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

input:

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

output:

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

result:

ok good!

Test #67:

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

input:

4
2 2 2 1
2
1 4

output:

4
1 2 
1 3 
1 1 
4 4 3 2 1 

result:

ok good!

Subtask #4:

score: 45
Accepted

Dependency #1:

100%
Accepted

Dependency #3:

100%
Accepted

Test #68:

score: 45
Accepted
time: 2ms
memory: 5388kb

input:

150
24 12 11 10 9 9 9 9 9 8 8 7 7 7 7 7 6 6 6 6 6 6 6 5 5 5 5 5 5 5 5 5 5 5 5 5 4 4 4 4 4 4 4 4 4 4 4 4 4 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 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 1 1 1 1 1 1 1 1 1 1 1 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:

25
18 115 88 85 104 57 61 66 37 24 29 34 19 23 12 8 4 2 1 
18 150 132 84 101 60 50 70 37 25 28 35 18 16 14 10 6 2 1 
18 131 139 80 76 57 55 64 37 49 28 35 21 14 11 8 6 2 1 
18 146 87 77 76 58 53 65 39 49 27 20 21 15 12 10 6 2 1 
18 147 86 93 106 99 54 68 42 24 32 35 23 15 13 9 4 2 1 
18 124 144 81 1...

result:

ok good!

Test #69:

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

input:

200
9 9 9 8 8 8 7 7 6 6 6 6 6 6 6 6 5 5 5 5 5 5 5 5 5 5 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 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 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

output:

10
1 163 
9 148 14 15 6 5 4 1 3 2 
9 146 13 16 7 5 4 1 3 2 
9 153 10 11 8 6 5 1 3 2 
9 9 12 8 7 6 4 1 3 2 
78 152 157 160 130 133 140 143 187 190 197 191 169 172 179 88 91 92 95 86 83 82 80 76 74 99 126 125 122 118 116 115 100 105 107 110 112 56 55 53 47 45 50 67 27 36 31 34 35 39 40 43 44 17 19 20 ...

result:

ok good!

Test #70:

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

input:

250
8 7 7 7 7 6 6 6 6 5 5 5 5 5 5 5 5 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 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 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

output:

9
1 1 
1 163 
33 164 171 178 185 79 86 89 62 65 39 46 60 53 18 20 23 27 28 30 32 11 12 14 16 13 9 8 7 5 4 3 2 1 
33 160 168 174 186 127 82 91 64 44 38 36 58 52 50 19 23 25 29 32 33 10 11 14 16 13 8 7 6 5 4 3 2 1 
33 159 166 173 180 187 85 92 61 42 40 47 59 51 49 20 22 26 29 31 24 10 12 15 17 13 9 8 ...

result:

ok good!

Test #71:

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

input:

300
8 6 6 5 5 5 5 4 4 4 4 4 4 4 4 4 4 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 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 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

output:

9
22 188 174 180 205 202 142 134 164 159 151 269 264 68 82 67 55 59 112 13 7 4 2 
23 187 179 209 204 196 138 133 136 155 150 274 260 72 81 49 57 65 113 11 15 6 3 1 
23 190 213 210 199 194 145 135 165 154 149 276 266 70 74 48 53 86 110 8 7 5 3 1 
23 184 173 212 207 197 139 128 167 162 152 270 259 69 ...

result:

ok good!

Test #72:

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

input:

300
5 5 5 5 5 5 5 4 4 4 4 4 4 4 4 4 4 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 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 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

output:

6
6 192 217 179 6 5 2 
6 191 189 1 7 4 3 
63 193 184 182 177 215 210 196 202 199 153 150 176 142 137 145 171 168 163 160 166 277 272 269 264 261 298 295 290 287 282 237 72 71 24 30 26 23 21 19 29 42 40 38 36 34 31 8 9 10 12 11 13 14 16 17 15 1 7 6 5 4 3 2 
63 190 188 180 216 213 208 205 200 197 151 ...

result:

ok good!

Test #73:

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

input:

350
5 5 4 4 4 4 4 4 4 4 4 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 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 1 1 1 1 1 1 1 1 1 1 1 1 1 1 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:

6
2 199 2 
2 196 1 
53 198 190 187 182 179 174 171 226 223 218 200 210 207 202 139 134 131 126 123 118 115 125 167 162 159 154 151 146 143 318 315 310 307 302 13 19 16 18 21 23 26 25 3 4 5 6 7 8 9 11 10 1 2 
53 197 191 186 183 178 175 185 227 222 219 214 211 206 203 138 135 130 127 122 119 114 111 1...

result:

ok good!

Test #74:

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

input:

70
51 39 26 24 21 18 16 15 15 12 11 10 10 9 9 9 8 8 7 7 7 7 7 7 6 6 6 6 6 6 6 5 5 5 5 5 5 5 4 4 4 4 4 4 3 3 3 3 3 3 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1 1 1
14
1 14 15 17 26 27 34 35 41 44 48 58 62 65

output:

56
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 2 
1 2 
1 2 
1 2 
1 2 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
14 53 42 37 28 20 23 14 10 8 6 4 3 2 1 
14 52 40 34 31 20 24 16 12 8 6 4 3 2 1 
14 51 45 37 28 21 19 16 12 9 7 5 4 2 1 
14 68 41 32 27 21 24 14 10 8 6 5 3 2 1 
14 54 48 37 28 20 18 15 11 ...

result:

ok good!

Test #75:

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

input:

70
22 22 20 19 18 15 14 13 13 13 12 12 12 12 12 12 11 11 10 9 9 9 9 9 9 9 8 8 8 8 8 7 6 6 6 6 6 5 5 5 5 5 5 5 4 4 3 3 3 3 3 3 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
9
1 3 7 9 16 17 62 68 69

output:

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

result:

ok good!

Test #76:

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

input:

40
61 55 33 31 28 26 26 23 21 20 18 15 13 11 11 10 9 9 8 8 7 7 7 6 4 4 4 4 3 3 2 2 2 2 2 1 1 1 1 1
9
1 12 18 20 24 29 30 32 40

output:

79
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 2 
1 2 
1 2 
1 2 
1 2 
1 2 
1 2 
1 2 
1 2 
1 2 
1 1 
1 2 
1 2 
1 2 
1 2 
1 2 
1 2 
1 2 
1 1 
1 1 
1 1 
12 39 20 16 12 10 8 7 6 4 3 2 1 
12 32 24 16 12 10 8 7 6 4 3 2 1 
12 34 21 17 14 11 9 8...

result:

ok good!

Test #77:

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

input:

127
64 32 32 16 16 16 16 8 8 8 8 8 8 8 8 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 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 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
7
1 2 4 8 16 32 64

output:

64
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
4 7 3 2 1 
4 6 3 2 1 
4 4 3 2 1 
4 4 3 2 1 
4 4 3 2 1 
4 4 3 2 1 
4 7 3 2 1 
4 90 3 2 1 
4 6 3 2 1 
4 89 3 2 1 
4 7 3 2 1 
4 88 3 2 1 
4 ...

result:

ok good!

Test #78:

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

input:

10
31 67 31 15 21 37 53 96 81 68
4
1 2 8 10

output:

115
2 7 9 
2 9 8 
2 9 8 
2 9 8 
2 9 8 
2 9 8 
2 10 8 
2 7 8 
2 7 8 
2 10 8 
2 10 8 
2 10 8 
2 10 8 
2 10 8 
2 7 8 
2 2 8 
2 2 8 
2 2 8 
2 2 8 
2 2 8 
2 2 8 
2 2 8 
2 2 8 
2 7 8 
2 10 8 
2 10 8 
2 10 8 
2 10 8 
2 10 8 
2 9 8 
2 10 9 
2 2 9 
2 2 9 
2 2 9 
2 2 9 
2 2 9 
2 2 9 
2 2 9 
2 7 9 
2 7 9 
2 2 ...

result:

ok good!

Test #79:

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

input:

40
24 20 23 12 7 11 20 16 1 4 2 21 12 13 7 17 5 15 4 24 17 8 13 8 15 9 16 21 12 7 3 16 6 5 21 8 11 12 11 23
5
8 12 13 27 29

output:

24
8 34 2 12 35 40 3 20 1 
8 19 7 12 28 35 3 20 1 
8 17 21 2 28 40 3 20 1 
8 27 7 12 35 40 3 20 1 
8 34 8 2 28 40 3 20 1 
8 34 16 12 28 40 3 20 1 
8 9 7 2 28 35 40 20 1 
8 34 7 12 35 40 3 20 1 
13 17 32 21 16 7 2 12 28 35 40 3 20 1 
27 31 33 30 36 24 39 6 37 29 4 14 18 25 27 8 32 21 16 7 2 12 28 35 ...

result:

ok good!

Test #80:

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

input:

40
2 18 20 17 18 15 12 4 6 12 13 20 2 15 22 20 21 8 8 1 3 9 22 16 5 8 12 11 8 16 4 19 14 13 13 16 24 21 1 11
14
1 4 5 8 10 13 14 21 23 24 32 33 34 36

output:

24
1 37 
1 37 
4 38 15 23 37 
4 17 15 23 37 
8 16 12 3 17 38 15 23 37 
10 5 32 16 12 3 17 38 15 23 37 
10 2 32 16 12 3 17 38 15 23 37 
13 30 4 5 2 32 16 12 3 17 38 15 23 37 
14 36 24 4 5 2 32 16 12 3 17 38 15 23 37 
21 27 10 34 33 6 14 36 30 24 4 5 2 32 16 12 3 17 38 15 23 37 
21 27 10 34 33 6 14 36...

result:

ok good!

Test #81:

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

input:

130
5 1 7 5 7 6 4 2 4 2 7 1 5 1 1 7 4 3 3 4 3 5 1 5 5 2 1 6 5 2 7 2 1 2 3 1 1 6 1 5 3 2 1 5 7 6 5 2 5 3 5 4 2 3 1 3 2 4 6 6 1 3 4 7 6 2 7 1 7 7 5 7 2 3 1 2 2 4 4 1 3 4 7 3 7 3 6 1 1 3 3 6 5 7 4 1 4 5 3 3 5 4 4 6 1 3 2 6 4 7 3 4 2 6 1 2 7 7 7 6 5 6 7 5 2 2 2 2 7 2
7
26 43 55 69 82 116 125

output:

7
26 89 55 12 32 8 128 64 5 94 129 3 110 67 11 69 70 16 83 45 72 117 118 123 119 31 85 
43 68 37 57 77 107 125 74 111 56 6 87 92 122 28 60 65 46 104 114 38 108 120 59 64 5 94 129 3 110 67 11 69 70 16 83 45 72 117 118 123 119 31 85 
69 80 96 48 30 10 127 74 50 54 62 100 18 86 90 58 9 109 29 25 121 24...

result:

ok good!

Test #82:

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

input:

130
5 4 7 2 1 6 4 3 4 4 4 3 7 4 5 1 2 1 6 1 7 4 6 4 2 4 2 7 1 3 1 7 1 3 1 2 6 4 7 3 6 5 3 2 6 3 1 7 2 1 1 6 7 6 1 3 4 5 7 1 3 1 5 7 6 3 4 6 1 5 1 5 5 6 3 1 7 6 7 2 5 6 4 7 3 7 4 2 5 2 6 4 1 2 4 1 7 4 4 6 2 5 5 3 4 6 1 2 3 2 2 3 6 1 7 4 1 2 5 4 3 5 5 3 5 2 2 3 5 5
45
1 4 5 6 15 18 20 23 28 31 32 33 3...

output:

7
18 113 19 13 53 59 3 115 21 48 77 97 28 79 32 86 84 39 64 
31 52 106 74 54 23 100 78 45 6 91 65 37 41 82 68 13 53 59 3 115 21 48 77 97 28 79 32 86 84 39 64 
66 66 124 46 104 34 10 7 57 22 87 92 99 105 67 2 122 119 123 15 103 102 125 129 130 1 89 63 72 73 42 81 58 70 52 113 106 19 74 54 23 100 78 4...

result:

ok good!

Test #83:

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

input:

130
2 6 1 6 1 4 5 4 3 4 4 7 6 3 6 1 2 7 4 5 1 5 4 2 6 3 6 3 1 1 2 7 2 5 6 1 5 1 6 3 7 4 4 6 6 1 7 1 1 3 2 7 3 6 1 7 2 5 5 1 5 1 1 4 6 2 4 5 1 2 6 2 1 6 4 2 6 4 5 6 5 4 1 5 6 6 1 2 1 6 2 1 6 1 2 6 4 3 1 4 6 3 7 7 7 3 3 5 1 6 2 7 6 6 6 2 4 3 3 7 4 6 3 7 3 2 3 4 1 3
9
2 3 4 6 8 9 10 16 17

output:

30
8 16 1 50 118 67 19 20 79 
16 99 88 28 107 23 78 22 59 25 114 101 93 39 113 18 120 
17 30 17 26 98 23 128 34 79 27 122 54 90 44 80 56 104 112 
17 109 26 53 123 121 117 81 61 4 13 96 85 110 80 124 104 41 
17 48 66 14 118 43 78 20 59 4 122 101 93 74 113 56 105 112 
17 3 111 50 127 10 6 34 7 27 96 6...

result:

ok good!

Test #84:

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

input:

70
8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 7 7 7 7 7 7 6 6 6 6 6 6 6 6 6 5 5 5 5 5 5 5 5 5 5 5 5
20
1 2 3 4 6 7 8 9 10 13 21 24 30 31 33 40 45 46 54 70

output:

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

result:

ok good!

Test #85:

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

input:

90
8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 7 7 7 7 6 6 6 6 6 6 6 5 5 5 5 5 5 5 5 4 4 4 4 4 4 4 4 4 4 4 4 4 4 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 2 2
20
1 2 3 6 7 8 9 10 13 20 24 30 32 46 53 63 68 69 70 79

output:

8
46 67 69 72 75 77 50 46 43 41 39 34 35 36 10 18 16 15 14 13 12 11 9 8 7 6 5 4 3 17 1 33 32 31 30 29 28 2 26 25 24 23 22 21 20 19 27 
46 68 71 74 76 49 47 44 42 40 38 34 36 37 10 18 16 15 14 13 12 11 9 8 7 6 5 4 3 17 1 33 32 31 30 29 28 2 26 25 24 23 22 21 20 19 27 
46 90 69 74 77 45 48 44 42 40 38...

result:

ok good!

Test #86:

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

input:

120
8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 7 7 7 7 6 6 6 6 6 6 5 5 5 5 5 5 5 4 4 4 4 4 4 4 4 4 4 4 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 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 1 1 1 1 1 1 1 1
20
1 2 3 4 5 9 10 14 15 19 25 28 30 33 36 77 78 99 108 116

output:

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

result:

ok good!

Test #87:

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

input:

200
4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 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 1 1 1 1 1 1 1 1 1 ...

output:

5
8 167 164 157 154 147 144 198 195 
123 169 162 159 152 149 142 155 193 190 200 174 177 180 107 108 110 113 114 105 100 99 97 94 93 115 137 136 134 101 131 129 119 120 122 125 126 128 74 79 77 75 73 71 70 81 92 91 90 88 87 76 85 84 83 27 19 21 22 23 24 25 26 28 29 30 31 32 33 34 20 36 3 4 5 6 7 8 9...

result:

ok good!

Test #88:

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

input:

250
4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 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 1 1 1 1 1 1 1 1 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:

4
59 154 156 16 18 19 20 21 22 23 24 25 26 27 28 17 15 14 13 12 11 10 9 8 7 6 5 4 3 30 29 1 57 56 55 54 53 52 51 50 49 48 47 46 2 44 43 42 41 40 39 38 37 36 35 34 33 32 31 45 
147 153 155 161 164 182 179 176 173 170 167 131 128 150 122 119 125 147 144 141 138 135 233 230 227 224 221 218 249 246 234 ...

result:

ok good!

Test #89:

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

input:

300
4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 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 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 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:

5
3 170 163 160 
51 168 165 54 48 49 13 15 16 17 18 19 20 21 22 14 12 11 10 9 8 7 6 5 4 3 24 23 1 46 45 44 43 42 41 40 39 38 37 2 35 34 33 32 31 30 29 28 27 26 25 36 
61 169 162 157 47 50 52 53 55 56 57 51 58 59 60 61 13 15 16 17 18 19 20 21 22 14 12 11 10 9 8 7 6 5 4 3 24 23 1 46 45 44 43 42 41 40 ...

result:

ok good!

Test #90:

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

input:

100
9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 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
49
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 76 77 78 79 80 81 82 83 84 85 ...

output:

18
16 17 18 20 22 24 13 12 9 7 5 26 50 48 46 44 42 
24 17 19 21 23 24 15 11 9 7 5 3 1 49 47 45 43 41 2 37 35 33 31 29 27 
24 16 18 20 22 14 13 11 10 6 4 26 25 50 48 45 43 41 2 37 35 33 31 29 27 
24 17 19 22 24 15 12 10 8 6 4 26 1 50 48 45 43 41 2 37 35 33 31 29 27 
24 18 19 21 23 14 13 11 9 6 3 26 1...

result:

ok good!

Test #91:

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

input:

446
55 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 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:

55
9 154 176 5 84 345 433 228 326 1 
9 113 187 40 77 343 394 279 332 1 
9 156 209 21 95 355 398 227 320 1 
9 142 192 49 101 366 432 276 295 1 
9 126 183 9 97 342 392 236 287 1 
9 118 196 22 82 363 396 262 284 1 
9 136 195 52 103 346 429 263 328 1 
9 158 200 44 111 353 428 243 285 1 
9 155 220 6 15 3...

result:

ok good!

Test #92:

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

input:

470
31 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 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:

31
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
470 148 149 150 151 152 153 154 155 156 157 158 159 160 235 162 163 164 165 166 167 168 169 170 171 172 173 174 175 161 119 120 121 122 123 124 125...

result:

ok good!

Test #93:

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

input:

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

output:

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

result:

ok good!

Test #94:

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

input:

100
1 14 14 8 2 2 5 16 7 1 4 7 7 2 7 2 1 1 4 5 2 14 9 3 7 1 11 4 7 4 2 8 17 1 7 1 7 2 11 3 3 2 1 7 1 9 1 7 3 3 4 2 1 10 1 1 1 3 8 7 1 1 1 2 4 1 3 16 5 9 3 3 1 3 2 3 7 11 1 3 1 11 13 4 1 3 1 17 1 2 1 16 11 4 9 5 6 4 1 2
7
1 2 4 8 16 32 64

output:

18
1 33 
2 13 88 
8 15 3 2 68 8 92 33 88 
8 25 46 22 68 8 92 33 88 
8 66 3 2 68 8 92 33 88 
8 4 83 22 68 8 92 33 88 
16 13 95 54 93 82 78 39 83 3 22 2 68 8 92 33 88 
16 15 46 54 82 78 27 39 83 3 22 2 68 8 92 33 88 
16 25 95 54 93 82 27 39 83 3 22 2 68 8 92 33 88 
16 32 23 70 93 78 27 39 83 3 22 2 68...

result:

ok good!

Test #95:

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

input:

350
3 1 1 2 1 2 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 2 3 1 1 1 2 2 1 1 1 1 1 1 1 1 1 1 2 1 1 2 2 1 1 2 1 1 1 1 1 1 1 1 1 1 1 2 1 2 2 1 1 1 1 1 1 3 1 1 1 1 2 1 1 1 1 2 2 1 1 1 2 2 1 2 1 1 1 2 2 1 1 5 1 1 2 1 3 1 1 1 1 1 1 2 1 3 1 1 1 2 1 1 1 1 1 1 2 1 1 1 2 1 1 1 1 1 1 1 1 1 1 3 2 1 1 3 1 ...

output:

7
1 206 
2 129 308 
16 134 139 146 105 112 119 125 181 150 193 188 156 103 247 206 308 
32 131 135 142 148 110 126 123 113 185 189 197 152 160 165 168 26 29 38 41 46 3 11 14 233 298 332 344 327 103 247 206 308 
64 127 199 140 102 107 116 120 177 182 191 195 154 158 163 166 161 27 34 39 44 35 9 12 17...

result:

ok good!

Subtask #5:

score: 15
Accepted

Dependency #4:

100%
Accepted

Test #96:

score: 15
Accepted
time: 4ms
memory: 5496kb

input:

27
12 148 141 10 98 1 82 103 145 60 190 102 181 147 152 185 24 134 179 127 141 38 169 93 132 157 49
6
1 5 7 13 17 26

output:

190
1 11 
1 11 
1 11 
1 11 
1 11 
5 7 23 13 16 11 
5 10 5 13 16 11 
5 10 5 13 16 11 
5 7 19 13 16 11 
5 7 23 13 16 11 
5 7 19 13 16 11 
5 7 23 13 16 11 
5 7 19 13 16 11 
5 10 5 19 16 11 
5 7 19 13 16 11 
5 7 19 13 16 11 
5 10 5 13 16 11 
5 7 19 13 16 11 
5 7 19 13 16 11 
5 7 19 13 16 11 
5 10 5 19 1...

result:

ok good!

Test #97:

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

input:

160
35 20 9 34 11 22 2 17 18 37 32 27 4 22 26 15 32 19 22 29 8 30 7 10 23 33 11 18 24 18 29 34 17 35 26 12 28 6 27 19 37 34 8 7 33 32 18 13 24 13 26 34 6 3 37 9 10 6 16 34 19 8 30 8 14 14 32 3 35 18 12 20 1 19 25 30 19 6 2 16 15 24 34 6 31 7 22 29 11 14 14 23 7 25 32 14 9 11 21 31 37 31 2 19 31 4 13...

output:

37
8 134 95 69 101 55 10 41 122 
8 102 1 34 101 55 10 41 122 
8 100 95 110 101 55 10 41 122 
20 105 67 17 26 151 42 52 83 32 4 60 1 110 34 69 101 55 10 41 122 
20 85 11 45 26 151 42 52 83 32 4 60 1 110 34 69 101 55 10 41 122 
20 150 67 46 45 151 42 52 83 32 4 60 1 110 34 69 101 55 10 41 122 
22 152 ...

result:

ok good!

Test #98:

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

input:

600
5 6 6 1 7 4 1 2 8 3 4 4 8 6 4 9 6 2 2 8 8 6 6 1 3 2 3 2 5 5 1 7 8 8 3 6 6 3 2 7 6 4 9 6 7 8 2 4 5 8 9 6 1 1 5 5 1 4 3 3 4 5 6 6 8 4 8 8 3 5 6 2 8 1 3 3 7 7 3 1 2 4 8 8 5 5 5 5 9 5 9 1 6 5 1 6 4 1 4 6 7 6 5 4 6 8 4 5 5 3 9 9 7 6 5 3 3 5 8 5 6 5 4 8 4 1 2 5 1 7 5 3 9 3 4 8 6 9 4 9 5 7 9 7 5 3 9 4 ...

output:

9
101 422 468 529 200 314 163 7 72 331 272 304 423 84 83 566 33 21 544 50 519 106 584 67 13 73 9 592 323 322 326 551 188 189 192 178 194 43 255 259 262 587 267 214 16 273 327 283 290 294 575 571 569 568 562 560 211 138 462 133 380 457 385 453 89 390 91 233 395 396 397 429 112 111 424 414 416 419 391...

result:

ok good!

Test #99:

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

input:

400
15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 14 14 14 14 14 13 13 13 13 13 13 13 12 12 12 12 12 12...

output:

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

result:

ok good!

Test #100:

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

input:

750
7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 ...

output:

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

result:

ok good!

Test #101:

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

input:

460
13 13 13 13 13 13 13 13 13 13 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12...

output:

24
32 83 84 86 89 90 80 77 75 73 71 69 68 91 116 115 113 112 110 108 104 102 100 98 96 94 106 36 34 31 30 27 25 
114 81 84 86 88 79 78 76 74 72 70 120 92 66 117 116 114 112 110 107 105 103 101 99 97 95 93 37 33 31 29 28 25 23 21 19 17 16 14 12 24 64 63 59 57 55 53 51 49 47 45 44 42 40 52 201 200 196...

result:

ok good!

Test #102:

score: 0
Accepted
time: 49ms
memory: 36876kb

input:

2751
250 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 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
12 1377 711 1068 325 558 2307 2230 2421 1689 1971 2015 1 
12 990 848 1127 171 647 372 2201 2706 1438 1536 1889 1 
12 940 802 1046 16 518 436 2665 2578 1578 1416 1735 1 
12 924 715 1054 133 109 2378 2642 2736 1665 1953 1767 1 
12 913 712 1092 4 425 500 2334 2646 2572 1511 2013 1 
12 737 716 1324 ...

result:

ok good!

Test #103:

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

input:

2924
77 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 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:

77
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 ...

result:

ok good!

Test #104:

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

input:

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

output:

76
19 31 27 25 23 20 18 16 14 13 11 10 9 7 6 5 4 3 2 1 
19 31 27 24 22 20 18 17 15 13 12 10 9 8 7 6 4 3 2 1 
19 35 29 25 22 20 18 16 14 13 11 10 8 7 6 5 4 3 2 1 
19 30 27 25 23 21 19 17 15 13 11 10 9 7 6 5 4 3 2 1 
19 30 27 25 23 19 17 16 15 13 12 10 9 8 7 6 5 3 2 1 
19 31 28 25 22 20 18 16 15 13 11...

result:

ok good!

Test #105:

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

input:

1500
1 2 2 2 1 1 1 2 1 2 1 1 1 1 1 3 1 2 2 1 1 1 4 1 1 2 2 3 4 2 2 4 4 1 1 1 1 2 2 1 1 2 2 1 1 1 1 2 2 1 1 1 2 4 1 3 3 1 1 1 3 1 1 1 1 2 2 1 2 1 3 1 1 1 4 2 2 1 1 1 1 1 1 2 2 2 6 4 1 1 1 2 2 2 3 1 3 1 4 3 1 1 1 2 1 1 1 2 1 1 1 2 2 1 4 2 2 3 3 7 3 2 1 2 1 3 3 1 3 5 1 2 5 2 3 4 1 3 3 1 1 2 1 2 1 1 3 1...

output:

11
1 1279 
2 558 1279 
4 691 671 558 1279 
16 684 672 648 754 736 724 703 576 977 1019 1429 808 718 1483 558 1279 
32 687 674 656 750 737 716 706 582 202 1304 421 1477 1377 1113 596 1237 1316 120 920 1294 291 1044 713 214 163 774 1429 808 718 1483 558 1279 
64 676 666 658 757 733 719 699 587 1015 12...

result:

ok good!

Test #106:

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

input:

2400
2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 1 1 3 1 2 1 1 2 1 1 1 4 2 1 1 1 2 1 1 3 1 1 1 1 1 1 1 3 3 1 1 1 1 1 2 1 1 1 1 1 1 1 2 1 1 2 1 1 2 1 1 1 2 3 1 1 2 1 1 1 3 1 1 1 1 3 2 1 3 1 1 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 1 3 2 2 2 1 1 1 3 1 1 1 1 1 1 4 2 3...

output:

9
1 897 
2 892 1339 
4 893 928 924 918 
16 895 900 923 917 920 859 867 889 876 972 974 982 1008 1004 992 1267 
32 899 906 921 912 856 858 866 884 880 879 978 981 929 1000 997 932 938 944 968 960 953 959 726 732 737 755 749 742 225 1335 1336 1267 
128 898 905 927 919 909 862 890 888 878 871 973 984 1...

result:

ok good!

Subtask #6:

score: 15
Accepted

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Dependency #3:

100%
Accepted

Dependency #4:

100%
Accepted

Dependency #5:

100%
Accepted

Test #107:

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

input:

40
153 344 238 669 595 304 297 265 438 678 232 354 377 249 297 629 693 559 65 283 407 198 128 290 443 371 667 289 86 601 429 231 266 624 474 12 319 436 364 646
7
1 8 9 12 21 27 28

output:

693
1 17 
1 17 
1 17 
1 17 
1 17 
1 17 
1 17 
1 17 
1 17 
1 17 
1 17 
1 17 
1 17 
1 17 
1 17 
8 5 34 16 40 27 4 10 17 
8 5 34 16 40 27 4 10 17 
8 18 30 16 40 27 4 10 17 
8 23 30 34 40 27 4 10 17 
8 5 34 16 40 27 4 10 17 
8 23 30 34 40 27 4 10 17 
8 5 34 16 40 27 4 10 17 
8 23 30 34 40 27 4 10 17 
8 ...

result:

ok good!

Test #108:

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

input:

420
51 4 68 8 19 9 42 34 39 31 62 47 46 32 55 42 31 28 37 21 36 44 8 13 56 30 15 4 23 17 56 42 38 25 26 5 39 16 38 46 55 26 23 34 27 36 60 55 35 38 69 31 49 21 28 42 27 21 57 12 47 52 56 10 32 6 33 64 20 44 15 50 45 25 53 30 59 43 47 43 45 36 62 57 16 7 20 17 49 11 18 42 28 24 48 13 45 40 28 19 6 38...

output:

70
18 401 120 282 3 414 238 150 305 210 51 116 343 130 296 324 291 170 243 
18 352 219 120 347 414 355 150 176 210 51 131 343 130 296 324 291 170 243 
18 285 217 156 347 414 355 176 305 210 131 116 343 130 296 324 291 170 243 
18 78 309 156 347 3 238 150 305 51 131 116 343 130 296 324 291 170 243 
1...

result:

ok good!

Test #109:

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

input:

3500
4 4 7 4 7 1 6 6 7 1 1 6 1 4 3 2 4 1 5 3 8 1 4 1 3 6 2 7 7 2 3 2 8 2 3 4 1 2 2 4 6 8 1 2 8 7 7 4 4 1 3 5 1 6 7 2 3 4 3 1 7 8 1 6 7 4 5 1 2 2 7 6 5 1 3 1 4 5 5 8 5 6 5 6 1 7 2 1 1 6 3 1 1 2 7 6 8 7 1 7 4 6 8 2 4 5 3 1 6 1 8 4 4 5 3 2 2 2 3 3 2 2 4 2 8 3 6 7 3 2 1 1 2 7 3 5 8 5 1 1 4 6 5 7 1 2 2 2...

output:

8
686 685 859 1993 2515 2067 714 2038 707 3197 3194 199 2304 3201 696 1108 1986 2526 1132 2979 944 2206 2841 2278 2850 2247 756 2253 2472 3074 3068 316 2920 740 2466 3030 2145 3398 1570 60 1379 763 666 653 600 2667 757 733 729 2530 1764 1266 1707 1683 1212 1239 1782 1546 1412 1482 1341 1634 1374 159...

result:

ok good!

Test #110:

score: 0
Accepted
time: 87ms
memory: 4252kb

input:

700
70 70 70 70 70 70 70 70 70 70 70 70 70 70 70 70 70 70 70 70 70 70 70 70 70 70 70 70 70 70 70 70 70 70 70 70 70 70 70 70 70 70 70 70 70 70 70 70 70 70 70 70 70 70 70 70 70 70 70 70 70 70 70 70 69 68 67 66 65 64 64 63 62 61 60 59 59 58 57 56 56 55 54 54 53 52 52 51 51 50 49 49 48 48 47 47 46 46 45...

output:

103
1 151 
6 668 148 132 125 118 110 
9 155 140 134 117 114 106 104 101 96 
60 667 135 130 124 113 110 104 101 96 93 91 89 86 83 80 77 75 74 71 69 67 65 22 23 20 24 26 28 30 32 19 2 33 6 8 4 10 12 14 15 17 1 63 61 60 58 57 55 53 52 47 48 45 43 42 41 39 37 36 34 
60 668 147 131 122 118 109 108 103 99...

result:

ok good!

Test #111:

score: 0
Accepted
time: 106ms
memory: 5676kb

input:

6250
5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5...

output:

6
291 4361 4352 4350 4385 4383 4364 4366 4375 4311 4342 4301 4336 4334 4325 4323 4448 4439 4437 4472 4470 4462 4464 4406 4431 4395 4387 4423 4421 4412 4410 4181 4172 4170 4205 4203 4195 4141 4139 4130 4128 4131 4156 4142 4145 4143 4269 4260 4258 4293 4291 4283 4229 4227 4218 4216 4253 4244 4242 4233...

result:

ok good!

Test #112:

score: 0
Accepted
time: 239ms
memory: 31668kb

input:

2000
14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 1...

output:

28
26 332 334 337 339 341 343 329 327 325 323 321 319 317 345 374 373 371 368 367 364 362 360 358 356 354 352 
499 332 334 336 338 340 342 330 328 326 324 322 320 318 316 344 372 371 368 366 365 363 315 359 357 355 353 351 349 347 361 280 278 276 274 272 270 268 266 264 262 260 258 256 254 376 313 3...

result:

ok good!

Test #113:

score: 0
Accepted
time: 979ms
memory: 445496kb

input:

13930
1071 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 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:

1071
14 4776 3701 6545 1045 666 2159 11461 11879 13209 12834 8000 7714 9473 1 
14 5101 3656 5448 1709 801 3436 11694 12116 13137 12775 8562 9644 9471 1 
14 3871 6489 6875 5987 107 3238 2394 11870 13125 12812 8512 7551 10146 1 
14 4672 6396 5883 1653 2880 1784 2421 10655 13806 12576 7108 9905 10185 1...

result:

ok good!

Test #114:

score: 0
Accepted
time: 402ms
memory: 255276kb

input:

14828
173 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 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:

173
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1 1 
1...

result:

ok good!

Test #115:

score: 0
Accepted
time: 142ms
memory: 10656kb

input:

172
172 171 170 169 168 167 166 165 164 163 162 161 160 159 158 157 156 155 154 153 152 151 150 149 148 147 146 145 144 143 142 141 140 139 138 137 136 135 134 133 132 131 130 129 128 127 126 125 124 123 122 121 120 119 118 117 116 115 114 113 112 111 110 109 108 107 106 105 104 103 102 101 100 99 9...

output:

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

result:

ok good!

Test #116:

score: 0
Accepted
time: 59ms
memory: 4280kb

input:

5000
3 3 3 2 1 2 1 2 1 1 6 8 1 2 1 1 3 3 1 2 7 2 1 2 4 1 3 5 3 5 3 2 7 2 7 2 1 5 1 1 1 3 7 1 2 4 1 1 2 1 6 1 1 4 2 1 4 1 3 3 5 1 3 3 6 10 9 1 1 1 3 6 6 1 1 3 2 3 8 2 4 4 12 3 3 6 3 2 4 7 4 1 5 1 7 1 4 4 15 5 2 6 6 2 10 5 3 3 7 1 1 1 1 1 1 1 2 2 1 3 2 1 6 1 5 3 2 1 1 3 4 7 2 2 1 3 2 3 5 1 2 7 3 1 1 1...

output:

22
1 1224 
2 1224 2438 
2 2282 2438 
2 1224 2438 
8 2289 4400 1395 1989 1092 2178 1224 2438 
8 2009 3364 2110 1723 1092 2178 1224 2438 
16 3641 2074 2352 4908 4303 783 2388 1623 4477 2110 1989 1723 1092 2178 1224 2438 
16 2291 4135 99 4908 4303 783 2388 1623 4477 2110 1989 1723 1092 2178 1224 2438 
...

result:

ok good!

Test #117:

score: 0
Accepted
time: 50ms
memory: 5932kb

input:

11000
1 2 1 1 1 1 1 2 1 1 1 1 1 1 1 3 1 1 1 1 1 1 1 3 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 2 2 2 1 1 3 1 3 1 1 2 2 1 1 1 1 2 1 2 1 1 1 2 1 1 1 1 4 1 1 1 3 2 1 2 1 1 3 1 1 1 1 1 1 1 1 1 1 1 3 2 1 2 2 1 1 2 2 2 2 1 1 1 1 1 2 4 1 2 1 1 1 2 1 1 1 1 1 1 3 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 2 2 ...

output:

9
1 4188 
2 4196 4184 
4 4194 3901 1427 9052 
16 4190 4179 1489 4683 10348 2700 726 10648 9592 9653 478 554 7060 10604 1326 9052 
128 6360 4180 4217 4211 4205 4210 4143 4137 4128 4169 4163 4158 4151 4286 4220 4273 4315 4310 4302 4296 4237 4232 4226 4231 4261 4254 4247 4004 3998 3991 3985 4024 4017 4...

result:

ok good!

Extra Test:

score: 0
Extra Test Passed