QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#112683#6339. CookiesFlamire100 ✓123ms200316kbC++171.5kb2023-06-12 21:32:482023-06-12 21:32:49

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-06-12 21:32:49]
  • 评测
  • 测评结果:100
  • 用时:123ms
  • 内存:200316kb
  • [2023-06-12 21:32:48]
  • 提交

answer

#include <bits/stdc++.h>
#define pii pair<int,int>
#define s1 first
#define s2 second
using namespace std;
int n,a[100011],tot,m,b[100011],sum[15011],buc[15011],nxt[15011];
vector<bitset<15011> > dp[15011];
bitset<15011> I;vector<int> v,tmp;
priority_queue<pii > pq;
int main()
{
	scanf("%d",&n);for(int i=1;i<=n;++i)scanf("%d",a+i),++buc[a[i]],tot+=a[i];
	scanf("%d",&m);for(int i=1;i<=m;++i)scanf("%d",b+i);
	int cnt=n;
	for(int i=1;i<=15000;++i)
	{
		sum[i]=sum[i-1]+cnt;
		cnt-=buc[i];
	}
	for(int i=0;i<15011;++i)I[i]=1;
	dp[0].resize(m+1);dp[0][m][0]=1;
	for(int i=1;i<=tot+1;++i)
	{
		for(int j=int(dp[i-1].size())-2;j>0;--j)dp[i-1][j]|=dp[i-1][j+1];
		if(!dp[i-1].size())break;
		while(!dp[i-1].empty()&&!dp[i-1].back().any())dp[i-1].pop_back();
		dp[i-1].shrink_to_fit();
		if(dp[i-1].size()>1&&dp[i-1][1][tot])break;
		if(i<=tot)
		{
			dp[i].resize(dp[i-1].size());
			for(int j=1;j<dp[i-1].size();++j)dp[i][j]=(dp[i-1][j]<<b[j])&(I>>15011-sum[i]-1);
		}
	}
	int I=-1,J=1,K=tot;
	for(int i=1;i<=tot;++i)
	{
		if(J<dp[i].size()&&dp[i][J][K]){I=i;break;}
	}
	if(!~I){printf("-1\n");return 0;}
	printf("%d\n",I);
	while(I!=0)
	{
		while(J<dp[I].size()-1&&dp[I][J+1][K])++J;
		v.push_back(b[J]);--I;K-=b[J];
	}
	for(int i=1;i<=n;++i)pq.push(pii(a[i],i));
	sort(v.begin(),v.end());
	for(int i=0;i<v.size();++i)
	{
		printf("%d ",v[i]);
		tmp.clear();
		for(int _=0;_<v[i];++_)tmp.push_back(pq.top().s2),pq.pop();
		for(int x:tmp)--a[x],printf("%d ",x);putchar(10);
		for(int x:tmp)pq.push(pii(a[x],x));
	}return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 6
Accepted

Test #1:

score: 6
Accepted
time: 2ms
memory: 4080kb

input:

1
1
1
1

output:

1
1 1 

result:

ok good!

Test #2:

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

input:

2
1 1
1
1

output:

2
1 2 
1 1 

result:

ok good!

Test #3:

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

input:

2
1 1
1
2

output:

1
2 2 1 

result:

ok good!

Test #4:

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

input:

2
1 1
2
1 2

output:

1
2 2 1 

result:

ok good!

Test #5:

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

input:

4
1 1 1 1
2
2 3

output:

2
2 4 3 
2 2 1 

result:

ok good!

Test #6:

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

input:

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

output:

2
4 8 7 6 5 
4 4 3 2 1 

result:

ok good!

Test #7:

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

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 500 
1 499 
1 498 
1 497 
1 496 
1 495 
1 494 
1 493 
1 492 
1 491 
1 490 
1 489 
1 488 
1 487 
1 486 
1 485 
1 484 
1 483 
1 482 
1 481 
1 480 
1 479 
1 478 
1 477 
1 476 
1 475 
1 474 
1 473 
1 472 
1 471 
1 470 
1 469 
1 468 
1 467 
1 466 
1 465 
1 464 
1 463 
1 462 
1 461 
1 460 
1 459 
1 ...

result:

ok good!

Test #8:

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

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 500 499 498 497 496 495 494 493 492 491 490 489 488 487 486 485 484 483 482 481 480 479 478 477 476 475 474 473 472 471 470 469 468 467 466 465 464 463 462 461 460 459 458 457 456 455 454 453 452 451 450 449 448 447 446 445 444 443 442 441 440 439 438 437 436 435 434 433 432 431 430 429 428 42...

result:

ok good!

Test #9:

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

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 500 499 498 497 496 495 494 493 492 491 490 489 488 487 486 485 484 483 482 481 480 479 478 477 476 475 474 473 472 471 470 469 468 467 466 465 464 463 462 461 460 459 458 457 456 455 454 453 452 451 450 449 448 447 446 445 444 443 442 441 440 439 438 437 436 435 434 433 432 431 430 429 428 42...

result:

ok good!

Test #10:

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

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

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 500 499 498 497 496 495 494 493 492 491 490 489 488 487 486 485 484 483 482 481 480 479 478 477 476 475 474 473 472 471 470 469 468 467 466 465 464 463 462 461 460 459 458 457 456 
45 455 454 453 452 451 450 449 448 447 446 445 444 443 442 441 440 439 438 437 436 435 434 433 432 431 430 429 42...

result:

ok good!

Test #12:

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

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 500 499 
2 498 497 
2 496 495 
2 494 493 
2 492 491 
2 490 489 
2 488 487 
2 486 485 
2 484 483 
2 482 481 
2 480 479 
2 478 477 
2 476 475 
2 474 473 
2 472 471 
2 470 469 
2 468 467 
2 466 465 
2 464 463 
2 462 461 
2 460 459 
2 458 457 
2 456 455 
2 454 453 
2 452 451 
2 450 449 
2 448 447 ...

result:

ok good!

Test #13:

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

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 484 483 482 481 480 479 478 477 476 475 474 473 472 471 470 469 468 467 466 465 464 463 
22 462 461 460 459 458 457 456 455 454 453 452 451 450 449 448 447 446 445 444 443 442 441 
22 440 439 438 437 436 435 434 433 432 431 430 429 428 427 426 425 424 423 422 421 420 419 
22 418 417 416 415 41...

result:

ok good!

Test #14:

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

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 495 494 493 492 491 490 489 488 487 
9 486 485 484 483 482 481 480 479 478 
9 477 476 475 474 473 472 471 470 469 
9 468 467 466 465 464 463 462 461 460 
9 459 458 457 456 455 454 453 452 451 
9 450 449 448 447 446 445 444 443 442 
9 441 440 439 438 437 436 435 434 433 
9 432 431 430 429 428 42...

result:

ok good!

Test #15:

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

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 500 499 498 497 496 495 494 493 492 491 490 489 488 487 486 485 484 483 482 481 480 479 478 477 476 475 474 473 472 471 470 469 468 467 466 465 464 463 462 461 460 459 458 457 456 455 454 453 452 451 450 449 448 447 446 445 444 443 442 441 440 439 438 437 436 435 434 433 432 431 430 429 428 42...

result:

ok good!

Test #16:

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

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 499 498 497 496 495 494 493 492 491 490 489 488 487 486 485 484 483 
17 482 481 480 479 478 477 476 475 474 473 472 471 470 469 468 467 466 
17 465 464 463 462 461 460 459 458 457 456 455 454 453 452 451 450 449 
17 448 447 446 445 444 443 442 441 440 439 438 437 436 435 434 433 432 
17 431 43...

result:

ok good!

Test #17:

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

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 499 498 497 496 495 494 493 492 491 490 489 488 487 486 485 484 483 
23 482 481 480 479 478 477 476 475 474 473 472 471 470 469 468 467 466 465 464 463 462 461 460 
27 459 458 457 456 455 454 453 452 451 450 449 448 447 446 445 444 443 442 441 440 439 438 437 436 435 434 433 
27 432 431 430 42...

result:

ok good!

Test #18:

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

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 499 498 497 496 495 494 493 492 491 490 489 488 487 486 485 484 483 482 481 480 479 478 477 476 475 474 473 472 471 470 469 468 467 466 465 464 463 462 461 460 459 458 457 456 455 454 453 452 451 450 449 448 447 446 445 444 443 442 441 440 439 438 437 436 
64 435 434 433 432 431 430 429 428 427...

result:

ok good!

Test #19:

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

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 499 498 497 496 495 494 493 492 491 490 489 488 487 486 485 484 483 482 481 480 479 478 477 476 475 474 473 472 471 470 469 468 467 466 465 464 463 462 461 460 459 458 457 456 455 454 453 452 451 450 449 448 447 446 445 444 
56 443 442 441 440 439 438 437 436 435 434 433 432 431 430 429 428 427...

result:

ok good!

Test #20:

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

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 499 498 497 496 495 494 493 492 491 490 489 488 487 486 485 484 483 482 481 480 479 478 477 476 475 474 473 472 471 470 469 468 467 466 465 464 463 462 461 460 459 458 457 456 455 454 453 452 451 450 449 448 447 446 445 444 443 442 441 440 439 438 437 436 435 434 433 432 431 430 429 428 427 42...

result:

ok good!

Test #21:

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

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

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

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 493 492 491 490 489 488 487 486 485 484 483 482 481 480 479 478 477 476 
18 475 474 473 472 471 470 469 468 467 466 465 464 463 462 461 460 459 458 
18 457 456 455 454 453 452 451 450 449 448 447 446 445 444 443 442 441 440 
18 439 438 437 436 435 434 433 432 431 430 429 428 427 426 425 424 42...

result:

ok good!

Test #24:

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

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 493 492 491 490 489 488 487 486 485 484 483 482 481 480 479 478 477 476 
18 475 474 473 472 471 470 469 468 467 466 465 464 463 462 461 460 459 458 
18 457 456 455 454 453 452 451 450 449 448 447 446 445 444 443 442 441 440 
18 439 438 437 436 435 434 433 432 431 430 429 428 427 426 425 424 42...

result:

ok good!

Test #25:

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

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 493 492 491 490 489 488 487 486 485 484 483 482 481 480 479 478 
16 477 476 475 474 473 472 471 470 469 468 467 466 465 464 463 462 
16 461 460 459 458 457 456 455 454 453 452 451 450 449 448 447 446 
16 445 444 443 442 441 440 439 438 437 436 435 434 433 432 431 430 
33 429 428 427 426 425 42...

result:

ok good!

Test #26:

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

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 493 492 491 490 489 488 487 486 485 484 483 482 481 480 479 478 
16 477 476 475 474 473 472 471 470 469 468 467 466 465 464 463 462 
16 461 460 459 458 457 456 455 454 453 452 451 450 449 448 447 446 
16 445 444 443 442 441 440 439 438 437 436 435 434 433 432 431 430 
16 429 428 427 426 425 42...

result:

ok good!

Test #27:

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

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 493 492 491 490 489 488 487 486 485 484 483 482 481 480 479 478 
16 477 476 475 474 473 472 471 470 469 468 467 466 465 464 463 462 
16 461 460 459 458 457 456 455 454 453 452 451 450 449 448 447 446 
16 445 444 443 442 441 440 439 438 437 436 435 434 433 432 431 430 
33 429 428 427 426 425 42...

result:

ok good!

Subtask #2:

score: 7
Accepted

Test #28:

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

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: 3ms
memory: 6052kb

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: 10ms
memory: 15176kb

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: 21ms
memory: 59576kb

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: 2ms
memory: 4256kb

input:

2
2 1
1
1

output:

3
1 1 
1 2 
1 1 

result:

ok good!

Test #33:

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

input:

2
1 2
1
2

output:

-1

result:

ok no solution

Test #34:

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

input:

3
1 2 3
1
2

output:

3
2 3 2 
2 3 2 
2 3 1 

result:

ok good!

Test #35:

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

input:

3
3 2 1
1
3

output:

-1

result:

ok no solution

Test #36:

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

input:

3
2 2 2
1
2

output:

3
2 3 2 
2 1 3 
2 2 1 

result:

ok good!

Test #37:

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

input:

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

output:

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

result:

ok good!

Test #38:

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

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

input:

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

output:

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

result:

ok good!

Test #40:

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

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 238 92 383 
3 238 92 383 
3 238 251 92 
3 238 383 251 
3 238 92 383 
3 238 251 92 
3 238 383 251 
3 238 211 92 
3 238 383 251 
3 238 211 92 
3 238 383 251 
3 238 211 92 
3 238 383 251 
3 238 211 102 
3 238 92 383 
3 238 251 211 
3 238 102 92 
3 238 383 251 
3 238 211 102 
3 238 92 383 
3 238 ...

result:

ok good!

Test #41:

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

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 496 284 77 297 336 316 7 470 435 489 195 447 319 264 196 265 47 335 389 200 197 449 434 366 233 401 144 131 223 446 238 484 474 397 433 383 303 67 115 391 398 355 305 236 114 442 368 78 404 163 116 53 443 226 86 497 493 458 364 467 327 127 388 267 465 80 175 126 381 274 209 49 407 298 121 
75...

result:

ok good!

Test #42:

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

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

result:

ok good!

Test #43:

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

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 122 121 120 119 118 117 116 115 114 113 112 111 110 109 108 107 106 105 104 103 102 101 100 99 98 97 96 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80 79 78 77 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...

result:

ok good!

Test #44:

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

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 498 497 496 495 494 493 492 491 490 489 488 487 486 485 484 483 482 481 480 479 478 477 476 475 474 473 472 471 470 469 468 467 466 465 464 463 462 461 460 459 458 457 456 455 454 453 452 451 450 449 448 447 446 445 444 443 442 441 440 439 438 437 436 435 434 433 432 431 430 429 428 427 426 42...

result:

ok good!

Subtask #3:

score: 12
Accepted

Test #45:

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

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

input:

3
5 4 6
2
2 3

output:

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

result:

ok good!

Test #47:

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

input:

3
4 2 9
3
1 2 3

output:

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

result:

ok good!

Test #48:

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

input:

4
3 5 4 3
2
3 4

output:

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

result:

ok good!

Test #49:

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

input:

4
1 4 5 5
3
1 3 4

output:

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

result:

ok good!

Test #50:

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

input:

4
3 3 6 3
3
2 3 4

output:

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

result:

ok good!

Test #51:

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

input:

5
4 3 3 3 1
3
2 4 5

output:

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

result:

ok good!

Test #52:

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

input:

5
4 3 3 3 2
3
3 4 5

output:

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

result:

ok good!

Test #53:

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

input:

5
4 4 4 2 1
3
2 4 5

output:

5
2 3 2 
2 1 3 
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: 4300kb

input:

5
3 3 3 3 3
3
1 2 4

output:

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

result:

ok good!

Test #55:

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

input:

6
3 3 3 2 2 2
3
2 4 6

output:

-1

result:

ok no solution

Test #56:

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

input:

6
3 3 3 2 2 2
3
2 5 6

output:

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

result:

ok good!

Test #57:

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

input:

6
4 4 3 2 1 1
3
1 3 5

output:

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

result:

ok good!

Test #58:

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

input:

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

output:

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

result:

ok good!

Test #59:

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

input:

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

output:

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

result:

ok good!

Test #60:

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

input:

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

output:

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

result:

ok good!

Test #61:

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

input:

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

output:

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

result:

ok good!

Test #62:

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

input:

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

output:

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

result:

ok good!

Test #63:

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

input:

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

output:

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

result:

ok good!

Test #64:

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

input:

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

output:

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

result:

ok good!

Test #65:

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

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

result:

ok good!

Test #66:

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

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

result:

ok good!

Test #67:

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

input:

4
2 2 2 1
2
1 4

output:

4
1 3 
1 2 
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: 4376kb

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 1 2 3 4 9 8 7 6 5 11 10 16 15 14 13 12 23 22 
18 1 2 3 4 9 8 7 6 5 11 10 21 20 19 18 17 16 15 
18 1 2 3 4 9 8 7 6 5 14 13 12 11 10 36 35 34 33 
18 1 2 3 4 9 8 7 6 5 32 31 30 29 28 27 26 25 24 
18 1 2 3 4 23 22 21 20 19 18 17 16 15 14 13 12 11 10 
18 1 2 3 9 8 7 6 5 4 49 48 47 46 45 44 43 42 41...

result:

ok good!

Test #69:

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

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

result:

ok good!

Test #70:

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

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

result:

ok good!

Test #71:

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

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 1 3 2 7 6 5 4 17 16 15 14 13 12 11 10 9 8 46 45 44 43 42 
23 1 3 2 7 6 5 4 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 
23 1 3 2 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 
23 1 5 4 3 2 125 124 123 122 121 120 119 118 117 116 115 114 113 112 111 110 109 108 
23 1 107 106 105 10...

result:

ok good!

Test #72:

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

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 7 6 5 4 3 2 
6 1 17 16 15 14 13 
63 12 11 10 9 8 7 6 5 4 3 2 1 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 134 133 132 131 130 129 128 127 126 125 124 123 122 121 120 119 118 117 116 115 114 
63 12 11 10 9 8 7 6 5 4 3 2 1 113 112 111 110 109 108 107 ...

result:

ok good!

Test #73:

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

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 2 1 
2 11 10 
53 9 8 7 6 5 4 3 2 1 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 110 109 108 107 106 105 104 103 102 101 100 99 98 97 96 95 94 93 92 91 90 89 88 87 86 85 
53 9 8 7 6 5 4 3 2 1 84 83 82 81 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 ...

result:

ok good!

Test #74:

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

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

result:

ok good!

Test #75:

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

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 2 1 3 4 5 6 7 10 9 8 16 15 14 13 12 11 
16 2 1 3 4 5 6 7 10 9 8 18 17 16 15 14 13 
16 2 1 3 4 5 6 7 12 11 10 9 8 19 18 17 16 
16 2 1 3 4 5 6 7 15 14 13 12 11 10 9 8 26 
17 2 1 3 4 5 6 7 25 24 23 22 21 20 19 18 17 16 
17 2 1 3 4 5 6 15 14 13 12 11 10 9 8 7 31 30 
17 2 1 3 4 5 6 29 28 27 26 25 2...

result:

ok good!

Test #76:

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

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

result:

ok good!

Test #77:

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

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

result:

ok good!

Test #78:

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

input:

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

output:

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

result:

ok good!

Test #79:

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

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 20 1 40 3 35 28 12 7 2 21 16 32 27 
13 20 1 40 3 35 28 12 7 2 21 16 8 32 
13 20 1 40 3 35 28 12 7 2 27 25 21 18 
13 20 1 40 3 35 28 12 7 2 16 8 32 27 
13 20 1 40 3 35 28 12 7 2 25 21 18 16 
13 20 1 40 3 35 28 12 7 2 8 32 27 25 
13 20 1 40 3 35 28 12 7 2 23 21 18 16 
13 20 1 40 3 35 28 12 14 8 ...

result:

ok good!

Test #80:

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

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 23 15 38 17 16 12 3 32 5 2 4 36 30 
21 37 23 15 38 17 16 12 3 32 5 2 24 4 36 30 14 6 33 35 34 11 
21 37 23 15 38 17 16 12 3 32 5 2 24 4 36 30 14 6 33 35 34 27 
21 37 23 15 38 17 16 12 3 32 5 2 24 4 36 30 14 6 33 11 10 7 
21 37 23 15 38 17 16 12 3 32 5 2 24 4 36 30 14 6 40 35 34 33 
21 37 23...

result:

ok good!

Test #81:

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

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 129 123 119 118 117 110 94 85 83 72 70 69 67 64 45 31 16 11 5 3 122 120 114 108 104 92 87 65 60 59 46 38 28 6 124 121 101 98 93 71 51 49 47 44 40 29 25 24 22 13 4 1 112 109 103 
55 129 123 119 118 117 110 94 85 83 72 70 69 67 64 45 31 16 11 5 3 122 120 114 108 104 92 87 65 60 59 46 38 28 6 124 ...

result:

ok good!

Test #82:

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

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 115 97 86 84 79 77 64 59 53 48 39 32 28 21 13 3 113 106 100 91 82 78 74 68 65 54 52 45 41 37 23 19 6 130 129 125 123 122 119 103 102 89 81 73 72 70 63 58 42 15 1 120 116 105 99 98 95 92 87 83 67 57 38 26 24 22 
66 115 97 86 84 79 77 64 59 53 48 39 32 28 21 13 3 113 106 100 91 82 78 74 68 65 54 ...

result:

ok good!

Test #83:

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

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 124 120 112 105 104 103 56 52 47 41 32 18 12 122 115 114 
16 124 120 113 112 110 105 104 103 101 96 93 90 86 85 80 77 
16 74 71 65 56 54 52 47 45 44 41 39 35 32 27 25 18 
16 15 13 12 4 2 124 122 120 115 114 113 112 110 108 105 104 
16 103 101 96 93 90 86 85 84 81 80 79 77 74 71 68 65 
16 61 59...

result:

ok good!

Test #84:

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

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 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 49 48 
45 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 
54 2 1 58 57 56 55 54 53 52 51 50 49...

result:

ok good!

Test #85:

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

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 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 37 36 35 34 44 43 42 41 40 39 38 52 51 50 49 48 47 46 45 66 
63 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 37 36 35 34 44 43 42 41 40 39 38 65 64 63 62 61 60 ...

result:

ok good!

Test #86:

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

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 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 31 30 29 28 37 36 35 34 33 
36 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 32 31 30 29 28 44 43 42 41 
36 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 40 39 38 37 36 35...

result:

ok good!

Test #87:

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

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 69 68 67 66 65 64 63 62 61 60 59 58 57 
118 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 92 91 90 89 88 87 86 85 84 83 82 81 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62...

result:

ok good!

Test #88:

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

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 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 77 76 
147 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...

result:

ok good!

Test #89:

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

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 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 
37 13 12 11 10 9 8 7 6 5 4 3 2 1 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 
45 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 ...

result:

ok good!

Test #90:

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

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

result:

ok good!

Test #91:

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

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 446 445 444 443 442 441 440 439 
9 1 438 437 436 435 434 433 432 431 
9 1 430 429 428 427 426 425 424 423 
9 1 422 421 420 419 418 417 416 415 
9 1 414 413 412 411 410 409 408 407 
9 1 406 405 404 403 402 401 400 399 
9 1 398 397 396 395 394 393 392 391 
9 1 390 389 388 387 386 385 384 383 
9...

result:

ok good!

Test #92:

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

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 470 469 468 467 466 465 464 463 462 461 460 459 458 457 456 455 454 453 452 451 450 449 448 447 446 445 444 443 442 441 440 439 438 437 436 435...

result:

ok good!

Test #93:

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

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

result:

ok good!

Test #94:

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

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 88 
2 33 92 
16 88 68 33 8 92 22 3 2 83 93 82 78 39 27 54 95 
32 88 68 33 8 92 22 3 2 83 93 82 78 39 27 70 54 46 23 95 59 32 4 77 60 48 44 37 35 29 25 15 13 
32 88 68 33 8 92 22 3 2 83 93 82 78 39 27 70 54 46 23 95 59 32 12 9 4 97 77 60 48 44 37 35 29 
32 88 68 33 8 92 22 3 2 83 93 82 78 39 27 ...

result:

ok good!

Test #95:

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

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 308 
2 206 308 
16 247 206 103 344 332 327 308 298 233 322 321 320 305 291 285 280 
32 247 206 103 344 332 327 308 298 276 261 259 254 253 250 233 224 221 147 143 117 108 77 32 1 350 349 347 343 342 335 334 328 
64 247 206 103 344 332 327 325 322 321 320 310 308 305 303 298 296 295 293 291 286 2...

result:

ok good!

Subtask #5:

score: 15
Accepted

Dependency #4:

100%
Accepted

Test #96:

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

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 16 13 19 23 26 15 2 14 9 21 3 18 
13 11 16 13 19 23 26 15 2 14 9 21 3 18 
13 11 16 13 19 23 26 15 2 14 9 21 3 25 
13 11 16 13 19 23 26 15 2 14 9 21 3 18 
13 11 16 13 19 23 26 15 2 14 9 21 3 25 
13 11 16 13 19 23 26 15 2 14 9 21 3 18 
13 11 16 13 19 23 26 15 2 14 9 21 3 25 
13 11 16 13 19 2...

result:

ok good!

Test #97:

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

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 101 55 41 10 110 69 34 1 151 83 60 52 42 32 4 45 26 95 67 46 17 11 150 134 105 102 100 85 140 76 63 22 88 31 20 158 37 39 12 138 112 51 35 15 149 125 94 75 159 127 82 49 29 148 92 25 119 115 87 19 14 6 142 121 99 147 131 108 72 2 104 77 74 61 40 18 132 130 126 
80 122 101 55 41 10 110 69 3...

result:

ok good!

Test #98:

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

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

result:

ok good!

Test #99:

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

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 81 80 79 78 77 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 86 85 84 83 82 93 92 91 90 
90 81 80 79 78 77 76 75 74 73 72...

result:

ok good!

Test #100:

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

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 202 201 200 199 198 197 196 195 194 193 192 191 190 189 188 187 186 185 184 183 182 181 180 179 178 177 176 175 174 173 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 12...

result:

ok good!

Test #101:

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

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 10 9 8 7 6 5 4 3 2 1 230 229 228 227 226 225 224 223 222 221 220 219 218 217 216 215 214 213 212 211 210 209 208 207 206 205 204 203 202 201 200 199 198 197 196 195 194 193 192 191 190 189 188 187 186 185 184 183 182 181 180 179 178 177 176 175 174 173 172 171 170 169 168 167 166 165 164 163 ...

result:

ok good!

Test #102:

score: 0
Accepted
time: 32ms
memory: 35196kb

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 2751 2750 2749 2748 2747 2746 2745 2744 2743 2742 2741 
12 1 2740 2739 2738 2737 2736 2735 2734 2733 2732 2731 2730 
12 1 2729 2728 2727 2726 2725 2724 2723 2722 2721 2720 2719 
12 1 2718 2717 2716 2715 2714 2713 2712 2711 2710 2709 2708 
12 1 2707 2706 2705 2704 2703 2702 2701 2700 2699 26...

result:

ok good!

Test #103:

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

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: 3ms
memory: 7776kb

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

result:

ok good!

Test #105:

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

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 1483 1429 
16 1279 808 718 558 1483 1429 1316 1294 1044 920 774 713 291 214 163 120 
32 1279 808 718 558 1483 1429 1411 1319 1316 1294 1264 1203 1112 1062 1044 1028 940 920 774 772 768 764 743 713 700 649 509 493 460 453 383 323 
128 1279 808 718 558 316 291 256 242...

result:

ok good!

Test #106:

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

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 1267 
2 1336 1335 
4 1267 225 2052 1427 
16 1426 1336 1335 1313 1302 1271 1267 1104 1095 915 855 853 835 435 366 316 
32 242 225 146 46 2392 2350 2342 2233 2218 2174 2159 2101 2059 2058 2052 1999 1987 1884 1853 1840 1831 1758 1685 1658 1636 1621 1618 1609 1573 1552 1494 1449 
128 1446 1427 1426 ...

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: 4ms
memory: 13540kb

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 10 4 27 40 16 34 30 5 18 35 25 9 38 31 21 13 26 39 12 2 
21 17 10 4 27 40 16 34 30 5 18 35 25 9 38 31 21 13 26 39 12 2 
21 17 10 4 27 40 16 34 30 5 18 35 25 9 38 31 21 13 26 39 12 2 
21 17 10 4 27 40 16 34 30 5 18 35 25 9 38 31 21 13 26 39 12 2 
21 17 10 4 27 40 16 34 30 5 18 35 25 9 38 31...

result:

ok good!

Test #108:

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

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 343 324 296 291 243 170 130 210 131 116 51 414 355 347 305 238 176 150 3 282 156 120 325 309 412 403 401 352 219 217 378 318 295 275 191 112 68 227 169 417 337 322 294 261 222 164 138 136 83 11 341 293 266 215 118 410 389 356 289 247 203 159 157 47 301 265 168 77 348 280 277 276 202 180 123 4...

result:

ok good!

Test #109:

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

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 3496 3481 3480 3474 3463 3461 3447 3438 3434 3417 3416 3406 3404 3400 3389 3384 3383 3373 3371 3367 3366 3361 3357 3350 3338 3328 3313 3308 3295 3293 3287 3277 3269 3268 3260 3251 3218 3217 3213 3203 3176 3167 3150 3123 3122 3114 3094 3080 3077 3076 3075 3072 3069 3065 3063 3062 3025 3009 300...

result:

ok good!

Test #110:

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

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

result:

ok good!

Test #111:

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

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 1363 1362 1361 1360 1359 1358 1357 1356 1355 1354 1353 1352 1351 1350 1349 1348 1347 1346 1345 1344 1343 1342 1341 1340 1339 1338 1337 1336 1335 1334 1333 1332 1331 1330 1329 1328 1327 1326 1325 1324 1323 1322 1321 1320 1319 1318 1317 1316 1315 1314 1313 1312 1311 1310 1309 1308 1307 1306 1305...

result:

ok good!

Test #112:

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

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 1000 999 998 997 996 995 994 993 992 991 990 989 988 987 986 985 984 983 982 981 980 979 978 977 976 975 974 973 972 971 970 969 968 967 966 965 964 963 962 961 960 959 958 957 956 955 954 953 952 951 950 949 948 947 946 945 944 943 942 941 940 939 938 937 936 935 934 933 932 931 930 929 928 ...

result:

ok good!

Test #113:

score: 0
Accepted
time: 123ms
memory: 200316kb

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 13930 13929 13928 13927 13926 13925 13924 13923 13922 13921 13920 13919 13918 
14 1 13917 13916 13915 13914 13913 13912 13911 13910 13909 13908 13907 13906 13905 
14 1 13904 13903 13902 13901 13900 13899 13898 13897 13896 13895 13894 13893 13892 
14 1 13891 13890 13889 13888 13887 13886 13...

result:

ok good!

Test #114:

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

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: 12ms
memory: 21336kb

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

result:

ok good!

Test #116:

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

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 2438 
2 1224 2438 
4 1224 2438 2178 1092 
16 1224 2438 2178 2110 1989 1723 1092 4908 4477 4303 2388 1623 783 4400 4135 3364 
128 1224 2438 2178 2110 1989 1723 1092 4908 4477 4303 2388 2352 2074 1623 1395 783 99 4400 4135 3921 3364 3281 2726 2145 1065 4253 4077 3561 2976 2777 2637 2461 2139 1615...

result:

ok good!

Test #117:

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

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 9052 
2 10648 10604 
4 10348 9653 9592 9052 
16 7060 4683 3901 2700 1489 1427 1326 726 554 478 10787 10648 10604 10436 10348 10239 
128 9653 9609 9592 9379 9332 9074 9058 9052 8520 8176 7693 7184 7060 7037 6400 6095 6025 5913 5801 5481 5397 5356 5342 5111 4815 4683 4508 4488 4418 4348 3901 3437 ...

result:

ok good!

Extra Test:

score: 0
Extra Test Passed