QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#354006#6339. Cookieszyz07100 ✓59ms301144kbC++171.7kb2024-03-14 20:28:422024-03-14 20:28:42

Judging History

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

  • [2024-03-14 20:28:42]
  • 评测
  • 测评结果:100
  • 用时:59ms
  • 内存:301144kb
  • [2024-03-14 20:28:42]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
#define For(Ti,Ta,Tb) for(auto Ti=(Ta);Ti<=(Tb);++Ti)
#define Dec(Ti,Ta,Tb) for(auto Ti=(Ta);Ti>=(Tb);--Ti)
#define debug(...) fprintf(stderr,__VA_ARGS__)
#define range(Tx) begin(Tx),end(Tx)
using ll=long long;
const int N=15005;
int n,a[N],id[N],m,ok[N],s[N],lim[N];
bitset<N>* f[N];
vector<int> Ans[N];
int main(){
	cin.tie(nullptr)->sync_with_stdio(false);
	cin>>n;
	For(i,1,n){
		cin>>a[i];
	}
	iota(id+1,id+n+1,1);
	sort(id+1,id+n+1,[](int i,int j){
		return a[i]>a[j];
	});
	sort(a+1,a+n+1,greater<>());
	For(i,1,n){
		s[i]=s[i-1]+a[i];
	}
	cin>>m;
	For(i,1,m){
		int x;
		cin>>x;
		ok[x]=1;
	}
	For(i,1,n+1){
		f[i]=new bitset<N>[s[n]/i+1];
	}
	f[n+1][0].set(s[n]);
	Dec(i,n,1){
		For(j,0,s[n]/i){
			if(j<=s[n]/(i+1)) f[i][j]=f[i+1][j];
			if(j&&ok[i]) f[i][j]|=f[i][j-1]>>i;
			int k=s[i]-i*j;
			if(k>0) (f[i][j]>>=k)<<=k;
		}
	}
	int ans=-1;
	For(j,0,s[n]){
		if(f[1][j].test(0)){
			ans=j;
			break;
		}
	}
	if(!~ans){
		cout<<"-1\n";
		return 0;
	}
	cout<<ans<<'\n';
	int len=0;
	for(int i=1,j=ans,k=0;i<=n;++i){
		For(x,max(0,j-s[n]/(i+1)),j){
			if(f[i+1][j-x].test(k+x*i)){
				For(k,1,x){
					lim[++len]=i;
				}
				j-=x;
				k+=x*i;
				break;
			}
		}
	}
	priority_queue<pair<int,int>> q;
	For(i,1,ans){
		q.emplace(lim[i],i);
	}
	For(i,1,n){
		vector<int> idx;
		For(j,1,a[i]){
			idx.push_back(q.top().second);
			q.pop();
		}
		for(int j:idx){
			--lim[j];
			Ans[j].push_back(id[i]);
			q.emplace(lim[j],j);
		}
	}
	For(i,1,ans){
		cout<<Ans[i].size()<<' ';
		for(int j:Ans[i]){
			cout<<j<<' ';
		}
		cout<<'\n';
	}
	return 0;
}

詳細信息

Subtask #1:

score: 6
Accepted

Test #1:

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

input:

1
1
1
1

output:

1
1 1 

result:

ok good!

Test #2:

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

input:

2
1 1
1
1

output:

2
1 2 
1 1 

result:

ok good!

Test #3:

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

input:

2
1 1
1
2

output:

1
2 1 2 

result:

ok good!

Test #4:

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

input:

2
1 1
2
1 2

output:

1
2 1 2 

result:

ok good!

Test #5:

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

input:

4
1 1 1 1
2
2 3

output:

2
2 2 4 
2 1 3 

result:

ok good!

Test #6:

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

input:

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

output:

2
4 2 4 6 8 
4 1 3 5 7 

result:

ok good!

Test #7:

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

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 158 
1 159 
1 160 
1 161 
1 162 
1 163 
1 164 
1 165 
1 166 
1 167 
1 168 
1 169 
1 170 
1 171 
1 1 
1 173 
1 174 
1 175 
1 176 
1 177 
1 178 
1 179 
1 180 
1 181 
1 182 
1 183 
1 184 
1 185 
1 186 
1 187 
1 172 
1 127 
1 128 
1 129 
1 130 
1 131 
1 132 
1 133 
1 134 
1 135 
1 136 
1 137 
1 13...

result:

ok good!

Test #8:

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

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 329 344 343 342 341 340 339 338 337 336 335 334 333 332 331 330 345 328 327 326 325 324 323 322 321 320 319 318 317 316 315 314 360 375 374 373 372 371 370 369 368 367 366 365 364 363 362 361 313 359 358 357 356 355 354 353 352 351 350 349 348 347 346 266 281 280 279 278 277 276 275 274 273 27...

result:

ok good!

Test #9:

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

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
250 344 342 340 338 336 334 332 330 328 326 324 322 320 318 316 314 375 373 371 369 367 365 363 361 359 357 355 353 351 349 347 266 280 278 276 274 272 270 268 282 264 262 260 258 256 254 252 312 310 308 306 304 302 300 298 296 294 292 290 288 286 284 454 468 466 464 462 460 458 456 470 452 450 44...

result:

ok good!

Test #10:

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

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: 0ms
memory: 10732kb

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
45 330 319 371 313 349 275 264 253 304 293 454 459 448 500 489 478 404 393 382 433 251 411 88 77 66 118 107 96 22 11 62 51 40 217 206 195 247 236 225 151 140 129 180 169 158 
45 331 320 372 361 350 276 265 254 305 294 283 460 449 485 490 479 405 394 383 434 423 412 89 78 67 119 108 97 23 12 47 52...

result:

ok good!

Test #12:

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

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 408 158 
2 409 159 
2 410 160 
2 411 161 
2 412 162 
2 413 163 
2 414 164 
2 415 165 
2 416 166 
2 417 167 
2 418 168 
2 419 169 
2 420 170 
2 421 171 
2 251 1 
2 423 173 
2 424 174 
2 425 175 
2 426 176 
2 427 177 
2 428 178 
2 429 179 
2 430 180 
2 431 181 
2 432 182 
2 433 183 
2 434 184 
2...

result:

ok good!

Test #13:

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

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 313 352 269 247 285 445 484 462 394 417 395 71 110 27 5 43 203 242 220 152 175 153 
22 314 353 270 248 286 446 470 463 380 418 396 72 111 28 6 44 204 228 221 138 176 154 
22 315 354 271 249 287 447 425 464 381 419 397 73 112 29 7 45 205 183 222 139 177 155 
22 316 355 272 250 364 448 426 465 3...

result:

ok good!

Test #14:

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

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 349 372 487 432 68 13 205 151 157 
9 350 295 488 433 69 14 206 152 158 
9 351 296 489 418 70 15 207 153 159 
9 352 297 490 373 71 32 208 154 160 
9 353 298 491 374 72 17 209 155 161 
9 354 299 492 375 73 18 210 140 162 
9 355 300 493 376 74 19 211 218 163 
9 310 301 494 377 75 20 212 219 164 
9...

result:

ok good!

Test #15:

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

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 342 338 334 330 326 322 318 314 373 369 365 361 357 353 349 266 278 274 270 282 262 258 254 312 308 304 300 296 292 288 284 468 464 460 456 452 448 444 440 499 495 491 487 483 479 475 471 404 400 396 392 388 384 380 422 434 430 426 251 418 414 410 94 90 86 82 78 74 70 66 125 121 117 113 109 10...

result:

ok good!

Test #16:

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

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
17 278 251 286 447 483 393 428 90 110 99 9 44 204 239 150 185 158 
17 279 252 287 448 437 394 429 91 64 100 10 45 205 240 151 186 159 
17 280 253 288 449 485 395 430 92 65 101 11 46 206 241 152 187 160 
17 265 254 289 450 486 396 431 93 66 102 12 126 207 242 153 172 161 
17 345 255 290 451 487 39...

result:

ok good!

Test #17:

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

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
17 400 381 424 94 75 119 100 18 61 42 210 191 188 153 134 177 158 
23 259 303 285 455 484 482 401 382 425 79 76 120 101 19 62 43 211 192 235 154 135 178 159 
27 344 374 357 277 260 304 286 456 438 483 402 383 426 407 77 121 102 20 47 44 212 193 236 155 136 179 160 
27 329 359 358 278 261 305 287 ...

result:

ok good!

Test #18:

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

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
64 350 280 273 266 259 252 307 300 293 286 467 460 469 446 439 495 488 481 474 404 397 406 383 376 431 424 417 410 92 85 78 71 64 120 113 106 99 29 22 15 8 47 56 49 42 35 215 208 201 194 249 242 235 228 221 152 145 138 131 186 179 1 165 158 
64 351 265 274 267 260 253 308 301 294 287 468 461 454 4...

result:

ok good!

Test #19:

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

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 67 110 122 118 114 63 106 102 98 31 27 23 19 15 11 7 3 61 57 53 49 45 41 37 33 216 212 208 204 200 196 192 234 246 242 238 188 230 226 222 156 152 148 144 140 136 132 128 186 182 178 174 170 166 162 158 
56 68 64 123 119 115 111 107 103 99 16 28 24 20 32 12 8 4 62 58 54 50 46 42 38 34 217 213 2...

result:

ok good!

Test #20:

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

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
213 270 268 266 264 262 260 258 256 254 252 296 310 308 306 304 302 300 298 375 294 292 290 288 286 284 282 468 466 464 462 460 458 456 454 452 450 448 446 444 442 440 438 499 497 495 493 491 489 487 485 483 481 479 477 475 473 471 390 404 402 400 398 396 394 392 406 388 386 384 382 380 378 376 43...

result:

ok good!

Test #21:

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

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: 0ms
memory: 10992kb

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: 10688kb

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
18 385 429 412 86 69 114 97 19 2 46 213 196 241 224 146 129 173 156 
18 402 430 413 87 70 115 98 20 3 124 214 197 242 225 147 130 174 157 
18 387 431 414 88 71 116 99 21 4 48 215 198 243 226 148 131 175 158 
18 388 417 415 89 72 117 100 22 5 49 200 199 244 227 149 132 176 159 
18 389 372 416 90 7...

result:

ok good!

Test #24:

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

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
18 385 429 412 86 69 114 97 19 2 46 213 196 241 224 146 129 173 156 
18 402 430 413 87 70 115 98 20 3 124 214 197 242 225 147 130 174 157 
18 387 431 414 88 71 116 99 21 4 48 215 198 243 226 148 131 175 158 
18 388 417 415 89 72 117 100 22 5 49 200 199 244 227 149 132 176 159 
18 389 372 416 90 7...

result:

ok good!

Test #25:

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

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 412 86 69 114 97 19 2 46 213 196 241 224 146 129 173 156 
16 413 87 70 115 98 20 3 124 214 197 242 225 147 130 174 157 
16 414 88 71 116 99 21 4 48 215 198 243 226 148 131 175 158 
16 415 89 72 117 100 22 5 49 200 199 244 227 149 132 176 159 
33 328 315 364 351 276 263 250 299 286 458 445 478 ...

result:

ok good!

Test #26:

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

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 412 86 69 114 97 19 2 46 213 196 241 224 146 129 173 156 
16 413 87 70 115 98 20 3 124 214 197 242 225 147 130 174 157 
16 414 88 71 116 99 21 4 48 215 198 243 226 148 131 175 158 
16 415 89 72 117 100 22 5 49 200 199 244 227 149 132 176 159 
16 416 90 73 118 101 23 6 50 33 216 245 228 150 133...

result:

ok good!

Test #27:

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

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 412 86 69 114 97 19 2 46 213 196 241 224 146 129 173 156 
16 413 87 70 115 98 20 3 124 214 197 242 225 147 130 174 157 
16 414 88 71 116 99 21 4 48 215 198 243 226 148 131 175 158 
16 415 89 72 117 100 22 5 49 200 199 244 227 149 132 176 159 
33 328 315 364 351 276 263 250 299 286 458 445 478 ...

result:

ok good!

Subtask #2:

score: 7
Accepted

Test #28:

score: 7
Accepted
time: 1ms
memory: 4044kb

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: 0ms
memory: 5412kb

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: 0ms
memory: 12360kb

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: 8ms
memory: 46180kb

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: 3972kb

input:

2
2 1
1
1

output:

3
1 2 
1 1 
1 1 

result:

ok good!

Test #33:

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

input:

2
1 2
1
2

output:

-1

result:

ok no solution

Test #34:

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

input:

3
1 2 3
1
2

output:

3
2 3 1 
2 3 2 
2 3 2 

result:

ok good!

Test #35:

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

input:

3
3 2 1
1
3

output:

-1

result:

ok no solution

Test #36:

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

input:

3
2 2 2
1
2

output:

3
2 2 3 
2 1 3 
2 1 2 

result:

ok good!

Test #37:

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

input:

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

output:

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

result:

ok good!

Test #38:

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

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: 19ms
memory: 87396kb

input:

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

output:

3750
4 5 2 9 4 
4 5 2 9 4 
4 5 2 9 4 
4 5 2 9 4 
4 5 2 9 4 
4 5 2 9 4 
4 5 2 9 4 
4 5 2 9 4 
4 5 2 9 4 
4 5 2 9 4 
4 5 2 9 4 
4 5 2 9 4 
4 5 2 9 4 
4 5 2 9 4 
4 5 2 9 4 
4 5 2 9 4 
4 5 2 9 4 
4 5 2 9 4 
4 5 2 9 4 
4 5 2 9 4 
4 5 2 9 4 
4 5 2 9 4 
4 5 2 9 4 
4 5 2 9 4 
4 5 2 9 4 
4 5 2 9 4 
4 5 2 9 4...

result:

ok good!

Test #40:

score: 0
Accepted
time: 31ms
memory: 192276kb

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 417 273 132 
3 417 273 142 
3 417 273 456 
3 417 273 144 
3 417 273 459 
3 417 273 157 
3 417 273 19 
3 417 273 195 
3 417 397 409 
3 417 397 84 
3 417 397 83 
3 417 397 277 
3 417 397 281 
3 417 397 68 
3 417 397 295 
3 417 397 304 
3 417 397 359 
3 176 397 486 
3 176 397 358 
3 176 397 22 
...

result:

ok good!

Test #41:

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

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 284 77 297 336 7 435 195 447 196 265 335 197 449 233 144 223 484 433 303 391 398 442 116 404 226 493 127 267 126 49 298 128 457 424 124 444 492 181 421 119 88 256 94 107 385 488 379 38 50 337 43 11 167 229 1 135 160 472 201 132 393 54 394 280 495 420 340 428 59 91 79 429 16 123 40 
75 284 77 ...

result:

ok good!

Test #42:

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

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 242 196 197 200 213 223 226 234 241 187 246 248 253 272 273 280 283 289 137 77 91 92 98 108 128 129 131 290 139 144 146 147 159 170 178 180 452 418 420 421 425 426 439 446 450 400 455 460 466 479 480 485 491 500 339 292 302 306 314 321 325 329 330 2 342 353 359 363 383 388 396 69 50 24 35 10 ...

result:

ok good!

Test #43:

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

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 92 91 90 89 88 87 86 85 84 83 82 81 80 79 78 93 76 75 74 73 72 71 70 69 68 67 66 65 64 63 108 122 121 120 119 118 117 116 115 114 113 112 111 110 109 62 107 106 105 104 103 102 101 100 99 98 97 96 95 94 16 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 32 15 14 13 12 11 10 9 8 7 6 5 4 3 2 47 6...

result:

ok good!

Test #44:

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

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 343 342 340 339 337 336 334 333 331 330 344 327 325 324 322 321 319 318 316 315 313 359 373 372 370 369 367 366 364 363 361 360 358 357 355 354 352 351 349 348 346 345 280 279 277 276 274 273 271 270 268 267 281 264 262 261 259 258 256 255 253 252 296 311 309 308 306 305 303 302 300 299 297 37...

result:

ok good!

Subtask #3:

score: 12
Accepted

Test #45:

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

input:

2
7 8
2
1 2

output:

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

result:

ok good!

Test #46:

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

input:

3
5 4 6
2
2 3

output:

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

result:

ok good!

Test #47:

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

input:

3
4 2 9
3
1 2 3

output:

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

result:

ok good!

Test #48:

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

input:

4
3 5 4 3
2
3 4

output:

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

result:

ok good!

Test #49:

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

input:

4
1 4 5 5
3
1 3 4

output:

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

result:

ok good!

Test #50:

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

input:

4
3 3 6 3
3
2 3 4

output:

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

result:

ok good!

Test #51:

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

input:

5
4 3 3 3 1
3
2 4 5

output:

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

result:

ok good!

Test #52:

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

input:

5
4 3 3 3 2
3
3 4 5

output:

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

result:

ok good!

Test #53:

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

input:

5
4 4 4 2 1
3
2 4 5

output:

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

result:

ok good!

Test #54:

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

input:

5
3 3 3 3 3
3
1 2 4

output:

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

result:

ok good!

Test #55:

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

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: 4016kb

input:

6
3 3 3 2 2 2
3
2 5 6

output:

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

result:

ok good!

Test #57:

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

input:

6
4 4 3 2 1 1
3
1 3 5

output:

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

result:

ok good!

Test #58:

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

input:

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

output:

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

result:

ok good!

Test #59:

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

input:

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

output:

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

result:

ok good!

Test #60:

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

input:

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

output:

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

result:

ok good!

Test #61:

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

input:

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

output:

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

result:

ok good!

Test #62:

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

input:

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

output:

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

result:

ok good!

Test #63:

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

input:

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

output:

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

result:

ok good!

Test #64:

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

input:

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

output:

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

result:

ok good!

Test #65:

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

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

result:

ok good!

Test #66:

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

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
7 1 4 6 8 10 12 14 
8 1 2 3 5 7 9 11 13 

result:

ok good!

Test #67:

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

input:

4
2 2 2 1
2
1 4

output:

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

result:

ok good!

Subtask #4:

score: 45
Accepted

Dependency #1:

100%
Accepted

Dependency #3:

100%
Accepted

Test #68:

score: 45
Accepted
time: 4ms
memory: 9540kb

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 2 4 7 10 14 23 20 33 26 44 63 61 56 100 111 91 145 130 
18 1 4 7 10 13 23 18 33 26 45 43 74 56 99 111 84 144 129 
18 1 4 7 10 13 22 18 33 26 45 43 74 56 99 76 84 143 128 
18 1 4 6 9 13 22 18 33 26 45 43 73 55 98 76 85 142 127 
18 1 3 6 9 13 22 18 34 27 46 38 73 55 98 110 85 141 126 
18 1 3 6 9...

result:

ok good!

Test #69:

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

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 146 
9 2 3 1 5 6 8 15 10 147 
9 2 3 1 4 6 7 16 12 148 
9 2 3 1 4 5 7 11 13 149 
9 2 3 1 4 5 6 8 14 9 
78 2 3 1 4 5 6 7 8 11 16 15 14 13 12 10 9 18 26 25 24 23 22 21 20 19 17 44 42 40 38 35 33 31 29 27 69 50 46 49 53 56 51 111 109 106 104 100 115 118 120 123 125 98 72 75 77 80 82 86 97 94 92 89 ...

result:

ok good!

Test #70:

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

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 158 
1 1 
33 1 2 3 4 5 7 8 9 17 16 14 11 10 32 30 27 26 21 19 50 55 60 36 41 65 78 87 81 187 180 173 166 159 
33 1 2 3 4 5 6 8 9 13 16 14 12 10 33 30 28 26 22 19 49 54 59 35 40 45 93 88 82 172 181 174 167 160 
33 1 2 3 4 5 6 7 9 13 16 15 12 10 33 31 28 25 22 20 48 53 58 34 39 44 61 89 83 126 182...

result:

ok good!

Test #71:

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

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 3 6 14 8 56 59 51 83 74 258 267 276 153 162 127 169 145 198 207 172 181 190 
23 1 3 6 15 9 108 60 52 84 75 76 266 275 152 161 126 135 144 197 206 171 213 189 
23 1 3 5 17 12 109 61 53 66 77 68 265 274 151 160 136 134 143 196 205 170 179 188 
23 1 2 5 16 10 110 62 54 67 78 69 264 273 150 159 168...

result:

ok good!

Test #72:

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

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 3 5 7 183 189 195 
6 2 4 6 1 188 194 
63 2 3 4 5 6 7 1 15 17 16 14 13 11 12 10 9 8 32 35 37 39 41 33 18 20 22 25 27 28 88 71 74 237 283 287 280 295 299 261 265 269 273 277 156 160 164 168 172 145 138 142 146 150 154 199 203 196 211 215 178 182 187 193 
63 2 3 4 5 6 7 1 15 17 16 14 13 11 12 10 9 ...

result:

ok good!

Test #73:

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

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 1 199 
2 2 198 
53 2 1 10 11 9 8 7 6 5 4 3 27 24 22 20 17 15 14 12 290 309 313 317 141 145 149 153 157 161 165 169 113 117 121 170 129 133 137 201 205 209 213 217 221 225 229 173 177 181 230 189 193 197 
53 2 1 10 11 9 8 7 6 5 4 3 25 26 23 21 18 16 19 13 304 308 312 316 155 144 148 152 156 160 1...

result:

ok good!

Test #74:

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

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 2 
1 2 
1 2 
1 2 
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 
14 1 2 4 5 7 10 13 17 23 26 38 39 48 70 
14 1 2 4 5 7 10 13 16 23 26 38 39 48 69 
14 1 2 4 5 7 10 13 16 23 26 38 35 48 68 
14 1 2 4 5 7 9 13 16 23 26 31 35 49 67 
14 1 2 4 5 7 9 12 16 23 ...

result:

ok good!

Test #75:

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

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 1 4 5 7 9 11 13 15 17 20 23 26 30 36 40 52 
16 1 4 5 7 8 10 13 15 17 20 23 26 30 36 40 51 
16 2 4 5 6 8 10 13 15 17 20 23 26 29 36 40 50 
16 2 4 5 6 8 10 12 15 17 19 23 26 29 37 39 49 
17 2 1 3 5 6 8 10 12 15 17 19 22 26 29 37 39 48 
17 2 1 3 5 6 8 10 12 14 17 19 22 25 29 37 39 47 
17 2 1 3 5 ...

result:

ok good!

Test #76:

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

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 2 
1 2 
1 2 
1 2 
1 2 
1 2 
1 2 
1 2 
1 2 
1 2 
1 2 
1 2 
1 2 
1 2 
1 2 
1 2 
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 
12 1 2 4 5 6 8 10 12 15 19 24 40 
12 1 2 4 5 6 8 9 12 15 19 24 39 
12 1 2 4 5 6 8 9 11 ...

result:

ok good!

Test #77:

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

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
4 1 16 40 94 
4 1 16 40 93 
4 1 16 46 92 
4 1 16 46 91 
4 1 17 45 90 
4 1 17 45 89 
4 1 17 44 88 
4 1 17 44 87 
4 1 18 43 86 
4 1 18 43 85 
4 1 18 42 84 
4 1 18 42 83 
4 1 19 41 82 
4 1 19 41 81 
4 1 19 39 80 
4 1 19 39 95 
8 1 3 5 15 8 20 38 78 
8 1 3 5 15 8 20 38 77 
8 1 3 5 15 8 20 37 76 
8 1 ...

result:

ok good!

Test #78:

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

input:

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

output:

115
2 9 7 
2 9 7 
2 9 7 
2 9 7 
2 9 7 
2 9 7 
2 9 7 
2 9 7 
2 9 2 
2 9 2 
2 9 2 
2 9 2 
2 9 2 
2 9 2 
2 9 2 
2 9 2 
2 9 2 
2 9 2 
2 9 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 
2 8 2 
2 8 2 
2 8 2 
2 8 10 
2 8 10 
2 8 10 
2 8 10 
2 8 10 
2 8 10 
2 8 10 
2 8 10 
2 8 10 
2 8 10 
2 8 10...

result:

ok good!

Test #79:

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

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
13 1 20 40 35 28 12 7 21 25 24 15 33 9 
13 1 20 3 35 28 12 7 21 25 24 15 33 11 
13 1 20 3 40 28 12 7 21 27 24 15 33 11 
13 1 20 3 40 28 12 7 21 27 26 36 33 31 
13 1 20 3 40 28 12 2 16 27 26 36 33 31 
13 1 20 3 40 35 12 2 16 8 26 36 33 31 
13 1 20 3 40 35 12 2 16 8 26 36 5 19 
13 1 20 3 40 35 12 2...

result:

ok good!

Test #80:

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

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
14 37 5 4 30 36 6 33 34 10 27 28 29 9 39 
21 37 15 38 17 3 12 16 32 5 4 24 36 6 33 34 10 27 28 29 9 20 
21 37 23 38 17 3 12 16 32 5 4 24 36 6 33 34 10 27 28 29 9 1 
21 37 23 15 17 3 12 16 32 2 4 24 36 14 33 34 10 27 28 29 9 1 
21 37 23 15 17 3 12 16 32 2 4 24 36 14 33 34 10 27 28 26 18 13 
21 37 ...

result:

ok good!

Test #81:

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

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
55 85 31 119 123 118 117 72 45 83 16 70 69 11 67 110 3 129 94 5 64 120 108 38 104 46 65 28 122 92 6 71 1 51 49 4 101 22 24 25 63 78 20 109 86 81 62 54 111 21 128 10 42 12 55 89 
55 85 31 119 123 118 117 72 45 83 16 70 69 11 67 110 3 129 94 5 64 59 108 38 114 46 65 60 122 92 87 71 1 51 49 4 101 22 ...

result:

ok good!

Test #82:

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

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
66 64 39 84 86 32 79 28 97 77 48 21 115 3 59 53 13 82 41 65 91 45 78 23 54 19 106 52 58 73 63 1 130 129 102 103 123 119 122 2 120 105 99 95 87 26 22 38 7 9 14 12 34 109 61 121 8 66 126 127 111 44 88 55 47 33 96 
66 64 39 84 86 32 79 28 97 77 48 21 115 3 59 53 13 68 41 37 91 6 78 100 54 74 106 113 ...

result:

ok good!

Test #83:

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

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
16 104 56 35 44 93 96 25 7 81 19 8 43 123 26 88 38 
16 105 56 113 74 90 101 13 7 81 19 8 43 123 26 126 109 
16 105 56 113 74 90 101 13 84 58 108 8 64 106 14 126 46 
16 105 124 113 74 90 101 13 84 58 108 8 64 106 14 91 49 
16 105 124 113 74 90 101 13 84 58 108 6 64 106 14 91 55 
16 105 124 113 74 ...

result:

ok good!

Test #84:

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

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
45 23 25 27 29 31 2 35 37 39 41 42 43 10 22 1 4 5 6 7 8 9 12 13 14 15 16 17 19 20 21 47 48 45 44 56 57 55 53 51 70 68 66 63 61 59 
45 33 24 26 28 30 32 34 36 38 40 42 43 10 22 1 3 5 6 7 8 9 11 13 14 15 16 17 18 20 21 47 49 45 44 56 58 55 53 51 50 68 66 64 61 59 
54 33 23 24 25 26 27 28 29 30 31 32...

result:

ok good!

Test #85:

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

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
53 27 19 20 21 22 23 24 25 26 2 28 29 30 31 32 33 1 17 3 4 5 6 7 8 9 11 12 13 14 15 16 18 10 46 50 47 49 66 64 61 58 59 55 53 80 83 86 88 77 74 72 68 90 
63 27 19 20 21 22 23 24 25 26 2 28 29 30 31 32 33 1 17 3 4 5 6 7 8 9 11 12 13 14 15 16 18 10 37 36 35 34 39 40 41 42 43 52 46 50 47 45 63 64 61 ...

result:

ok good!

Test #86:

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

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
36 1 27 26 25 24 22 21 20 19 18 16 14 3 4 5 7 8 9 10 11 13 15 28 30 31 37 34 35 40 43 54 47 80 90 84 120 
36 2 27 26 25 24 23 21 20 19 18 17 14 3 4 5 6 8 9 10 11 12 15 28 29 31 37 34 35 39 42 55 48 79 90 86 119 
36 2 1 26 25 24 23 22 20 19 18 17 16 3 4 5 6 7 9 10 11 12 13 28 29 31 33 36 32 39 42 5...

result:

ok good!

Test #87:

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

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
13 184 179 174 185 190 195 155 144 149 154 159 164 169 
118 45 53 52 51 50 49 48 47 46 54 44 43 42 41 40 39 38 37 62 1 69 68 67 66 65 64 63 2 61 60 59 58 57 56 55 10 18 17 16 15 14 13 12 11 35 9 8 7 6 5 4 3 36 20 34 33 32 31 30 29 28 26 25 24 23 22 21 19 27 87 88 89 91 92 80 70 71 72 75 77 78 74 1...

result:

ok good!

Test #88:

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

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

result:

ok good!

Test #89:

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

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
33 29 31 33 35 37 39 41 43 45 46 23 24 4 5 7 8 10 11 14 22 20 19 17 16 13 60 51 55 50 47 160 165 170 
37 36 25 26 27 28 30 32 34 2 38 40 42 44 46 1 24 3 5 6 8 9 11 12 22 21 19 18 16 15 61 58 56 52 48 159 164 169 
45 36 25 26 27 28 29 30 31 32 33 34 35 2 37 38 39 40 41 42 43 44 45 1 23 3 4 6 7 9 10...

result:

ok good!

Test #90:

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

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
24 28 30 32 34 36 38 40 42 45 47 49 1 26 4 6 8 11 13 14 23 21 19 17 74 
24 27 30 32 34 36 38 40 42 44 47 49 1 26 4 6 8 10 13 14 23 21 19 17 73 
24 27 29 32 34 36 38 40 42 44 46 49 1 26 4 6 8 10 12 14 23 21 19 17 72 
24 27 29 31 34 36 38 40 42 44 46 48 1 26 4 6 8 10 12 15 23 21 19 17 71 
24 27 29 ...

result:

ok good!

Test #91:

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

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 1 249 416 361 83 15 181 196 141 
9 1 250 417 362 70 85 30 197 142 
9 1 251 418 349 364 86 31 198 143 
9 1 238 405 420 365 87 32 199 144 
9 1 308 253 421 366 88 33 200 145 
9 1 309 254 422 367 89 34 201 146 
9 1 310 255 423 368 90 35 202 147 
9 1 311 256 424 369 91 36 203 148 
9 1 312 257 425 37...

result:

ok good!

Test #92:

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

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 1 323 295 322 321 320 319 318 317 316 315 314 313 312 311 310 309 308 307 306 305 304 303 302 301 300 299 298 297 296 352 338 353 351 350 349 3...

result:

ok good!

Test #93:

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

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
6 3 4 6 8 11 16 
6 3 4 6 8 10 15 
6 3 4 6 8 10 15 
6 3 4 6 8 10 14 
7 1 3 4 6 8 10 14 
7 1 2 4 6 7 10 14 
7 1 2 4 5 7 10 13 
7 1 2 4 5 7 10 13 
7 1 2 4 5 7 9 13 
7 1 2 4 5 7 9 13 
7 1 2 4 5 7 9 12 
7 1 2 3 5 7 9 12 
7 1 2 3 5 7 9 12 
7 1 2 3 5 7 9 12 
7 1 2 3 5 7 9 12 
7 1 2 3 5 6 9 11 
7 1 2 3 5...

result:

ok good!

Test #94:

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

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 79 
2 88 33 
16 88 33 92 8 68 13 96 20 98 28 72 86 75 6 99 26 
32 88 33 92 8 68 22 3 83 39 27 82 93 54 46 95 59 32 60 35 29 12 13 96 20 98 28 71 86 64 52 18 45 
32 88 33 92 8 68 2 3 83 39 27 82 93 54 46 95 4 32 48 35 29 12 13 97 20 94 19 71 41 64 52 73 34 
32 88 33 92 8 68 2 22 83 39 27 78 93 5...

result:

ok good!

Test #95:

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

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 127 
2 308 206 
16 308 206 247 103 152 195 189 182 113 120 126 107 148 140 135 129 
32 308 206 247 103 327 344 332 298 233 12 8 35 43 39 33 27 170 166 162 158 153 196 190 183 175 122 114 109 137 141 136 130 
64 308 206 247 103 327 344 332 298 233 143 32 147 261 322 320 250 253 254 259 321 117 10...

result:

ok good!

Subtask #5:

score: 15
Accepted

Dependency #4:

100%
Accepted

Test #96:

score: 15
Accepted
time: 3ms
memory: 25992kb

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
13 11 13 19 23 15 9 21 18 20 8 5 7 6 
13 11 13 19 23 15 9 21 18 20 8 5 7 4 
13 11 13 19 23 15 9 21 18 20 8 5 7 4 
13 11 13 19 23 15 9 21 18 20 8 5 7 4 
13 11 13 19 23 15 9 21 18 20 8 5 7 4 
13 11 16 19 23 15 9 21 18 20 8 5 7 4 
13 11 16 19 23 15 9 21 18 20 8 5 7 4 
13 11 16 19 23 15 9 21 18 20 8...

result:

ok good!

Test #97:

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

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
80 122 41 10 55 101 34 110 1 60 4 32 83 52 42 151 26 17 46 11 95 67 134 85 100 102 150 63 140 22 88 20 37 158 39 51 35 112 15 149 75 29 49 127 82 92 115 119 6 14 99 142 147 72 61 104 77 47 132 126 28 8 120 143 141 81 114 96 91 66 50 71 27 98 136 97 123 144 84 155 73 
80 122 41 10 55 101 34 110 1 ...

result:

ok good!

Test #98:

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

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
133 501 469 140 143 147 480 152 484 353 157 492 158 463 159 348 511 166 521 169 528 51 332 330 391 419 416 414 424 111 112 429 397 396 395 233 91 390 89 453 385 457 380 133 462 138 211 560 562 568 569 571 575 294 290 283 327 273 16 214 267 587 262 259 255 43 194 178 192 189 188 551 326 322 323 264...

result:

ok good!

Test #99:

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

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

result:

ok good!

Test #100:

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

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
109 83 85 87 89 91 93 95 97 99 102 52 55 57 59 61 63 66 77 74 72 70 68 222 225 228 231 234 218 205 203 209 212 214 216 211 268 264 269 274 278 282 238 242 246 257 253 259 621 637 641 644 591 593 597 601 619 609 613 617 680 684 688 692 696 700 704 664 653 657 661 665 669 673 677 503 507 511 500 519...

result:

ok good!

Test #101:

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

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
114 1 9 7 5 3 148 158 156 154 152 149 161 163 165 167 169 171 174 134 122 124 127 129 131 133 135 137 139 141 143 145 217 206 208 210 212 214 216 218 220 222 224 226 229 190 178 180 182 184 186 188 176 192 194 197 199 201 52 40 42 44 46 48 50 38 55 57 59 61 63 65 11 13 15 17 19 22 119 26 28 30 32...

result:

ok good!

Test #102:

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

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 1 2033 1424 2577 2644 2389 361 95 184 1325 716 924 
12 1 1978 1423 2576 2654 2388 360 94 215 1324 715 923 
12 1 2031 1422 2575 2653 2387 359 93 214 1323 714 922 
12 1 2030 1421 2574 2652 2397 358 92 213 1311 713 921 
12 1 2029 1431 2573 2651 2342 357 91 212 1321 712 920 
12 1 2028 1462 2572 2...

result:

ok good!

Test #103:

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

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: 30656kb

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 1 3 4 5 6 7 8 9 11 12 14 15 17 19 21 23 26 29 37 
19 1 2 4 5 6 7 8 9 11 12 14 15 17 19 21 23 26 29 36 
19 1 2 4 5 6 7 8 9 11 12 14 15 17 19 21 23 26 29 36 
19 1 2 3 5 6 7 8 9 11 12 14 15 17 19 21 23 26 29 35 
19 1 2 3 5 6 7 8 9 11 12 13 15 17 19 21 23 25 29 35 
19 1 2 3 5 6 7 8 9 11 12 13 15 1...

result:

ok good!

Test #105:

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

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 1279 558 
4 1279 558 674 695 
16 1279 558 1483 718 808 1429 554 575 729 708 731 748 646 662 673 691 
32 1279 558 1483 718 808 1429 774 163 214 713 1044 291 1294 920 120 1316 595 607 592 630 640 538 553 572 589 707 696 747 645 661 672 690 
128 1279 558 1483 718 808 1429 774 163 214 713 1...

result:

ok good!

Test #106:

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

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 891 
2 900 892 
4 919 927 901 893 
16 1267 997 1004 986 980 973 874 880 889 864 857 909 918 926 904 894 
32 1267 1336 1335 225 748 754 848 733 727 721 951 947 965 945 939 933 990 995 1002 988 981 974 873 870 888 865 858 920 917 924 905 895 
128 1267 1336 1335 225 853 316 1313 1095 242 2052 835 4...

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: 24ms
memory: 122728kb

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
21 17 4 27 40 16 34 30 5 18 25 38 31 13 39 37 15 24 33 14 32 36 
21 17 4 27 40 16 34 30 5 18 25 38 31 13 39 37 15 24 33 14 32 36 
21 17 4 27 40 16 34 30 5 18 25 38 31 13 39 37 15 24 33 14 32 36 
21 17 4 27 40 16 34 30 5 18 25 38 31 13 39 37 15 24 33 14 32 36 
21 17 4 27 40 16 34 30 5 18 25 38 31...

result:

ok good!

Test #108:

score: 0
Accepted
time: 44ms
memory: 187244kb

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
162 243 170 291 324 296 130 343 131 51 210 305 176 150 355 238 3 347 282 156 325 309 412 217 352 403 295 378 112 275 169 417 337 322 164 215 118 356 203 157 301 123 300 196 175 75 62 262 148 178 108 292 404 395 232 281 89 127 161 95 162 235 381 105 12 61 223 79 195 192 40 342 244 73 81 107 346 31...

result:

ok good!

Test #109:

score: 0
Accepted
time: 31ms
memory: 248420kb

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
1214 2130 2183 2176 3009 2172 340 973 976 2166 2157 3025 330 990 326 3005 322 2126 2123 2116 2106 1018 314 2097 312 3062 3063 1025 2222 2272 2935 2257 381 2250 2243 2241 2946 2234 933 2231 942 307 2217 2966 2216 361 2215 2986 2990 2993 2997 351 2188 347 1936 3122 3123 1975 1110 243 1115 1117 1962 ...

result:

ok good!

Test #110:

score: 0
Accepted
time: 44ms
memory: 201780kb

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
19 71 73 75 77 80 82 85 88 91 95 99 103 107 112 118 126 135 149 674 
19 71 73 75 77 80 82 85 88 91 95 99 103 107 112 118 126 135 148 674 
19 71 73 75 77 80 82 85 88 91 95 98 103 107 112 118 125 135 148 674 
19 71 73 75 77 80 82 85 88 91 95 98 103 107 112 118 125 134 148 674 
60 34 36 37 39 41 42...

result:

ok good!

Test #111:

score: 0
Accepted
time: 47ms
memory: 267228kb

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 410 408 363 361 359 357 355 364 351 349 347 345 513 384 382 380 378 376 512 372 370 368 366 481 490 488 486 484 482 480 478 476 474 472 502 511 509 507 505 503 501 499 497 495 493 448 446 444 442 440 469 436 434 432 430 450 468 466 464 462 460 457 455 453 451 3901 3907 3913 3919 3791 3797 3803...

result:

ok good!

Test #112:

score: 0
Accepted
time: 43ms
memory: 231692kb

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
499 659 661 663 665 667 669 671 657 675 677 679 681 683 686 688 627 629 631 633 635 637 639 641 643 645 647 650 652 654 656 721 723 725 727 729 731 733 735 737 740 742 744 746 748 750 705 691 693 695 697 699 701 704 706 708 710 712 714 716 718 548 534 536 538 540 543 545 547 549 551 553 555 557 5...

result:

ok good!

Test #113:

score: 0
Accepted
time: 55ms
memory: 298028kb

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 1 10231 7725 7926 12424 10937 12008 1925 2996 1510 6008 6209 3851 4652 
14 1 10081 7724 7925 12423 10936 12007 1924 2995 1509 6007 6208 3836 4651 
14 1 10080 7723 7924 12422 10935 12006 1923 3008 1508 6006 6207 3849 4650 
14 1 10079 7722 7923 12461 10934 12005 1922 3047 1507 6005 6206 3848 4...

result:

ok good!

Test #114:

score: 0
Accepted
time: 55ms
memory: 301144kb

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: 36ms
memory: 161184kb

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 1 3 4 5 6 7 8 9 10 11 12 13 15 16 17 18 20 21 22 23 25 26 28 29 31 32 34 35 37 39 41 43 45 47 49 51 54 57 60 63 68 73 85 
43 1 2 4 5 6 7 8 9 10 11 12 13 15 16 17 18 19 21 22 23 25 26 28 29 31 32 34 35 37 39 41 43 45 47 49 51 54 57 60 63 67 73 84 
43 1 2 4 5 6 7 8 9 10 11 12 13 15 16 17 18 19 ...

result:

ok good!

Test #116:

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

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 2292 
2 2438 1224 
4 2438 1224 3664 3637 
16 2438 1224 2222 994 988 1007 980 561 3510 3690 484 3732 3710 3612 2279 3638 
128 2438 1224 2178 1092 1898 1289 1585 2449 2445 2537 1055 1345 1348 1004 1745 1977 2759 2770 2000 1362 1363 823 2033 2822 2322 1730 1799 1102 1328 1248 1480 1442 858 855 174...

result:

ok good!

Test #117:

score: 0
Accepted
time: 47ms
memory: 286776kb

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 4196 
2 4185 4195 
4 9052 1427 4184 4194 
16 9052 1326 10604 7060 554 478 9653 9592 10648 726 2700 10348 4683 1489 3901 4193 
128 9052 1326 10604 7060 554 478 9653 9592 10648 726 2700 10348 4683 1489 1427 3901 5801 5342 2094 9332 1520 9609 5111 3416 4348 1834 9074 1641 5913 4508 6095 10436 7693 ...

result:

ok good!

Extra Test:

score: 0
Extra Test Passed