QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#360009#6339. CookiesLynkcat100 ✓281ms209888kbC++172.0kb2024-03-21 09:20:192024-03-21 09:20:20

Judging History

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

  • [2024-03-21 09:20:20]
  • 评测
  • 测评结果:100
  • 用时:281ms
  • 内存:209888kb
  • [2024-03-21 09:20:19]
  • 提交

answer

#include<bits/stdc++.h>
#define poly vector<int>
#define IOS ios::sync_with_stdio(false)
#define ll long long
#define mp make_pair
#define mt make_tuple
#define pa pair < int,int >
#define fi first
#define se second
#define inf 1e18
#define mod 998244353
#define sz(x) (int)((x).size())
#define int ll
//#define N
using namespace std;
const int N=15005;
int n,a[N],m,b[N];
vector<bitset<N>>dp[N];
void BellaKira()
{
	cin>>n;
	int all=0;
	for (int i=1;i<=n;i++)
		cin>>a[i],all+=a[i];
	// sort(a+1,a+n+1);
	cin>>m;
	for (int i=1;i<=m;i++)
		cin>>b[i];
	reverse(b+1,b+m+1);
	dp[0].resize(1);
	dp[0][0][0]=1;
	int mn=inf;
	for (int i=1;i<=m;i++)
	{
		bitset<N>now;
		dp[i].resize(all/b[i]+1);
		for (int j=0;j<=all/b[i];j++)
		{
			if (j<sz(dp[i-1]))
				now|=dp[i-1][j];
			int lim=0;
			for (int k=1;k<=n;k++) lim+=min(a[k],j);
			dp[i][j]=now;
			dp[i][j]<<=(N-lim-1);
			dp[i][j]>>=(N-lim-1);
			now<<=b[i];
		}
		for (int j=0;j<=all/b[i];j++)
			if (dp[i][j][all]==1)
			{
				mn=min(mn,j);
			}
	}
	for (int i=1;i<=m;i++)
	{
		for (int j=0;j<=all/b[i];j++)
			if (dp[i][j][all]==1&&j==mn)
			{
				cout<<j<<'\n';
				poly gg;
				int now=all,op=j;
				for (int x=i;x>=1;x--)
				{
					for (int y=0;y<=all/b[x];y++)
						if (now-y*b[x]>=0&&op-y<=(x==1?0:all/b[x-1]))
						{
							if (dp[x-1][op-y][now-y*b[x]])
							{
								op-=y;
								now-=y*b[x];
								for (int p=1;p<=y;p++)
									gg.push_back(b[x]);
								break;
							}
						}
				}
				reverse(gg.begin(),gg.end());
				priority_queue<pa>q;
				for (int x=1;x<=n;x++)
					q.push(mp(a[x],x));
				for (auto u:gg)
				{
					poly g;
					for (int j=1;j<=u;j++)
						g.push_back(q.top().se),q.pop();
					cout<<sz(g)<<' ';
					for (auto u:g) cout<<u<<" ";
					cout<<'\n';
					for (auto u:g) a[u]--,q.push(mp(a[u],u));
				}
				return;
			}
	}
	cout<<"-1\n";
}
signed main()
{
	IOS;
	cin.tie(0);
	int T=1;
	while (T--)
	{
		BellaKira();
	}
}

详细

Subtask #1:

score: 6
Accepted

Test #1:

score: 6
Accepted
time: 1ms
memory: 3904kb

input:

1
1
1
1

output:

1
1 1 

result:

ok good!

Test #2:

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

input:

2
1 1
1
1

output:

2
1 2 
1 1 

result:

ok good!

Test #3:

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

input:

2
1 1
1
2

output:

1
2 2 1 

result:

ok good!

Test #4:

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

input:

2
1 1
2
1 2

output:

1
2 2 1 

result:

ok good!

Test #5:

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

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

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

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: 1ms
memory: 3948kb

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

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

input:

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

output:

-1

result:

ok no solution

Test #11:

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

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
46 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 
46 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: 1ms
memory: 4436kb

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: 1ms
memory: 5092kb

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

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: 1ms
memory: 5124kb

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: 1ms
memory: 4072kb

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

result:

ok good!

Test #17:

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

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
27 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 
27 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 
27 445 444 443 442 441 440 439 438 437 436 435 434 433 432 431 430 429 42...

result:

ok good!

Test #18:

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

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
88 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 426...

result:

ok good!

Test #19:

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

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
243 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 #20:

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

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

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

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

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
35 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 
35 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 425 424 
35 423 42...

result:

ok good!

Test #24:

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

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
69 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 425 
52 424 423 422 42...

result:

ok good!

Test #25:

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

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
33 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 
33 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 
33 427 426 425 424 423 42...

result:

ok good!

Test #26:

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

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
67 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 
50 426 425 424 423 422 42...

result:

ok good!

Test #27:

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

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
33 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 
33 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 
33 427 426 425 424 423 42...

result:

ok good!

Subtask #2:

score: 7
Accepted

Test #28:

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

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: 1ms
memory: 4424kb

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

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

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

input:

2
2 1
1
1

output:

3
1 1 
1 2 
1 1 

result:

ok good!

Test #33:

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

input:

2
1 2
1
2

output:

-1

result:

ok no solution

Test #34:

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

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: 1ms
memory: 3964kb

input:

3
3 2 1
1
3

output:

-1

result:

ok no solution

Test #36:

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

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: 1ms
memory: 3956kb

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: 1ms
memory: 4304kb

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

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: 9ms
memory: 13004kb

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

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

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

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: 1ms
memory: 4036kb

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: 1ms
memory: 3912kb

input:

2
7 8
2
1 2

output:

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

result:

ok good!

Test #46:

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

input:

3
5 4 6
2
2 3

output:

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

result:

ok good!

Test #47:

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

input:

3
4 2 9
3
1 2 3

output:

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

result:

ok good!

Test #48:

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

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

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: 1ms
memory: 3956kb

input:

4
3 3 6 3
3
2 3 4

output:

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

result:

ok good!

Test #51:

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

input:

5
4 3 3 3 1
3
2 4 5

output:

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

result:

ok good!

Test #52:

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

input:

5
4 3 3 3 2
3
3 4 5

output:

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

result:

ok good!

Test #53:

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

input:

5
4 4 4 2 1
3
2 4 5

output:

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

result:

ok good!

Test #54:

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

input:

5
3 3 3 3 3
3
1 2 4

output:

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

result:

ok good!

Test #55:

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

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

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: 1ms
memory: 4012kb

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

input:

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

output:

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

result:

ok good!

Test #59:

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

input:

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

output:

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

result:

ok good!

Test #60:

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

input:

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

output:

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

result:

ok good!

Test #61:

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

input:

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

output:

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

result:

ok good!

Test #62:

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

input:

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

output:

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

result:

ok good!

Test #63:

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

input:

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

output:

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

result:

ok good!

Test #64:

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

input:

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

output:

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

result:

ok good!

Test #65:

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

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: 1ms
memory: 4012kb

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

result:

ok good!

Test #67:

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

input:

4
2 2 2 1
2
1 4

output:

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

result:

ok good!

Subtask #4:

score: 45
Accepted

Dependency #1:

100%
Accepted

Dependency #3:

100%
Accepted

Test #68:

score: 45
Accepted
time: 1ms
memory: 4436kb

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

result:

ok good!

Test #69:

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

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

result:

ok good!

Test #70:

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

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

result:

ok good!

Test #71:

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

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
203 1 3 2 7 6 5 4 17 16 15 14 13 12 11 10 9 8 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 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 98 97 96 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80 7...

result:

ok good!

Test #72:

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

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
202 7 6 5 4 3 2 1 17 16 15 14 13 12 11 10 9 8 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 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 98 97 96 95 94 93 92 91 90 89 88 8...

result:

ok good!

Test #73:

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

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

result:

ok good!

Test #74:

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

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

result:

ok good!

Test #75:

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

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

result:

ok good!

Test #76:

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

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

result:

ok good!

Test #77:

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

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

result:

ok good!

Test #78:

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

input:

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

output:

115
8 8 9 10 2 7 6 3 1 
8 8 9 10 2 7 6 3 1 
8 8 9 10 2 7 6 3 1 
8 8 9 10 2 7 6 3 1 
8 8 9 10 2 7 6 3 1 
8 8 9 10 2 7 6 3 1 
8 8 9 10 2 7 6 3 1 
8 8 9 10 2 7 6 3 1 
8 8 9 10 2 7 6 3 1 
8 8 9 10 2 7 6 3 1 
8 8 9 10 2 7 6 5 3 
8 8 9 10 2 7 6 1 5 
8 8 9 10 2 7 6 3 1 
8 8 9 10 2 7 6 5 3 
8 8 9 10 2 7 6 1...

result:

ok good!

Test #79:

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

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
29 20 1 40 3 35 28 12 7 2 21 16 32 27 8 25 18 23 14 38 29 13 4 39 37 6 26 36 24 22 
29 20 1 40 3 35 28 12 7 2 21 16 32 27 8 25 18 23 14 38 29 13 4 39 37 6 26 36 30 24 
29 20 1 40 3 35 28 12 7 2 21 16 32 27 8 25 18 23 14 38 29 13 4 39 37 6 26 22 15 5 
27 20 1 40 3 35 28 12 7 2 21 16 32 27 8 25 18 ...

result:

ok good!

Test #80:

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

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

result:

ok good!

Test #81:

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

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
116 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 102 97 95 82 79 78 63 58 52 20 17 9 7 111 106 100 99 91 90 86 84 81 74 62 56 54 50 41 35 21 19 18 130 128 127 126 125...

result:

ok good!

Test #82:

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

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
76 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 14 11 10 9 7 2 128 124 121 112 
76 115 97 86 84 79 77 64 59 53 48 39 32 28 21 13 3 11...

result:

ok good!

Test #83:

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

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

result:

ok good!

Test #84:

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

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
70 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 47 46 45 44 58 57 56 55 54 53 52 51 50 70 69 68 67 66 65 64 63 62 61 60 59 
70 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 ...

result:

ok good!

Test #85:

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

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
69 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 65 64 63 62 61 60 59 58 57 56 55 54 53 88 87 86 
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 ...

result:

ok good!

Test #86:

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

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
108 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 32 44 43 42 41 40 39 38 55 54 53 52 51 50 49 48 47 46 45 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 112 111 110 109 108 107 106 105 104 103 102 101 100 99 98 97 96 95 94 93 92 91 90...

result:

ok good!

Test #87:

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

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
123 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 92 91 90 89 88 87 86 85 84 83 82 81 80 79 78 77 76 75 74 73 72 71 70 139 138 137 136 135 134 133...

result:

ok good!

Test #88:

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

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
147 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 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 116 115 114 113 112 111 110 109 108 107 106 105 104 103 102 101 100 99 9...

result:

ok good!

Test #89:

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

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
218 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 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 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 300 299 298 297 296 295 ...

result:

ok good!

Test #90:

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

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
92 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 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 
24 50 49 48 47 46 45 44 4...

result:

ok good!

Test #91:

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

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

result:

ok good!

Test #92:

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

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
470 1 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 425 424 423 422 421 420 419 418 417 416 415 414 413 412 411 410 409 408 407 406 405 404 403 402 401 400 399 398...

result:

ok good!

Test #93:

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

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

result:

ok good!

Test #94:

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

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

result:

ok good!

Test #95:

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

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
256 308 206 247 103 344 332 327 298 233 322 321 320 305 291 285 280 276 261 259 254 253 250 224 221 147 143 117 108 77 32 1 350 349 347 343 342 335 334 328 325 310 303 296 295 293 286 282 281 279 273 263 257 249 248 235 231 230 227 226 214 212 211 205 203 194 187 184 180 179 174 173 172 157 151 14...

result:

ok good!

Subtask #5:

score: 15
Accepted

Dependency #4:

100%
Accepted

Test #96:

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

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

result:

ok good!

Test #97:

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

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
120 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 70 47 30 28 9 156 154 143 12...

result:

ok good!

Test #98:

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

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

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
338 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 89 88 87 101 100 99 98 97 96 95 ...

result:

ok good!

Test #100:

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

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
513 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: 34748kb

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
378 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: 7ms
memory: 36584kb

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

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
2924 1 2924 2923 2922 2921 2920 2919 2918 2917 2916 2915 2914 2913 2912 2911 2910 2909 2908 2907 2906 2905 2904 2903 2902 2901 2900 2899 2898 2897 2896 2895 2894 2893 2892 2891 2890 2889 2888 2887 2886 2885 2884 2883 2882 2881 2880 2879 2878 2877 2876 2875 2874 2873 2872 2871 2870 2869 2868 2867 ...

result:

ok good!

Test #104:

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

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

result:

ok good!

Test #105:

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

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
1024 1279 558 1483 1429 808 718 1316 1294 1044 920 774 713 291 214 163 120 1411 1319 1264 1203 1112 1062 1028 940 772 768 764 743 700 649 509 493 460 453 383 323 316 256 242 87 1477 1377 1304 1284 1242 1237 1117 1113 1069 1046 1019 1015 977 963 956 948 925 923 909 862 835 814 809 749 693 677 596 ...

result:

ok good!

Test #106:

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

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
2048 1267 1336 1335 225 2052 1427 1426 1313 1302 1271 1104 1095 915 855 853 835 435 366 316 242 146 46 2392 2350 2342 2233 2218 2174 2159 2101 2059 2058 1999 1987 1884 1853 1840 1831 1758 1685 1658 1636 1621 1618 1609 1573 1552 1494 1449 1446 1425 1423 1352 1333 1265 1235 1214 1130 1117 1027 1023 ...

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: 5ms
memory: 43208kb

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

result:

ok good!

Test #108:

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

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

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
2550 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: 29ms
memory: 70452kb

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
494 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 65 66 67 68 69 71 70 72 73 74 75 77 76 78 79 81 80 82 84 83 85 87 86 89 88 90 92 91 94 93 96 95 98 97 101 100...

result:

ok good!

Test #111:

score: 0
Accepted
time: 63ms
memory: 72472kb

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
4137 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 130...

result:

ok good!

Test #112:

score: 0
Accepted
time: 68ms
memory: 200028kb

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
1527 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: 281ms
memory: 209888kb

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

result:

ok good!

Test #114:

score: 0
Accepted
time: 254ms
memory: 162040kb

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
14828 1 14828 14827 14826 14825 14824 14823 14822 14821 14820 14819 14818 14817 14816 14815 14814 14813 14812 14811 14810 14809 14808 14807 14806 14805 14804 14803 14802 14801 14800 14799 14798 14797 14796 14795 14794 14793 14792 14791 14790 14789 14788 14787 14786 14785 14784 14783 14782 14781 ...

result:

ok good!

Test #115:

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

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

result:

ok good!

Test #116:

score: 0
Accepted
time: 45ms
memory: 59048kb

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
1024 2438 1224 2178 1092 2110 1989 1723 4908 4477 4303 2388 1623 783 4400 4135 3364 2352 2074 1395 99 3921 3281 2726 2145 1065 4253 4077 3561 2976 2777 2637 2461 2139 1615 1579 1146 256 187 4945 4740 4585 4285 4196 4020 2716 2377 2273 1996 1971 1620 1487 1135 1076 922 915 83 4639 4449 4352 4282 4...

result:

ok good!

Test #117:

score: 0
Accepted
time: 66ms
memory: 59248kb

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
8192 9052 10648 10604 10348 9653 9592 7060 4683 3901 2700 1489 1427 1326 726 554 478 10787 10436 10239 9609 9379 9332 9074 9058 8520 8176 7693 7184 7037 6400 6095 6025 5913 5801 5481 5397 5356 5342 5111 4815 4508 4488 4418 4348 3437 3416 2333 2319 2094 1868 1834 1654 1641 1520 1499 954 789 630 109...

result:

ok good!

Extra Test:

score: 0
Extra Test Passed