QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#133491#4931. Comic BingewhsyhyyhAC ✓14ms43680kbC++141.1kb2023-08-02 10:05:482023-08-02 10:05:50

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-08-02 10:05:50]
  • 评测
  • 测评结果:AC
  • 用时:14ms
  • 内存:43680kb
  • [2023-08-02 10:05:48]
  • 提交

answer

#pragma GCC optimize("Ofast","unroll-loops","omit-frame-pointer","inline")
#pragma GCC option("arch=native","tune=native","no-zero-upper")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2")
#pragma GCC optimize(3)
#include<bits/stdc++.h>
#define N 1010
#define rep(i,l,r) for(int i=l;i<=r;i++)
#define drep(i,r,l) for(int i=r;i>=l;i--)
using namespace std;
int rd() {
	int res=0,f=1;char ch=getchar();
	while(ch<'0'||ch>'9') {if(ch=='-') f*=-1;ch=getchar();}
	while(ch>='0'&&ch<='9') res=(res<<1)+(res<<3)+(ch^48),ch=getchar();
	return res*f;
}
int n,a[N],b[N],dp[N][N*10];
int main() {
	n=rd();
	rep(i,1,n) a[i]=rd(),a[i]+=a[i-1];
	rep(i,1,n) b[i]=rd();
	memset(dp,-63,sizeof(dp));
	dp[1][b[1]]=0;
	rep(i,1,n) {
		rep(j,0,10*i) if(dp[i][j]>=0) {
			if(i+1<=n) dp[i+1][j+b[i+1]]=max(dp[i+1][j+b[i+1]],min(dp[i][j]+b[i+1],a[i]));
			if(i+2<=n) dp[i+2][j+b[i+2]]=max(dp[i+2][j+b[i+2]],min(dp[i][j]+b[i+2],a[i+1]));
//			cerr<<"Dp "<<i<<" "<<j<<' '<<dp[i][j]<<endl;
		}
	}
	int ans=0x3f3f3f3f;
	rep(i,0,10*n) ans=min(ans,i+a[n]-dp[n][i]);
	printf("%d",ans);
	return 0;
}

详细

Test #1:

score: 100
Accepted
time: 1ms
memory: 43504kb

input:

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

output:

13

result:

ok single line: '13'

Test #2:

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

input:

2
2 1
1 1

output:

4

result:

ok single line: '4'

Test #3:

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

input:

1
1
1

output:

2

result:

ok single line: '2'

Test #4:

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

input:

161
146 662 336 441 626 77 362 697 911 248 879 40 435 60 518 62 475 908 185 740 435 899 188 673 716 529 524 305 321 998 4 363 598 471 650 379 6 980 971 175 664 328 294 681 201 64 926 608 310 478 404 284 634 239 891 515 433 368 929 457 593 338 432 971 593 134 355 97 658 344 653 592 822 660 403 398 38...

output:

80587

result:

ok single line: '80587'

Test #5:

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

input:

747
4 609 179 580 613 171 82 687 882 977 720 609 967 329 508 803 301 837 550 416 931 416 521 937 268 723 878 33 372 426 2 94 248 979 319 576 859 644 459 365 445 668 337 572 881 775 946 901 992 405 377 896 967 66 792 686 676 232 245 539 217 774 167 747 923 722 295 483 454 195 494 206 779 536 845 438 ...

output:

375240

result:

ok single line: '375240'

Test #6:

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

input:

354
676 379 988 658 926 360 253 901 720 984 387 31 760 194 126 113 974 43 150 228 700 447 346 837 187 222 391 494 972 930 115 668 34 799 797 551 820 981 486 589 961 46 628 198 591 405 833 602 2 772 197 414 288 711 447 790 124 318 860 980 716 650 771 881 92 556 502 742 120 771 275 909 921 151 773 559...

output:

184280

result:

ok single line: '184280'

Test #7:

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

input:

156
694 378 780 513 491 607 610 145 213 697 477 891 113 224 322 540 285 990 445 645 931 94 182 774 402 508 616 113 947 516 134 756 918 118 82 357 481 83 455 152 210 53 348 227 455 455 866 792 956 687 519 588 871 987 609 464 350 916 195 337 414 427 523 398 45 597 146 933 601 768 226 834 838 793 327 9...

output:

77487

result:

ok single line: '77487'

Test #8:

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

input:

812
357 477 934 524 367 251 927 606 59 303 220 578 843 170 164 160 261 418 372 427 585 269 393 132 269 40 487 26 532 272 963 462 676 727 193 475 762 905 982 36 151 181 163 339 115 578 291 853 696 351 333 268 96 62 630 822 776 380 406 572 667 984 590 2 644 146 422 780 478 806 815 770 588 537 95 979 3...

output:

414612

result:

ok single line: '414612'

Test #9:

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

input:

705
328 774 704 230 336 856 105 491 393 233 552 967 124 923 819 717 498 541 235 368 593 883 794 774 328 768 702 507 428 41 965 559 771 848 357 508 18 742 658 473 198 560 122 47 932 311 1000 899 270 309 302 454 165 570 458 766 866 249 702 73 847 860 229 715 731 772 919 171 282 473 691 456 401 504 291...

output:

353599

result:

ok single line: '353599'

Test #10:

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

input:

429
527 713 657 567 171 120 386 718 780 707 301 116 345 562 205 336 759 459 240 423 271 105 491 159 192 87 230 193 927 853 803 25 269 432 700 801 365 101 426 228 706 728 806 648 264 564 174 172 440 795 252 142 804 135 169 796 327 370 194 313 34 279 584 325 781 341 818 697 689 241 763 326 444 777 115...

output:

206039

result:

ok single line: '206039'

Test #11:

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

input:

443
118 88 629 609 415 117 849 134 285 647 490 861 707 727 546 987 317 245 153 827 541 597 143 755 940 481 540 125 175 811 721 348 104 163 772 534 458 529 133 261 38 750 994 359 275 531 953 546 502 945 504 980 92 690 951 1 733 801 519 889 121 983 176 20 433 860 363 867 559 193 77 839 41 47 512 70 29...

output:

217481

result:

ok single line: '217481'

Test #12:

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

input:

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

101

result:

ok single line: '101'

Test #13:

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

input:

100
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
6 1 10 10 5 1 9 8 6 7 5 5 4 6 10 5 6 7 3 8 6 3 3 9 3 6 2 9 7 10 8 5 4 8 5 6 8 5 1 4 4 6 4 4 6 8 ...

output:

266

result:

ok single line: '266'

Test #14:

score: 0
Accepted
time: 9ms
memory: 43360kb

input:

2
10 1
1 10

output:

12

result:

ok single line: '12'

Test #15:

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

input:

100
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
10 3 5 1 2 9 4 8 6 10 2 9 2 1 10 7 9 3 2 1 3 10 7 3 3 5 1 5 8 10 2 5 4 8 3 3 2 6 2 6 2 1 10 9 8 ...

output:

214

result:

ok single line: '214'

Test #16:

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

input:

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

1001

result:

ok single line: '1001'

Test #17:

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

input:

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

2250

result:

ok single line: '2250'

Test #18:

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

input:

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

2399

result:

ok single line: '2399'

Test #19:

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

input:

100
2 2 8 3 7 6 6 4 1 10 9 2 10 3 7 1 10 6 8 3 7 10 4 4 1 3 1 9 5 4 5 2 4 10 1 1 2 8 2 10 1 2 7 4 1 6 2 4 1 6 8 10 9 3 2 8 7 6 7 10 3 4 6 10 5 10 2 8 10 1 7 3 10 1 2 2 8 4 5 7 10 4 7 5 2 5 1 1 2 9 8 7 1 4 5 6 6 6 9 4
5 2 1 8 3 1 1 2 10 1 7 3 1 8 1 10 3 9 8 6 4 6 6 10 9 6 9 8 5 10 8 1 3 1 2 6 10 1 7 ...

output:

520

result:

ok single line: '520'

Test #20:

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

input:

100
4 9 7 5 5 3 8 5 9 5 5 6 7 5 3 8 7 7 7 2 6 3 2 8 8 5 4 6 4 2 9 2 7 3 1 10 6 8 1 3 7 7 4 7 9 9 8 5 10 3 3 3 2 2 2 10 6 7 4 9 10 9 1 7 8 9 5 2 7 6 6 6 6 1 7 4 6 10 10 5 6 2 10 2 9 2 9 8 9 2 3 9 4 6 9 6 2 4 5 9
1 1 1 2 2 2 1 1 1 1 2 2 2 1 1 2 1 2 1 1 1 1 1 1 2 2 1 1 2 1 2 1 2 2 2 2 2 1 1 2 1 1 1 1 2...

output:

574

result:

ok single line: '574'

Test #21:

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

input:

100
9 6 1 1 1 6 6 1 5 4 10 10 4 10 4 10 9 2 7 6 1 3 1 6 6 2 4 6 8 4 7 5 1 8 1 9 9 6 2 10 6 3 10 10 10 7 9 1 9 2 10 2 1 9 9 8 5 6 1 2 6 7 2 9 1 6 5 7 4 2 9 8 4 10 9 3 1 8 10 10 1 3 3 6 1 8 10 2 1 2 4 4 7 7 4 7 1 4 3 9
10 8 9 8 10 9 10 10 9 9 8 9 10 9 9 10 8 9 9 8 10 9 9 9 9 8 8 8 10 9 10 9 10 9 8 9 9...

output:

556

result:

ok single line: '556'

Test #22:

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

input:

100
8 8 10 10 8 9 10 8 10 9 10 10 10 8 9 10 10 10 9 10 9 9 10 9 8 9 8 8 9 8 9 8 8 8 10 10 10 8 8 9 9 9 8 8 9 8 10 8 9 10 9 8 9 9 9 8 9 9 8 10 8 8 10 8 10 9 10 10 8 10 8 9 10 8 9 10 9 10 9 9 8 8 10 10 8 9 9 8 9 10 8 9 10 9 10 8 10 9 8 8
8 8 10 8 8 10 8 9 9 10 10 8 8 9 8 9 8 10 9 8 9 10 10 10 10 10 10...

output:

905

result:

ok single line: '905'

Test #23:

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

input:

100
9 9 9 10 9 10 9 10 9 10 10 10 9 10 10 10 10 9 10 10 9 9 10 9 10 10 9 9 10 10 9 9 9 9 10 10 10 10 10 10 9 9 9 10 9 9 9 10 10 9 10 10 9 10 10 10 9 10 10 10 9 10 9 9 10 10 9 10 10 9 10 10 9 10 10 10 10 9 10 9 10 10 9 9 10 10 9 10 9 9 10 9 9 9 9 9 10 10 10 9
10 9 10 10 10 10 9 10 10 10 9 10 9 10 10 ...

output:

965

result:

ok single line: '965'

Test #24:

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

input:

1000
6 5 5 1 1 5 7 2 4 2 1 3 8 8 2 5 8 7 3 10 6 7 6 6 2 6 5 7 9 9 10 8 1 7 2 3 7 5 1 5 8 10 6 1 7 9 7 6 6 10 2 7 3 3 5 1 4 7 8 9 7 1 4 3 10 7 7 10 9 5 10 2 2 7 4 2 1 10 2 9 6 1 6 8 5 4 8 1 3 6 5 8 10 3 6 6 7 1 8 3 5 3 5 2 5 9 9 6 4 8 9 3 1 3 3 8 9 3 10 8 3 8 3 1 8 8 4 1 3 8 3 1 4 1 9 6 5 5 2 8 4 3 4...

output:

5477

result:

ok single line: '5477'

Test #25:

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

input:

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

output:

8

result:

ok single line: '8'

Test #26:

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

input:

1000
8 8 9 9 9 9 9 10 8 10 9 8 9 9 8 8 8 9 9 10 8 9 9 8 9 10 10 9 10 9 8 9 8 10 8 8 9 8 10 9 8 10 8 10 9 10 9 10 9 9 8 9 10 8 10 8 8 10 8 9 10 10 10 8 10 10 10 8 8 10 9 10 10 10 9 8 9 9 9 8 8 8 10 9 8 10 8 8 9 8 9 10 8 8 10 8 9 10 8 10 8 9 9 9 8 10 8 9 10 10 8 10 10 8 8 10 9 9 8 9 10 9 8 8 9 9 8 9 9...

output:

8995

result:

ok single line: '8995'

Test #27:

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

input:

1000
9 9 9 10 9 9 10 10 9 10 10 10 10 10 9 10 10 9 10 10 10 9 9 10 9 10 9 9 9 9 9 10 10 9 10 10 9 10 10 10 10 9 10 9 10 10 9 9 10 10 9 9 9 10 9 9 9 9 9 10 9 10 9 9 10 9 9 10 9 9 9 9 10 10 10 9 9 9 9 10 10 9 10 9 10 10 10 9 10 10 9 9 10 10 10 9 10 9 9 10 9 9 9 10 10 10 10 10 9 9 9 10 9 9 10 10 9 10 1...

output:

9498

result:

ok single line: '9498'

Test #28:

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

input:

100
1 2 1 1 1 1 1 2 1 2 1 1 2 2 1 1 1 2 2 1 1 2 2 1 2 1 1 1 2 2 1 2 2 1 2 2 1 2 1 2 2 1 2 2 2 1 2 2 2 2 2 2 1 2 2 2 1 2 1 1 1 1 2 2 2 1 2 2 1 2 1 1 2 2 2 1 1 2 2 2 2 2 2 1 2 1 2 2 2 2 1 2 2 2 1 2 1 2 1 2
10 10 1 1 9 9 1 2 1 1 2 2 1 2 9 10 2 2 1 9 10 10 9 10 10 1 9 10 9 10 2 1 9 1 9 10 1 10 9 10 9 10...

output:

242

result:

ok single line: '242'

Test #29:

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

input:

100
2 2 1 1 1 1 2 2 1 2 1 2 2 1 2 2 2 2 1 2 1 2 1 1 1 1 2 2 1 2 1 2 2 2 2 1 2 1 1 1 1 1 2 2 2 2 2 2 1 2 1 2 2 2 2 1 2 2 2 1 1 1 1 1 2 1 1 2 2 1 1 2 2 1 1 1 2 2 2 2 1 1 2 2 1 1 2 1 2 1 2 2 1 1 1 2 2 1 2 1
1 2 9 2 2 2 9 1 2 9 2 9 10 2 9 2 9 2 2 9 1 2 1 9 1 9 1 10 9 10 10 1 1 10 1 9 10 2 9 9 1 10 10 2 ...

output:

174

result:

ok single line: '174'

Test #30:

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

input:

100
2 6 1 5 2 3 7 9 7 9 3 4 3 1 5 9 5 8 10 7 7 8 4 8 8 7 5 8 6 7 7 5 4 5 6 7 2 8 9 9 10 5 10 1 1 9 9 10 9 5 2 6 8 9 1 10 9 3 9 2 10 2 5 4 5 9 5 8 6 6 9 8 9 9 1 6 7 1 7 9 7 5 8 7 8 3 2 8 8 9 9 1 1 9 4 7 3 7 1 7
9 9 10 1 2 1 10 1 9 1 2 10 10 1 10 2 9 9 2 9 1 9 10 10 9 9 9 9 2 10 9 9 2 1 2 1 10 9 1 2 1...

output:

615

result:

ok single line: '615'

Test #31:

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

input:

100
1 1 1 9 4 9 9 9 6 9 1 1 9 8 2 4 4 2 1 10 10 7 1 9 9 2 2 3 3 5 3 6 2 5 2 3 9 1 5 1 4 7 3 7 10 6 6 2 4 4 2 10 10 6 3 6 1 10 7 10 3 7 2 5 7 3 5 4 2 4 6 4 7 7 7 3 3 3 6 4 4 3 10 9 5 1 6 7 6 9 10 5 9 2 10 3 3 8 5 4
2 10 10 1 9 2 9 2 10 9 10 2 2 2 9 1 10 10 10 2 1 10 2 1 2 10 10 10 2 1 2 1 1 1 1 1 10 ...

output:

527

result:

ok single line: '527'

Test #32:

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

input:

100
8 8 8 10 9 10 10 9 8 9 10 9 8 10 9 8 8 8 10 9 9 9 10 9 8 10 8 8 10 10 9 9 8 8 10 10 8 8 8 10 9 10 9 8 8 8 10 9 9 10 10 9 9 9 10 10 9 10 10 9 9 9 9 9 9 9 10 8 8 8 8 9 9 10 10 9 10 8 10 10 10 10 10 10 9 8 10 9 8 8 10 9 10 10 10 9 9 10 10 8
1 1 9 10 2 2 10 10 9 1 9 2 10 1 10 1 9 10 1 1 9 9 10 9 10 ...

output:

911

result:

ok single line: '911'

Test #33:

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

input:

100
65 17 97 52 86 2 30 43 62 77 46 15 59 56 57 76 74 70 33 18 44 95 58 80 1 19 28 79 49 26 19 91 72 85 11 64 73 66 83 8 69 34 92 89 72 32 23 30 83 46 25 19 84 88 59 79 52 14 58 33 40 15 28 39 47 66 14 27 62 77 55 97 68 62 64 34 93 74 52 27 2 89 89 77 13 43 73 74 20 1 13 79 96 75 4 38 4 7 45 44
9 1 ...

output:

5103

result:

ok single line: '5103'

Test #34:

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

input:

1000
125 857 402 260 104 401 653 173 791 597 474 872 66 478 613 90 240 186 381 242 193 360 641 894 819 346 859 44 772 320 547 751 556 189 204 505 16 598 560 852 698 880 397 297 643 913 325 765 353 340 380 873 847 1 204 149 968 449 261 93 491 117 257 438 478 742 400 149 375 875 300 651 22 908 808 980...

output:

494282

result:

ok single line: '494282'

Test #35:

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

input:

1000
999 1000 1000 1000 1000 999 999 1000 999 1000 1000 1000 1000 1000 999 1000 1000 1000 999 999 1000 999 999 1000 1000 999 1000 999 1000 999 1000 999 1000 999 999 1000 999 1000 999 999 1000 999 1000 999 1000 999 1000 1000 999 999 1000 999 1000 1000 1000 999 1000 1000 1000 999 999 1000 999 1000 100...

output:

999516

result:

ok single line: '999516'

Test #36:

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

input:

99
1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1
10 9 10 9 10 9 10 9 10 9 10 9 10 9 10 9 10 9 10 9 10 9 10 9 10 9 10 9 10 9 10 9 10 9 10 9 10 9 10 9...

output:

501

result:

ok single line: '501'

Test #37:

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

input:

1000
999 1000 999 999 999 999 1000 1000 999 1000 999 999 999 999 999 999 1000 1000 1000 999 1000 1000 999 999 1000 999 1000 999 1000 1000 999 1000 1000 999 1000 999 999 999 1000 1000 1000 999 999 1000 999 999 1000 999 1000 1000 999 1000 999 999 999 1000 999 999 999 999 1000 1000 999 999 1000 1000 99...

output:

999488

result:

ok single line: '999488'

Test #38:

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

input:

1000
1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 ...

output:

1000010

result:

ok single line: '1000010'

Test #39:

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

input:

1000
967 264 726 68 922 52 551 717 557 437 792 927 304 302 430 342 577 466 63 813 484 174 307 971 85 772 250 102 991 191 730 117 692 372 408 982 775 329 838 790 87 882 353 734 895 744 424 284 510 728 169 341 90 931 952 21 211 347 136 971 790 802 88 891 153 305 857 313 888 352 654 958 670 603 162 406...

output:

495497

result:

ok single line: '495497'

Test #40:

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

input:

1000
239 882 426 27 851 973 508 357 855 626 869 76 551 302 844 113 441 755 880 828 151 295 393 501 924 808 194 958 756 602 398 719 789 480 311 867 489 803 95 157 536 350 232 235 190 805 234 69 755 360 491 434 135 99 480 104 935 746 905 727 140 429 492 665 497 874 753 802 538 519 104 56 970 400 915 9...

output:

492204

result:

ok single line: '492204'

Test #41:

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

input:

100
1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9
10 9 10 9 10 9 10 9 10 9 10 9 10 9 10 9 10 9 10 9 10 9 10 9 10 9 10 9 10 9 10 9 10 9 10 9 10 9 1...

output:

518

result:

ok single line: '518'

Test #42:

score: 0
Accepted
time: 11ms
memory: 43512kb

input:

999
1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 ...

output:

5001

result:

ok single line: '5001'

Test #43:

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

input:

1000
1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9...

output:

5018

result:

ok single line: '5018'

Test #44:

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

input:

549
593 716 845 603 858 545 848 424 624 646 385 438 298 892 57 964 273 384 478 792 813 529 480 569 393 926 837 72 338 88 649 21 369 833 958 779 141 871 871 979 474 800 801 462 521 781 679 119 721 640 583 144 538 945 759 522 106 415 474 265 187 775 737 457 217 569 136 19 325 618 150 613 223 617 387 9...

output:

278773

result:

ok single line: '278773'

Test #45:

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

input:

30
791 920 98 543 443 992 520 384 694 807 91 462 228 827 411 540 624 888 887 881 619 329 134 405 981 545 872 622 503 380
10 6 6 2 10 7 9 3 10 1 10 2 1 2 2 4 4 3 10 6 4 10 2 6 9 6 5 3 10 6

output:

17431

result:

ok single line: '17431'