QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#100275#6339. Cookieszhouhuanyi100 ✓633ms123680kbC++231.3kb2023-04-25 14:09:262023-04-25 14:09:29

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-04-25 14:09:29]
  • 评测
  • 测评结果:100
  • 用时:633ms
  • 内存:123680kb
  • [2023-04-25 14:09:26]
  • 提交

answer

#include<iostream>
#include<cstdio>
#include<algorithm>
#define N 15000
using namespace std;
int read()
{
    char c=0;
    int sum=0;
    while (c<'0'||c>'9') c=getchar();
    while ('0'<=c&&c<='9') sum=sum*10+c-'0',c=getchar();
    return sum;
}
int n,m,rst,a[N+1],b[N+1],cnt[N+1],cnts[N+1],p[N+1];
short dp[N+1][N+1],pv[N+1][N+1];
bool cmp(int x,int y)
{
    return a[x]>a[y];
}
int main()
{
    int res=0;
    n=read();
    for (int i=1;i<=n;++i) a[i]=read(),res+=a[i],cnt[a[i]]++;
    for (int i=res-1;i>=1;--i) cnt[i]+=cnt[i+1];
    for (int i=2;i<=res;++i) cnt[i]+=cnt[i-1];
    m=read();
    for (int i=1;i<=m;++i) b[i]=read();
    sort(b+1,b+m+1),dp[0][0]=m;
    for (int i=1;i<=res;++i)
    {
	for (int j=0;j<=cnt[i];++j)
	    if (dp[i-1][j])
	    {
		for (int k=1;j+b[k]<=cnt[i]&&k<=dp[i-1][j];++k)
		    if (k>dp[i][j+b[k]])
			dp[i][j+b[k]]=k,pv[i][j+b[k]]=k;
	    }
	if (dp[i][res])
	{
	    printf("%d\n",i);
	    for (int j=i;j>=1;--j) cnts[j]=b[pv[j][res]],res-=b[pv[j][res]];
	    for (int j=1;j<=i;++j)
	    {
		for (int k=1;k<=n;++k) p[k]=k;
		sort(p+1,p+n+1,cmp);
		printf("%d ",cnts[j]);
		for (int k=1;k<=cnts[j];++k) printf("%d ",p[k]);
		for (int k=1;k<=cnts[j];++k) a[p[k]]--;
		puts("");
	    }
	    return 0;
	}
    }
    puts("-1");
    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: 3600kb

input:

1
1
1
1

output:

1
1 1 

result:

ok good!

Test #2:

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

input:

2
1 1
1
1

output:

2
1 1 
1 2 

result:

ok good!

Test #3:

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

input:

2
1 1
1
2

output:

1
2 1 2 

result:

ok good!

Test #4:

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

input:

2
1 1
2
1 2

output:

1
2 1 2 

result:

ok good!

Test #5:

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

input:

4
1 1 1 1
2
2 3

output:

2
2 1 2 
2 3 4 

result:

ok good!

Test #6:

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

input:

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

output:

2
4 1 2 3 4 
4 5 6 7 8 

result:

ok good!

Test #7:

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

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 329 
1 328 
1 330 
1 327 
1 326 
1 325 
1 331 
1 324 
1 323 
1 322 
1 332 
1 321 
1 333 
1 320 
1 334 
1 319 
1 318 
1 317 
1 335 
1 316 
1 336 
1 315 
1 337 
1 314 
1 313 
1 312 
1 338 
1 311 
1 339 
1 310 
1 340 
1 309 
1 308 
1 307 
1 341 
1 306 
1 305 
1 304 
1 342 
1 303 
1 302 
1 301 
1 ...

result:

ok good!

Test #8:

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

input:

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

output:

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

result:

ok good!

Test #9:

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

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

result:

ok good!

Test #10:

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

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

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 329 344 343 342 341 340 339 338 337 336 335 334 333 332 331 330 345 328 327 326 325 324 323 322 321 320 319 318 317 316 315 314 360 375 374 373 372 371 370 369 368 367 366 365 364 363 
46 299 313 312 311 310 309 308 307 306 305 304 303 302 301 300 346 298 297 296 295 294 293 292 291 290 289 28...

result:

ok good!

Test #12:

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

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 329 344 
2 328 345 
2 326 343 
2 325 346 
2 323 342 
2 322 347 
2 321 348 
2 320 349 
2 318 341 
2 317 350 
2 316 340 
2 315 351 
2 313 339 
2 312 352 
2 311 353 
2 310 354 
2 308 338 
2 307 355 
2 305 337 
2 304 356 
2 302 336 
2 301 357 
2 300 358 
2 299 359 
2 297 335 
2 296 360 
2 295 334 ...

result:

ok good!

Test #13:

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

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 318 333 332 331 330 329 328 327 326 325 324 323 322 321 320 319 334 317 316 315 314 313 
22 304 340 339 338 337 336 335 312 311 310 309 308 307 306 305 341 303 302 301 300 299 298 
22 290 347 346 345 344 343 342 297 296 295 294 293 292 291 348 289 288 287 286 285 284 283 
22 275 354 353 352 35...

result:

ok good!

Test #14:

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

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 325 340 339 338 337 336 335 334 333 
9 320 344 343 342 341 332 331 330 329 
9 314 346 345 328 327 326 324 323 322 
9 308 349 348 347 321 319 318 317 316 
9 301 351 350 315 313 312 311 310 309 
9 296 355 354 353 352 307 306 305 304 
9 290 357 356 303 302 300 299 298 297 
9 284 360 359 358 295 29...

result:

ok good!

Test #15:

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

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

result:

ok good!

Test #16:

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

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 328 343 342 341 340 339 338 337 336 335 334 333 332 331 330 329 344 327 326 325 324 
21 315 350 349 348 347 346 345 323 322 321 320 319 318 317 316 351 314 313 312 311 310 
21 300 356 355 354 353 352 309 308 307 306 305 304 303 302 301 357 299 298 297 296 295 
21 287 363 362 361 360 359 358 29...

result:

ok good!

Test #17:

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

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 328 343 342 341 340 339 338 337 336 335 334 333 332 331 330 329 344 327 326 325 324 323 322 321 320 319 318 
27 311 352 351 350 349 348 347 346 345 317 316 315 314 313 312 353 310 309 308 307 306 305 304 303 302 301 300 
27 293 360 359 358 357 356 355 354 299 298 297 296 295 294 361 292 291 29...

result:

ok good!

Test #18:

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

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

result:

ok good!

Test #19:

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

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

result:

ok good!

Test #20:

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

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

result:

ok good!

Test #21:

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

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

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

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 324 339 338 337 336 335 334 333 332 331 330 329 328 327 326 325 340 323 322 321 320 319 318 317 316 315 314 313 312 311 310 355 370 369 368 
35 301 346 345 344 343 342 341 309 308 307 306 305 304 303 302 347 300 299 298 297 296 295 294 293 292 291 290 289 288 362 379 378 377 376 375 
35 278 35...

result:

ok good!

Test #24:

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

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 324 339 338 337 336 335 334 333 332 331 330 329 328 327 326 325 340 323 322 321 320 319 318 317 316 315 314 313 312 311 310 355 370 369 368 367 366 365 364 363 362 361 360 359 358 357 356 309 354 353 352 351 350 349 348 347 346 345 344 343 342 341 262 277 276 275 274 273 272 
52 286 299 298 29...

result:

ok good!

Test #25:

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

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 324 339 338 337 336 335 334 333 332 331 330 329 328 327 326 325 340 323 322 321 320 319 318 317 316 315 314 313 312 311 310 355 370 
33 302 347 346 345 344 343 342 341 309 308 307 306 305 304 303 348 301 300 299 298 297 296 295 294 293 292 291 290 289 363 378 377 376 
33 280 353 352 351 350 34...

result:

ok good!

Test #26:

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

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 324 339 338 337 336 335 334 333 332 331 330 329 328 327 326 325 340 323 322 321 320 319 318 317 316 315 314 313 312 311 310 355 370 369 368 367 366 365 364 363 362 361 360 359 358 357 356 309 354 353 352 351 350 349 348 347 346 345 344 343 342 341 262 277 276 275 274 
50 285 298 297 296 295 29...

result:

ok good!

Test #27:

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

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 324 339 338 337 336 335 334 333 332 331 330 329 328 327 326 325 340 323 322 321 320 319 318 317 316 315 314 313 312 311 310 355 370 
33 302 347 346 345 344 343 342 341 309 308 307 306 305 304 303 348 301 300 299 298 297 296 295 294 293 292 291 290 289 363 378 377 376 
33 280 353 352 351 350 34...

result:

ok good!

Subtask #2:

score: 7
Accepted

Test #28:

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

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

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

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: 77ms
memory: 123680kb

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

input:

2
2 1
1
1

output:

3
1 1 
1 1 
1 2 

result:

ok good!

Test #33:

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

input:

2
1 2
1
2

output:

-1

result:

ok no solution

Test #34:

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

input:

3
1 2 3
1
2

output:

3
2 3 2 
2 3 1 
2 2 3 

result:

ok good!

Test #35:

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

input:

3
3 2 1
1
3

output:

-1

result:

ok no solution

Test #36:

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

input:

3
2 2 2
1
2

output:

3
2 1 2 
2 3 1 
2 2 3 

result:

ok good!

Test #37:

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

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

result:

ok good!

Test #38:

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

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: 32ms
memory: 33644kb

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: 93ms
memory: 43904kb

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

result:

ok good!

Test #41:

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

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

result:

ok good!

Test #42:

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

input:

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

output:

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

result:

ok good!

Test #43:

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

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

result:

ok good!

Test #44:

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

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

result:

ok good!

Subtask #3:

score: 12
Accepted

Test #45:

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

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

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 1 
2 2 3 

result:

ok good!

Test #47:

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

input:

3
4 2 9
3
1 2 3

output:

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

result:

ok good!

Test #48:

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

input:

4
3 5 4 3
2
3 4

output:

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

result:

ok good!

Test #49:

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

input:

4
1 4 5 5
3
1 3 4

output:

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

result:

ok good!

Test #50:

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

input:

4
3 3 6 3
3
2 3 4

output:

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

result:

ok good!

Test #51:

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

input:

5
4 3 3 3 1
3
2 4 5

output:

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

result:

ok good!

Test #52:

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

input:

5
4 3 3 3 2
3
3 4 5

output:

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

result:

ok good!

Test #53:

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

input:

5
4 4 4 2 1
3
2 4 5

output:

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

result:

ok good!

Test #54:

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

input:

5
3 3 3 3 3
3
1 2 4

output:

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

result:

ok good!

Test #55:

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

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

input:

6
3 3 3 2 2 2
3
2 5 6

output:

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

result:

ok good!

Test #57:

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

input:

6
4 4 3 2 1 1
3
1 3 5

output:

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

result:

ok good!

Test #58:

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

input:

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

output:

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

result:

ok good!

Test #59:

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

input:

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

output:

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

result:

ok good!

Test #60:

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

input:

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

output:

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

result:

ok good!

Test #61:

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

input:

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

output:

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

result:

ok good!

Test #62:

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

input:

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

output:

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

result:

ok good!

Test #63:

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

input:

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

output:

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

result:

ok good!

Test #64:

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

input:

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

output:

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

result:

ok good!

Test #65:

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

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

result:

ok good!

Test #66:

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

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

result:

ok good!

Test #67:

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

input:

4
2 2 2 1
2
1 4

output:

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

result:

ok good!

Subtask #4:

score: 45
Accepted

Dependency #1:

100%
Accepted

Dependency #3:

100%
Accepted

Test #68:

score: 45
Accepted
time: 3ms
memory: 3760kb

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

result:

ok good!

Test #69:

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

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

result:

ok good!

Test #70:

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

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

result:

ok good!

Test #71:

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

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 2 3 4 5 6 7 16 17 15 14 13 11 10 12 9 8 33 34 35 36 37 38 39 40 41 42 44 45 46 43 31 18 19 20 21 32 22 23 25 26 27 28 29 30 24 97 98 99 100 101 102 103 104 87 105 96 95 94 93 92 91 90 89 88 117 107 125 124 123 122 121 120 119 118 106 116 115 114 113 112 111 110 109 108 56 86 65 64 63 62 61 6...

result:

ok good!

Test #72:

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

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 2 3 4 5 6 7 1 15 17 16 14 13 11 12 10 9 8 31 32 34 35 36 37 38 39 40 41 42 33 29 18 19 20 21 22 23 25 26 27 30 28 24 100 101 102 103 104 105 106 107 108 110 111 99 98 97 96 95 94 93 92 91 90 109 89 123 134 133 132 131 130 129 128 127 126 125 124 112 122 121 120 119 118 117 116 115 114 113 54 6...

result:

ok good!

Test #73:

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

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 10 11 9 8 7 6 5 4 3 25 27 26 24 23 22 21 20 18 17 16 15 19 14 13 12 80 90 81 82 83 84 85 87 88 89 79 78 77 76 75 74 73 72 71 86 70 101 110 109 108 107 106 105 104 103 102 91 100 99 98 97 96 95 94 93 92 38 48 47 46 45 44 43 42 41 40 39 68 37 36 35 34 33 32 31 30 29 28 50 49 67 66 65 64 63 6...

result:

ok good!

Test #74:

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

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

result:

ok good!

Test #75:

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

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 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 37 36 34 33 35 38 39 40 41 42 43 44 46 45 47 48 49 50 51 52 53 60 59 58 57 56 55 54 61 62 63 64 65 66 67 68 
62 2 1 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 37 36 34...

result:

ok good!

Test #76:

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

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

result:

ok good!

Test #77:

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

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

result:

ok good!

Test #78:

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

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

result:

ok good!

Test #79:

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

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

result:

ok good!

Test #80:

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

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

result:

ok good!

Test #81:

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

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 85 31 119 123 118 117 72 45 83 16 70 69 11 67 110 3 129 94 5 64 59 120 108 38 114 104 46 65 60 28 122 92 87 6 71 93 1 98 51 13 49 47 4 44 101 40 22 124 24 121 25 29 97 63 95 82 79 78 103 102 7 20 17 112 52 109 9 58 91 90 99 86 84 18 81 100 19 62 35 56 54 106 50 111 41 74 21 125 113 126 127 116...

result:

ok good!

Test #82:

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

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

result:

ok good!

Test #83:

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

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

result:

ok good!

Test #84:

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

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

result:

ok good!

Test #85:

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

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

result:

ok good!

Test #86:

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

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 2 1 27 26 25 24 23 22 21 20 19 18 17 16 14 3 4 5 6 7 8 9 10 11 12 13 15 28 29 30 31 33 37 36 34 32 35 38 39 40 41 42 43 44 50 55 54 53 52 51 49 48 47 46 45 74 73 72 71 70 61 69 68 67 66 64 65 56 57 58 60 62 63 59 93 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 92 75 76 77...

result:

ok good!

Test #87:

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

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

result:

ok good!

Test #88:

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

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 45 31 32 33 34 35 36 37 38 39 40 41 42 43 44 2 46 47 48 49 50 51 52 53 54 55 56 57 1 29 30 3 4 5 6 7 8 9 10 11 12 13 14 15 17 28 27 26 25 24 23 22 21 20 19 18 16 77 76 75 74 73 72 64 71 70 69 67 68 58 59 60 61 62 63 65 66 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 11...

result:

ok good!

Test #89:

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

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

result:

ok good!

Test #90:

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

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

result:

ok good!

Test #91:

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

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 306 280 305 304 303 302 301 300 299 
10 1 288 310 309 308 307 298 297 296 295 
10 1 283 313 312 311 294 293 292 291 290 
10 1 276 315 314 289 287 286 285 284 282 
10 1 271 319 318 317 316 281 279 278 277 
9 1 265 321 320 275 274 273 272 270 
9 1 259 323 322 269 268 267 266 264 
9 1 254 326 3...

result:

ok good!

Test #92:

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

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 323 295 322 321 320 319 318 317 316 315 314 313 312 311 310 309 308 307 306 305 304 303 302 301 300 299 298 297 296 352 338 353 351 350 349 348 347 346 345 344 343 342 341 340 339 324 337 336 335 334 333 332 331 330 329 328 327 326 325 250 264 263 262 261 260 259 258 257 256 255 254 253 252...

result:

ok good!

Test #93:

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

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

result:

ok good!

Test #94:

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

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

result:

ok good!

Test #95:

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

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 327 344 332 298 233 143 32 147 261 322 320 250 253 254 259 321 117 108 305 276 280 285 77 291 1 224 221 92 273 180 214 100 184 99 212 95 279 93 179 211 187 281 282 88 87 205 286 82 194 203 226 149 235 157 144 231 230 248 249 227 350 106 132 172 128 257 173 121 174 263 115 151 3...

result:

ok good!

Subtask #5:

score: 15
Accepted

Dependency #4:

100%
Accepted

Test #96:

score: 15
Accepted
time: 5ms
memory: 6320kb

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

result:

ok good!

Test #97:

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

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

result:

ok good!

Test #98:

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

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

result:

ok good!

Test #99:

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

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

result:

ok good!

Test #100:

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

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 140 128 129 130 131 132 133 134 135 136 137 138 139 127 141 142 143 144 145 146 147 148 149 150 151 152 115 103 104 105 106 107 108 109 110 111 112 113 114 153 116 117 118 119 120 121 122 123 124 125 126 191 179 180 181 182 183 184 185 186 187 188 189 190 178 192 193 194 195 196 197 198 199 20...

result:

ok good!

Test #101:

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

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 2 1 10 9 8 7 6 5 4 3 160 148 159 158 157 156 155 154 153 152 151 150 149 175 161 162 163 164 165 166 167 168 169 170 171 172 174 121 134 173 122 123 124 125 126 127 128 129 130 131 132 133 147 135 136 137 138 139 140 141 142 143 144 145 146 217 204 205 206 207 208 209 210 211 212 213 214 215 ...

result:

ok good!

Test #102:

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

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 1828 1848 1829 1830 1831 1832 1833 1834 1835 1836 1837 
12 1 1842 1821 1822 1823 1824 1825 1826 1827 1838 1839 1840 
12 1 1814 1813 1815 1816 1817 1818 1819 1820 1841 1843 1844 
12 1 1850 1807 1808 1809 1810 1811 1812 1845 1846 1847 1849 
12 1 1853 1799 1800 1801 1802 1803 1804 1805 1806 18...

result:

ok good!

Test #103:

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

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 1943 1964 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1920 1931 2010 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1942 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 2000 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 ...

result:

ok good!

Test #104:

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

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

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 718 808 1429 774 163 214 713 1044 291 1294 920 120 1316 1319 1264 87 493 1062 1411 700 764 383 509 460 768 316 649 772 323 1112 242 743 453 1203 256 940 1028 963 749 909 447 923 133 925 130 1069 1117 364 956 536 515 579 373 948 1237 513 596 1284 677 835 1113 474 1377 234 405 28...

result:

ok good!

Test #106:

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

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 853 316 1313 1095 242 2052 835 46 1426 1104 1427 366 915 435 855 1271 1302 146 508 63 139 2218 148 522 2058 1027 608 2101 1658 2342 1130 1023 1999 103 1573 368 1446 762 1265 1449 770 2233 461 1117 1685 1214 482 100 132 95 488 1884 2350 232 88 1831 611 1494 746 37 420 1423 1...

result:

ok good!

Subtask #6:

score: 15
Accepted

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Dependency #3:

100%
Accepted

Dependency #4:

100%
Accepted

Dependency #5:

100%
Accepted

Test #107:

score: 15
Accepted
time: 40ms
memory: 32324kb

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: 15ms
memory: 6616kb

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

result:

ok good!

Test #109:

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

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

result:

ok good!

Test #110:

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

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

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

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 907 917 916 915 914 913 912 911 910 909 908 918 906 905 904 903 902 901 900 899 898 897 928 938 937 936 935 934 933 932 931 930 929 896 927 926 925 924 923 922 921 920 919 864 874 873 872 871 870 869 868 867 866 865 875 863 862 861 860 859 858 857 856 855 854 885 895 894 893 892 891 890 889 8...

result:

ok good!

Test #112:

score: 0
Accepted
time: 62ms
memory: 4800kb

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 673 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 657 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 642 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 689 643 644 645 646 647 648 649 650 651 652 653 654 655 656 736 721 722 723 724 725 726 727 728 729 ...

result:

ok good!

Test #113:

score: 0
Accepted
time: 633ms
memory: 41520kb

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 9279 9305 9280 9281 9282 9283 9284 9285 9286 9287 9288 9289 9290 9291 
15 1 9298 9271 9272 9273 9274 9275 9276 9277 9278 9292 9293 9294 9295 9296 
15 1 9261 9260 9262 9263 9264 9265 9266 9267 9268 9269 9270 9297 9299 9300 
15 1 9306 9251 9252 9253 9254 9255 9256 9257 9258 9259 9301 9302 93...

result:

ok good!

Test #114:

score: 0
Accepted
time: 154ms
memory: 14056kb

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 9877 9904 9878 9879 9880 9881 9882 9883 9884 9885 9886 9887 9888 9889 9890 9891 9892 9893 9894 9895 9896 9897 9898 9899 9900 9901 9902 9903 9848 9862 9962 9849 9850 9851 9852 9853 9854 9855 9856 9857 9858 9859 9860 9861 9876 9863 9864 9865 9866 9867 9868 9869 9870 9871 9872 9873 9874 987...

result:

ok good!

Test #115:

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

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: 6ms
memory: 4908kb

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

result:

ok good!

Test #117:

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

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

result:

ok good!

Extra Test:

score: 0
Extra Test Passed