QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#412020#8350. ddttzhouhuanyi100 ✓3292ms374660kbC++142.2kb2024-05-15 23:09:392024-05-15 23:09:39

Judging History

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

  • [2024-05-15 23:09:39]
  • 评测
  • 测评结果:100
  • 用时:3292ms
  • 内存:374660kb
  • [2024-05-15 23:09:39]
  • 提交

answer

#include<iostream>
#include<cstdio>
#define N 18
#define inf 1e9
using namespace std;
int read()
{
    char c=0;
    int sum=0,f=1;
    while ((c<'0'||c>'9')&&c!='-') c=getchar();
    if (c=='-') c=getchar(),f=-1;
    while ('0'<=c&&c<='9') sum=sum*10+c-'0',c=getchar();
    return sum*f;
}
int n,dp[1<<N],S[1<<N][N+1][N+1],c[N+1][N+1],a[N+1][N+1],ans;
void Adder(int &x,int d)
{
    if (d<x) x=d;
    return;
}
int main()
{
    int d,res;
    n=read();
    for (int i=1;i<=n;++i)
	for (int j=1;j<=n;++j)
	    c[i][j]=read();
    for (int i=1;i<=n;++i)
	for (int j=i;j<=n;++j)
	{
	    d=min(c[i][j],c[j][i]);
	    if (c[i][j]==-1&&c[j][i]==-1) a[i][j]=a[j][i]=-1;
	    else if (c[i][j]!=-1&&c[j][i]==-1) ans+=c[i][j],a[i][j]=0,a[j][i]=-1;
	    else if (c[i][j]==-1&&c[j][i]!=-1) ans+=c[j][i],a[i][j]=-1,a[j][i]=0;
	    else ans+=d,a[i][j]=c[i][j]-d,a[j][i]=c[j][i]-d;
	}
    for (int i=0;i<(1<<n);++i) dp[i]=inf;
    for (int i=0;i<(1<<n);++i)
	for (int j=1;j<=n;++j)
	    for (int k=1;k<=n;++k)
		S[i][j][k]=inf;
    for (int i=1;i<=n;++i) dp[1<<(i-1)]=0;
    for (int i=0;i<(1<<n);++i)
    {
	for (int j=1;j<=n;++j)
	    if (i&(1<<(j-1)))
		for (int k=1;k<=n;++k)
		    if ((i&(1<<(k-1)))&&a[k][j]!=-1)
			Adder(dp[i],S[i][j][k]+a[k][j]);
	for (int j=1;j<=n;++j)
	    if (!(i&(1<<(j-1))))
		for (int k=1;k<=n;++k)
		    if (!(i&(1<<(k-1)))&&a[j][k]!=-1)
		    {
			res=inf;
	                for (int t=1;t<=n;++t)
			    if (i&(1<<(t-1))&&a[t][j]!=-1)
				Adder(res,dp[i]+a[t][j]+a[j][k]);
			for (int t=1;t<=n;++t)
			    if (i&(1<<(t-1)))
				Adder(S[i|(1<<(j-1))|(1<<(k-1))][t][k],res);
		    }
	for (int j=1;j<=n;++j)
	    if (i&(1<<(j-1)))
		for (int k=1;k<=n;++k)
		    if ((!(i&(1<<(k-1))))&&a[j][k]!=-1)
			for (int t=1;t<=n;++t)
			    if ((i&(1<<(t-1)))&&j!=t&&a[k][t]!=-1)
				Adder(dp[i|(1<<(k-1))],dp[i]+a[j][k]+a[k][t]);
	for (int j=1;j<=n;++j)
	    if (i&(1<<(j-1)))
		for (int k=1;k<=n;++k)
		    if (i&(1<<(k-1)))
			for (int t=1;t<=n;++t)
			    if ((!(i&(1<<(t-1))))&&a[k][t]!=-1)
				Adder(S[i|(1<<(t-1))][j][t],S[i][j][k]+a[k][t]);
    }
    printf("%d\n",(dp[(1<<n)-1]==inf)?-1:dp[(1<<n)-1]+ans);
    return 0;
}


詳細信息

Subtask #1:

score: 30
Accepted

Test #1:

score: 30
Accepted
time: 1ms
memory: 3972kb

input:

7
-1 906428 -1 84766 -1 743156 -1
204845 -1 -1 -1 -1 -1 -1
-1 -1 -1 953332 816787 -1 50028
462176 -1 603571 -1 -1 187115 -1
-1 -1 12902 -1 -1 69357 693804
541471 -1 -1 7517 176092 -1 413082
-1 -1 200967 -1 775265 768748 -1

output:

-1

result:

ok 1 number(s): "-1"

Test #2:

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

input:

7
-1 -1 166333 670684 -1 379383 -1
-1 -1 -1 496229 -1 84571 -1
724553 -1 -1 72631 129265 -1 -1
947705 791858 558899 -1 774470 67590 -1
-1 -1 879458 972639 -1 155642 -1
492804 276518 -1 354323 429007 -1 -1
-1 -1 -1 -1 -1 -1 -1

output:

-1

result:

ok 1 number(s): "-1"

Test #3:

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

input:

7
-1 -1 947607 492771 527058 335808 182793
-1 -1 -1 -1 -1 541712 189882
365368 -1 -1 -1 124012 -1 990701
171564 -1 -1 -1 -1 742467 17394
413543 -1 468342 -1 -1 71495 515425
276997 180182 -1 691921 805287 -1 412715
294141 696459 254387 358545 925257 485133 -1

output:

3867678

result:

ok 1 number(s): "3867678"

Test #4:

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

input:

7
-1 -1 297967 -1 343944 -1 201437
-1 -1 132100 71343 58104 -1 13352
415106 278114 -1 -1 317567 174426 636513
-1 98774 -1 -1 89623 -1 651800
989490 816655 375146 700942 -1 -1 68246
-1 -1 678938 -1 -1 -1 895635
333523 196644 877042 868384 786886 994219 -1

output:

4230157

result:

ok 1 number(s): "4230157"

Test #5:

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

input:

7
-1 495692 805865 894329 -1 719004 35504
618653 -1 556798 990233 -1 991851 175853
631208 243006 -1 700289 680633 -1 420118
614779 37034 872777 -1 888196 163258 362337
-1 -1 622406 29948 -1 543626 715326
569913 409206 -1 130151 836841 -1 403053
966066 11565 780582 760724 888714 147150 -1

output:

7015607

result:

ok 1 number(s): "7015607"

Test #6:

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

input:

7
-1 372330 376608 31840 407761 -1 145008
752118 -1 371324 665195 117351 187303 183963
542460 424631 -1 -1 -1 534216 462490
115946 852778 -1 -1 384547 638533 352990
667437 675291 -1 414860 -1 436020 218710
-1 485890 835192 822237 551203 -1 392985
441017 834546 521499 458773 690977 890800 -1

output:

6469063

result:

ok 1 number(s): "6469063"

Test #7:

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

input:

7
-1 317553 782864 291391 427301 28775 279432
486206 -1 327059 837592 489433 478469 624180
966017 642808 -1 455131 165893 722667 418292
789857 957229 892823 -1 169251 393403 36623
472980 983749 526071 235121 -1 42610 249165
160371 563897 888787 791283 115437 -1 294905
368393 631771 421104 850768 542...

output:

7880480

result:

ok 1 number(s): "7880480"

Test #8:

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

input:

7
-1 18243 359691 422549 176032 715973 25085
422768 -1 580850 633919 1907 68511 293063
880315 718038 -1 249059 184012 976111 331818
670347 777630 824350 -1 71811 348346 211803
463192 775587 579669 352357 -1 150658 75404
733964 586742 977648 747131 782893 -1 454307
210958 356320 432184 650703 256268 ...

output:

6430400

result:

ok 1 number(s): "6430400"

Test #9:

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

input:

7
-1 20153 964564 773479 518004 131291 603410
548780 -1 212046 216102 810898 973599 550318
694643 483146 -1 192934 662479 219420 972144
996402 730830 929836 -1 558048 785067 37347
413208 450787 735403 443823 -1 799110 907234
909082 110500 853948 445525 708764 -1 710081
824683 710499 363954 798279 12...

output:

7469617

result:

ok 1 number(s): "7469617"

Test #10:

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

input:

7
-1 789815 458567 404639 589035 550177 18476
167909 -1 605791 121011 605463 -1 913474
709323 90742 -1 410338 135032 567361 944045
828591 894594 968559 -1 212171 258817 593202
432096 699224 157227 998777 -1 660492 184875
516826 -1 781031 381100 752855 -1 -1
666466 189515 85670 491078 305606 -1 -1

output:

6011078

result:

ok 1 number(s): "6011078"

Test #11:

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

input:

7
-1 -1 838012 -1 551318 -1 887747
-1 -1 -1 183553 955789 -1 96285
126041 -1 -1 -1 719043 36660 467106
-1 316557 -1 -1 896608 32621 658093
710189 574474 994542 437943 -1 944877 149014
-1 -1 694144 634754 115076 -1 218101
424407 420598 831616 524581 789149 545455 -1

output:

4931722

result:

ok 1 number(s): "4931722"

Test #12:

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

input:

7
-1 -1 823474 -1 922154 960228 -1
-1 -1 -1 971578 -1 156628 983118
35475 -1 -1 944622 104031 -1 783294
-1 887811 422746 -1 -1 -1 413192
925719 -1 507093 -1 -1 934368 260419
59766 163427 -1 -1 579257 -1 942363
-1 997119 537239 332727 413945 763103 -1

output:

6044474

result:

ok 1 number(s): "6044474"

Test #13:

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

input:

7
-1 256228 -1 -1 517155 53342 269531
832749 -1 606651 -1 798270 290781 968862
-1 214957 -1 -1 931590 -1 491409
-1 -1 -1 -1 144263 -1 -1
371876 421563 129025 681008 -1 -1 246085
676962 832146 -1 -1 -1 -1 -1
747634 418195 775160 -1 614432 -1 -1

output:

-1

result:

ok 1 number(s): "-1"

Test #14:

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

input:

7
-1 597220 553068 836719 254659 433878 -1
874823 -1 373519 49064 -1 73718 323150
906025 942887 -1 430588 308543 137749 313689
962683 111854 996646 -1 49110 336072 340173
436306 -1 608794 979657 -1 363135 508561
725902 262097 258580 461658 833661 -1 177426
-1 374037 357093 416694 597237 762688 -1

output:

6629409

result:

ok 1 number(s): "6629409"

Test #15:

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

input:

7
-1 230343 -1 -1 457069 -1 39627
422579 -1 528669 40333 184354 575576 721412
-1 735704 -1 756341 277403 666912 861490
-1 724595 831350 -1 674113 248640 327723
697506 606580 348168 723799 -1 533263 -1
-1 625767 946497 950266 571302 -1 532107
509836 943703 904317 641886 -1 980264 -1

output:

7938639

result:

ok 1 number(s): "7938639"

Subtask #2:

score: 30
Accepted

Dependency #1:

100%
Accepted

Test #16:

score: 30
Accepted
time: 19ms
memory: 11684kb

input:

12
-1 -1 16732 -1 846962 -1 880186 -1 -1 -1 901682 190791
-1 -1 -1 -1 -1 871808 -1 -1 -1 552632 985928 985560
389565 -1 -1 -1 -1 -1 -1 -1 687744 -1 -1 -1
-1 -1 -1 -1 752250 -1 733184 -1 733443 -1 -1 -1
168390 -1 -1 577829 -1 -1 87284 -1 595022 182572 -1 -1
-1 857513 -1 -1 -1 -1 4010 -1 -1 936069 -1 ...

output:

13327371

result:

ok 1 number(s): "13327371"

Test #17:

score: 0
Accepted
time: 18ms
memory: 11760kb

input:

12
-1 -1 159331 -1 356338 -1 -1 -1 156241 -1 -1 -1
-1 -1 -1 186715 449147 -1 631229 -1 -1 464596 352158 -1
828684 -1 -1 -1 -1 635492 -1 461646 31536 -1 -1 390514
-1 926555 -1 -1 45469 53094 -1 196761 722 617359 -1 -1
408111 943697 -1 388763 -1 -1 863391 94740 -1 -1 -1 -1
-1 -1 762719 133586 -1 -1 -1...

output:

11153624

result:

ok 1 number(s): "11153624"

Test #18:

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

input:

12
-1 -1 -1 -1 -1 -1 -1 -1 190399 642970 992023 -1
-1 -1 -1 -1 -1 975217 -1 595999 -1 -1 -1 984909
-1 -1 -1 -1 236874 -1 588799 -1 -1 -1 -1 823861
-1 -1 -1 -1 585291 745083 728465 125247 550766 -1 752268 -1
-1 -1 497547 120522 -1 -1 561829 -1 -1 -1 -1 -1
-1 367176 -1 141216 -1 -1 545065 350736 -1 -1...

output:

-1

result:

ok 1 number(s): "-1"

Test #19:

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

input:

12
-1 -1 133814 -1 -1 -1 385526 -1 -1 258614 -1 -1
-1 -1 -1 -1 -1 734400 -1 53597 401086 -1 376210 -1
702783 -1 -1 518570 -1 -1 531237 -1 88207 176954 -1 -1
-1 -1 537127 -1 -1 -1 -1 -1 -1 -1 -1 -1
-1 -1 -1 -1 -1 468361 -1 -1 -1 554927 -1 -1
-1 908407 -1 -1 557982 -1 486968 -1 -1 418344 -1 -1
947865 ...

output:

-1

result:

ok 1 number(s): "-1"

Test #20:

score: 0
Accepted
time: 16ms
memory: 13612kb

input:

12
-1 850256 601293 -1 -1 -1 -1 -1 -1 -1 -1 -1
880611 -1 515813 -1 456660 697315 -1 -1 -1 387488 45807 125808
530932 483952 -1 -1 -1 535990 161632 -1 -1 -1 -1 949801
-1 -1 -1 -1 -1 820742 -1 -1 -1 -1 -1 2148
-1 391161 -1 -1 -1 -1 -1 -1 -1 476590 135563 226165
-1 561657 822967 736899 -1 -1 -1 -1 2855...

output:

-1

result:

ok 1 number(s): "-1"

Test #21:

score: 0
Accepted
time: 17ms
memory: 11988kb

input:

12
-1 -1 -1 973829 239381 -1 -1 99587 490903 -1 -1 66096
-1 -1 -1 118506 -1 -1 -1 373669 -1 -1 358492 -1
-1 -1 -1 192353 290290 -1 -1 -1 -1 -1 349057 -1
975415 618646 451199 -1 -1 -1 -1 -1 -1 482837 -1 62895
867019 -1 393884 -1 -1 -1 -1 -1 -1 827949 -1 -1
-1 -1 -1 -1 -1 -1 245208 28800 404369 -1 129...

output:

8120020

result:

ok 1 number(s): "8120020"

Test #22:

score: 0
Accepted
time: 19ms
memory: 10492kb

input:

12
-1 556655 -1 457776 472810 32551 -1 36258 -1 828359 -1 645437
288902 -1 -1 -1 650028 173545 -1 -1 40082 463599 839562 545543
-1 -1 -1 -1 -1 -1 -1 466142 -1 701989 -1 -1
220611 -1 -1 -1 -1 -1 121022 -1 -1 -1 545471 -1
346588 903031 -1 -1 -1 -1 583995 170828 359676 -1 992215 294036
506190 737694 -1...

output:

11793270

result:

ok 1 number(s): "11793270"

Test #23:

score: 0
Accepted
time: 16ms
memory: 10784kb

input:

12
-1 -1 115589 -1 -1 31425 -1 412727 62871 609773 619149 -1
-1 -1 345355 -1 792758 675434 125959 116579 -1 6547 -1 457976
588697 952930 -1 450080 85525 -1 -1 -1 181495 -1 -1 761147
-1 -1 884605 -1 -1 661119 694379 -1 -1 249618 111985 -1
-1 976148 736645 -1 -1 -1 187944 391076 -1 -1 -1 -1
308235 786...

output:

11891096

result:

ok 1 number(s): "11891096"

Test #24:

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

input:

12
-1 -1 841757 891987 950034 676522 445565 689011 90902 250523 -1 365730
-1 -1 808768 967243 -1 776203 173682 -1 -1 53611 769315 -1
436441 703925 -1 -1 258387 331421 733269 586841 -1 761134 -1 45708
696847 762634 -1 -1 -1 15710 596230 -1 -1 -1 -1 648840
444848 -1 685887 -1 -1 9385 104883 -1 -1 9110...

output:

12527120

result:

ok 1 number(s): "12527120"

Test #25:

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

input:

12
-1 -1 11180 822993 53204 65270 256375 46483 -1 319626 28080 -1
-1 -1 -1 -1 538317 120082 303878 -1 15828 86903 -1 238107
543754 -1 -1 -1 571158 -1 -1 621754 98913 83417 85816 628880
940463 -1 -1 -1 -1 514234 82112 95406 -1 261332 557968 -1
349264 991533 724354 -1 -1 -1 526628 333180 -1 144567 468...

output:

12331190

result:

ok 1 number(s): "12331190"

Test #26:

score: 0
Accepted
time: 22ms
memory: 11824kb

input:

12
-1 489634 367250 484912 706593 860264 -1 -1 793654 725982 981378 250974
172953 -1 832767 -1 59685 -1 451218 404148 -1 -1 23987 402234
702143 147040 -1 39612 94571 829600 526667 -1 997801 -1 353205 -1
182201 -1 796871 -1 744533 -1 538245 890531 -1 -1 513672 783811
209422 741743 257222 719939 -1 -1...

output:

11495798

result:

ok 1 number(s): "11495798"

Test #27:

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

input:

12
-1 167138 -1 336507 -1 669931 -1 449103 134598 120908 525143 -1
450210 -1 271313 255454 395681 -1 464756 29551 363119 301081 651658 -1
-1 342996 -1 826690 67311 305146 773879 -1 -1 129158 -1 725909
658783 995297 983123 -1 564508 115685 1988 544480 169595 -1 120516 -1
-1 987678 784581 667265 -1 24...

output:

15350744

result:

ok 1 number(s): "15350744"

Test #28:

score: 0
Accepted
time: 18ms
memory: 11600kb

input:

12
-1 556752 807464 -1 944367 907508 221385 326949 812483 928600 804092 938598
63512 -1 215516 740465 -1 556001 221783 -1 -1 -1 626632 -1
792458 262780 -1 595199 330749 -1 393599 448781 280400 280395 -1 660137
-1 965212 286968 -1 160859 -1 638212 466733 563662 963514 -1 421809
227793 -1 852459 82626...

output:

17776563

result:

ok 1 number(s): "17776563"

Test #29:

score: 0
Accepted
time: 22ms
memory: 10388kb

input:

12
-1 467828 132631 -1 -1 842105 52397 482921 542565 310058 263148 -1
590524 -1 134268 -1 8675 -1 175655 41277 367521 563262 12188 487359
609906 959135 -1 637342 289908 139568 -1 117371 173541 465959 176208 369166
-1 -1 923113 -1 72614 813172 -1 565330 8756 211818 -1 824041
-1 432905 875655 823467 -...

output:

16445540

result:

ok 1 number(s): "16445540"

Test #30:

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

input:

12
-1 285726 -1 511994 894856 308275 88995 761002 196336 959622 187262 307737
417215 -1 74319 88913 807915 -1 112307 119272 -1 898316 314779 519649
-1 280185 -1 484750 660934 836222 -1 393177 595130 835989 443353 63401
432515 910406 395922 -1 48351 81570 962026 812977 69187 360956 339900 338470
1595...

output:

17629233

result:

ok 1 number(s): "17629233"

Test #31:

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

input:

12
-1 777850 148340 215679 159799 59906 811155 108102 365103 264712 123536 120552
787428 -1 496359 591112 676948 71098 149442 385372 705440 538025 -1 -1
166162 915300 -1 567914 364656 -1 527237 828469 708099 610151 201547 -1
644988 621991 920291 -1 189424 103224 97291 -1 842616 519584 369358 137421
...

output:

22457508

result:

ok 1 number(s): "22457508"

Test #32:

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

input:

12
-1 156422 550761 125407 112639 760155 363205 335149 18377 106689 302328 29566
871706 -1 80643 235519 491262 564803 304568 17136 716710 190581 711868 555623
907021 781506 -1 347252 787549 135936 131423 36930 151872 803937 678156 148738
179083 376819 896079 -1 392448 700778 531835 274157 246953 214...

output:

20763756

result:

ok 1 number(s): "20763756"

Test #33:

score: 0
Accepted
time: 17ms
memory: 13664kb

input:

12
-1 -1 -1 -1 -1 391676 724884 714717 281121 -1 121644 534656
-1 -1 -1 -1 -1 -1 -1 706170 -1 -1 671056 -1
-1 -1 -1 481821 -1 -1 -1 -1 -1 483623 -1 978166
-1 -1 736902 -1 -1 906786 -1 -1 40087 -1 78467 283944
-1 -1 -1 -1 -1 195979 -1 -1 -1 -1 -1 610373
125934 -1 -1 768869 715863 -1 696632 -1 -1 -1 1...

output:

10992827

result:

ok 1 number(s): "10992827"

Test #34:

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

input:

12
-1 392681 -1 258996 -1 -1 -1 -1 -1 510086 -1 -1
880000 -1 -1 -1 -1 146197 535841 456095 186522 32158 -1 -1
-1 -1 -1 166228 142419 -1 538516 -1 473369 382559 -1 87904
713256 -1 270538 -1 149044 681334 185965 -1 857410 328424 385184 743238
-1 -1 526263 280244 -1 866023 -1 -1 714043 -1 65095 29916
-...

output:

12660572

result:

ok 1 number(s): "12660572"

Test #35:

score: 0
Accepted
time: 16ms
memory: 11616kb

input:

12
-1 339276 159035 -1 449378 -1 -1 -1 -1 -1 296509 -1
174445 -1 -1 -1 247402 -1 182350 127458 681457 -1 -1 -1
896475 -1 -1 -1 857841 -1 -1 326202 -1 -1 265551 -1
-1 -1 -1 -1 -1 631104 -1 -1 792880 788380 -1 232824
638383 567300 985588 -1 -1 254835 -1 -1 -1 -1 361041 -1
-1 -1 -1 115796 536194 -1 -1 ...

output:

7281059

result:

ok 1 number(s): "7281059"

Test #36:

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

input:

12
-1 -1 123908 70121 -1 150172 258142 447350 -1 694831 620812 -1
-1 -1 408317 -1 787129 161754 211969 -1 593507 -1 -1 763094
859124 864948 -1 -1 -1 88995 -1 580013 62616 848034 763481 191093
845283 -1 -1 -1 -1 247140 107141 390260 -1 -1 615814 157450
-1 831502 -1 -1 -1 -1 -1 268318 16665 -1 552828 ...

output:

13457017

result:

ok 1 number(s): "13457017"

Test #37:

score: 0
Accepted
time: 18ms
memory: 10464kb

input:

12
-1 -1 -1 -1 754562 935747 -1 -1 502807 778485 531167 -1
-1 -1 -1 -1 -1 798623 701840 629891 -1 912568 502555 -1
-1 -1 -1 -1 939591 227745 414571 -1 -1 883565 -1 194771
-1 -1 -1 -1 799868 -1 -1 410591 885509 424011 657976 -1
864345 -1 324467 832584 -1 860215 -1 988415 -1 -1 817550 -1
374521 21682 ...

output:

10425799

result:

ok 1 number(s): "10425799"

Test #38:

score: 0
Accepted
time: 16ms
memory: 11876kb

input:

12
-1 -1 616927 125533 -1 108110 -1 183131 52782 163249 521631 -1
-1 -1 530297 832844 75429 -1 -1 -1 165410 53663 -1 648841
758088 657512 -1 277399 -1 -1 -1 -1 51869 -1 -1 -1
746957 897463 352874 -1 94822 343348 -1 -1 309633 -1 351326 175490
-1 305333 -1 495207 -1 730643 -1 376472 -1 -1 516211 29038...

output:

10730418

result:

ok 1 number(s): "10730418"

Subtask #3:

score: 20
Accepted

Dependency #2:

100%
Accepted

Test #39:

score: 20
Accepted
time: 502ms
memory: 98496kb

input:

16
-1 456019 -1 674195 926692 -1 -1 315508 -1 -1 -1 -1 -1 297855 -1 -1
372068 -1 -1 769976 846830 246013 756175 -1 415702 596070 -1 -1 -1 243090 -1 -1
-1 -1 -1 429903 -1 111230 15365 -1 -1 709361 -1 -1 538407 288402 -1 615448
327647 795365 917017 -1 -1 476646 -1 -1 -1 -1 -1 12829 -1 -1 -1 58916
2344...

output:

17249685

result:

ok 1 number(s): "17249685"

Test #40:

score: 0
Accepted
time: 496ms
memory: 96688kb

input:

16
-1 -1 -1 -1 -1 664795 54836 240701 -1 409692 66405 -1 -1 358122 202449 -1
-1 -1 29984 -1 -1 -1 9874 884345 521111 386597 -1 630341 34654 699999 77407 446
-1 78935 -1 -1 193449 136918 -1 35721 -1 336965 -1 -1 380394 -1 -1 -1
-1 -1 -1 -1 167458 553777 -1 -1 92694 -1 -1 -1 134785 -1 233662 -1
-1 -1 ...

output:

14640564

result:

ok 1 number(s): "14640564"

Test #41:

score: 0
Accepted
time: 419ms
memory: 98488kb

input:

16
-1 -1 -1 -1 -1 -1 -1 -1 998989 -1 -1 -1 -1 374123 -1 -1
-1 -1 -1 -1 -1 -1 843401 153836 -1 619505 372707 7296 -1 -1 -1 -1
-1 -1 -1 811682 -1 748280 840563 44159 742557 -1 -1 -1 -1 243223 -1 367722
-1 -1 678089 -1 -1 -1 994015 474165 -1 362459 -1 -1 890554 594341 -1 319818
-1 -1 -1 -1 -1 -1 307858...

output:

15174290

result:

ok 1 number(s): "15174290"

Test #42:

score: 0
Accepted
time: 418ms
memory: 99328kb

input:

16
-1 -1 -1 -1 -1 27044 -1 -1 -1 -1 889920 -1 99447 124670 143699 563583
-1 -1 -1 -1 -1 146007 -1 -1 -1 680017 429804 -1 -1 -1 -1 -1
-1 -1 -1 324841 -1 -1 -1 -1 695236 101633 -1 -1 17850 -1 206436 -1
-1 -1 742575 -1 -1 -1 -1 -1 349256 99686 294940 385136 -1 -1 29486 -1
-1 -1 -1 -1 -1 496749 269965 -...

output:

-1

result:

ok 1 number(s): "-1"

Test #43:

score: 0
Accepted
time: 502ms
memory: 98416kb

input:

16
-1 -1 59046 -1 -1 366831 77437 -1 -1 -1 -1 -1 370680 -1 910140 176181
-1 -1 -1 582492 13347 -1 -1 513522 -1 -1 581568 -1 -1 254447 15932 -1
899724 -1 -1 -1 723535 -1 -1 -1 -1 -1 884463 -1 550604 -1 -1 -1
-1 226528 -1 -1 -1 362795 893803 365501 -1 484331 -1 -1 -1 -1 582131 -1
-1 102705 172959 -1 -...

output:

14853810

result:

ok 1 number(s): "14853810"

Test #44:

score: 0
Accepted
time: 493ms
memory: 98504kb

input:

16
-1 14627 -1 -1 90916 -1 -1 -1 172659 -1 454199 14514 -1 3679 185491 -1
877150 -1 -1 -1 93119 -1 739792 -1 -1 -1 -1 -1 215453 -1 -1 -1
-1 -1 -1 -1 -1 -1 -1 -1 112752 -1 -1 -1 77313 -1 260731 -1
-1 -1 -1 -1 259212 -1 362444 59012 471691 -1 226199 558639 -1 762431 588583 -1
306050 644000 -1 991585 -...

output:

15004604

result:

ok 1 number(s): "15004604"

Test #45:

score: 0
Accepted
time: 595ms
memory: 97124kb

input:

16
-1 -1 616111 132862 -1 649824 360984 -1 -1 13121 -1 222078 665848 490837 23874 -1
-1 -1 598489 826090 698069 532668 -1 -1 -1 -1 502209 65431 768686 -1 622947 166510
136765 368547 -1 44593 -1 416402 -1 79293 -1 783223 870098 -1 966759 501793 464408 -1
981746 255333 932703 -1 -1 358978 -1 -1 -1 875...

output:

24040676

result:

ok 1 number(s): "24040676"

Test #46:

score: 0
Accepted
time: 602ms
memory: 96672kb

input:

16
-1 -1 65077 -1 605913 -1 384597 198630 437177 -1 326823 -1 15260 -1 60829 -1
-1 -1 -1 -1 796747 442108 37554 -1 105191 22421 148913 67957 -1 -1 428444 11907
887209 -1 -1 886481 412073 -1 478886 -1 232276 492843 663658 -1 -1 98277 192585 -1
-1 -1 997602 -1 -1 130213 410303 -1 114471 -1 116627 6333...

output:

23700853

result:

ok 1 number(s): "23700853"

Test #47:

score: 0
Accepted
time: 625ms
memory: 96780kb

input:

16
-1 -1 999930 -1 516448 181754 580155 -1 448417 -1 -1 699400 819058 825262 793047 644759
-1 -1 981908 -1 -1 646242 641758 212061 275611 84203 -1 142698 17105 -1 409193 735779
314505 416620 -1 999544 -1 -1 -1 452030 219312 269672 652594 757077 429835 3876 251285 645930
-1 -1 695406 -1 213844 -1 608...

output:

25596532

result:

ok 1 number(s): "25596532"

Test #48:

score: 0
Accepted
time: 636ms
memory: 99980kb

input:

16
-1 46788 386376 265309 -1 279803 380497 179993 574237 728574 40280 546865 215326 -1 105842 308726
664547 -1 -1 595119 -1 418827 211085 490329 -1 152241 27289 733177 -1 233967 -1 614539
942786 -1 -1 320691 -1 -1 -1 -1 42916 438171 139366 140549 353069 257883 -1 473973
612313 936310 536800 -1 14288...

output:

25547228

result:

ok 1 number(s): "25547228"

Test #49:

score: 0
Accepted
time: 627ms
memory: 99800kb

input:

16
-1 636044 671499 128842 636219 865977 -1 912746 243053 -1 151218 365289 352629 107814 749561 139968
564997 -1 211772 103850 998927 120038 -1 439745 910551 -1 571301 614898 -1 349319 -1 197068
903995 133883 -1 488607 83949 838928 451548 406044 -1 -1 278669 832107 432437 652044 -1 -1
667055 167322 ...

output:

29959720

result:

ok 1 number(s): "29959720"

Test #50:

score: 0
Accepted
time: 623ms
memory: 99364kb

input:

16
-1 177049 -1 695400 330333 338717 364372 769101 -1 178893 947311 103173 578109 380879 590313 524474
190770 -1 146305 378178 8662 473960 753357 209944 514568 81036 252061 93989 436070 343823 143750 -1
-1 874019 -1 -1 912202 -1 411631 732459 239435 429274 771985 575111 -1 304897 -1 97504
765559 610...

output:

35106137

result:

ok 1 number(s): "35106137"

Test #51:

score: 0
Accepted
time: 332ms
memory: 96688kb

input:

16
-1 -1 -1 679393 -1 814655 -1 -1 -1 -1 -1 770916 -1 -1 -1 -1
-1 -1 686919 -1 83342 -1 160356 -1 -1 -1 -1 -1 -1 -1 640946 -1
-1 205964 -1 -1 -1 -1 -1 478121 -1 -1 -1 -1 -1 -1 764278 -1
534950 -1 -1 -1 -1 -1 -1 -1 -1 764094 -1 -1 -1 -1 -1 -1
-1 662834 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 457041 -1 -1
49...

output:

9728005

result:

ok 1 number(s): "9728005"

Test #52:

score: 0
Accepted
time: 368ms
memory: 99284kb

input:

16
-1 121101 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1
605056 -1 -1 231945 189505 -1 -1 -1 -1 -1 218466 93538 -1 181206 -1 -1
-1 -1 -1 -1 -1 -1 -1 -1 379596 -1 -1 20802 -1 -1 487418 -1
-1 413691 -1 -1 -1 -1 -1 -1 -1 -1 -1 631182 -1 -1 89308 598867
-1 981965 -1 -1 -1 964116 -1 -1 -1 -1 474313 -1 -1 -...

output:

-1

result:

ok 1 number(s): "-1"

Test #53:

score: 0
Accepted
time: 376ms
memory: 98516kb

input:

16
-1 -1 797971 -1 693502 880389 -1 751199 -1 162694 -1 -1 765181 74895 -1 -1
-1 -1 -1 -1 -1 855896 212202 -1 -1 -1 -1 -1 -1 -1 -1 -1
563734 -1 -1 -1 -1 -1 304147 -1 -1 -1 321952 643808 -1 -1 680835 -1
-1 -1 -1 -1 -1 -1 -1 -1 -1 803676 -1 -1 -1 -1 -1 -1
624027 -1 -1 -1 -1 171991 551719 167000 217112...

output:

-1

result:

ok 1 number(s): "-1"

Test #54:

score: 0
Accepted
time: 372ms
memory: 98420kb

input:

16
-1 -1 -1 668545 -1 38189 -1 -1 -1 -1 -1 28078 -1 -1 -1 76241
-1 -1 231619 -1 -1 -1 116768 245543 -1 -1 -1 117110 -1 -1 394209 -1
-1 567880 -1 -1 442703 -1 -1 -1 -1 -1 105456 104115 226831 -1 -1 -1
795944 -1 -1 -1 -1 -1 -1 289357 255076 809778 214126 -1 -1 -1 536232 38517
-1 -1 506168 -1 -1 -1 -1 ...

output:

-1

result:

ok 1 number(s): "-1"

Test #55:

score: 0
Accepted
time: 555ms
memory: 99924kb

input:

16
-1 352366 47288 180135 319616 433058 466499 668831 16647 431353 150482 356213 225788 33888 147066 212436
541503 -1 172297 267713 560313 600102 601052 194537 65453 81114 898669 447457 122404 550684 68202 164426
383202 228141 -1 465255 67836 281004 338257 354097 75732 812275 14659 482657 362206 345...

output:

41556470

result:

ok 1 number(s): "41556470"

Test #56:

score: 0
Accepted
time: 430ms
memory: 97044kb

input:

16
-1 -1 901398 -1 -1 -1 -1 -1 -1 924621 134253 -1 -1 -1 346746 -1
-1 -1 -1 -1 505544 -1 987960 78151 -1 -1 -1 459724 591558 -1 -1 57341
394165 -1 -1 -1 119854 397845 -1 870313 -1 700859 -1 -1 276242 720713 -1 -1
-1 -1 -1 -1 -1 244154 -1 189105 -1 -1 -1 -1 -1 -1 -1 628617
-1 982268 25696 -1 -1 -1 -1...

output:

13236731

result:

ok 1 number(s): "13236731"

Test #57:

score: 0
Accepted
time: 525ms
memory: 96712kb

input:

16
-1 -1 135795 677905 -1 162957 71125 -1 74961 116280 -1 -1 287889 198304 205944 -1
-1 -1 -1 583141 -1 27373 120530 -1 -1 -1 -1 -1 -1 100761 -1 -1
685158 -1 -1 8807 -1 225587 230283 -1 434583 -1 12774 -1 -1 328920 -1 467930
903194 903708 359059 -1 183717 -1 41880 -1 174971 114211 35585 445908 64669...

output:

16843235

result:

ok 1 number(s): "16843235"

Test #58:

score: 0
Accepted
time: 336ms
memory: 97152kb

input:

16
-1 -1 839291 -1 44244 232436 881977 -1 -1 -1 527327 -1 -1 -1 -1 -1
-1 -1 -1 -1 -1 2933 -1 -1 -1 -1 71532 -1 -1 -1 -1 -1
719709 -1 -1 -1 -1 -1 44363 -1 -1 608910 -1 -1 410431 -1 321811 -1
-1 -1 -1 -1 -1 -1 -1 375603 -1 -1 -1 323289 -1 -1 -1 -1
520126 -1 -1 -1 -1 -1 -1 -1 -1 642158 -1 -1 -1 -1 -1 -...

output:

-1

result:

ok 1 number(s): "-1"

Test #59:

score: 0
Accepted
time: 573ms
memory: 96920kb

input:

16
-1 -1 -1 629662 140062 -1 564686 -1 -1 -1 -1 131006 276627 138478 -1 404503
-1 -1 73121 475597 174109 28120 -1 -1 -1 -1 567094 -1 477956 310533 -1 -1
-1 382431 -1 486246 -1 378659 -1 -1 425832 765830 640908 -1 87411 -1 394049 722118
932361 781228 848629 -1 487879 -1 -1 -1 -1 897369 -1 274827 2812...

output:

22242391

result:

ok 1 number(s): "22242391"

Test #60:

score: 0
Accepted
time: 452ms
memory: 99524kb

input:

16
-1 -1 487803 -1 464605 -1 361875 -1 -1 -1 648432 -1 -1 941433 -1 -1
-1 -1 697107 -1 454845 -1 286652 -1 -1 -1 -1 -1 456129 301788 -1 -1
610935 37379 -1 -1 611297 -1 23708 343388 -1 -1 388820 887764 910511 -1 727336 -1
-1 -1 -1 -1 -1 758509 -1 -1 -1 500268 -1 618048 357261 -1 -1 -1
652442 664970 9...

output:

17796245

result:

ok 1 number(s): "17796245"

Test #61:

score: 0
Accepted
time: 531ms
memory: 98328kb

input:

16
-1 190595 407067 -1 -1 -1 -1 -1 -1 -1 196849 -1 -1 166925 300027 -1
362216 -1 242654 706233 -1 475771 -1 160264 434146 212476 -1 594847 561860 -1 158491 720774
647596 890171 -1 -1 -1 -1 -1 -1 766082 210790 87029 100704 140541 21999 361160 -1
-1 750263 -1 -1 122166 -1 192844 216858 -1 -1 -1 5006 2...

output:

16882279

result:

ok 1 number(s): "16882279"

Test #62:

score: 0
Accepted
time: 276ms
memory: 99388kb

input:

16
-1 16 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 12944
2 -1 19 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1
-1 6 -1 14 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1
-1 -1 5 -1 18 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1
-1 -1 -1 5 -1 20 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1
-1 -1 -1 -1 5 -1 16 -1 -1 -1 -1 -1 -1 -1 -1 -1
-1 -1 -1 -1...

output:

2226

result:

ok 1 number(s): "2226"

Subtask #4:

score: 20
Accepted

Dependency #3:

100%
Accepted

Test #63:

score: 20
Accepted
time: 1869ms
memory: 374600kb

input:

18
-1 -1 -1 -1 -1 -1 595998 -1 199410 -1 535266 -1 -1 -1 -1 -1 -1 -1
-1 -1 -1 -1 -1 -1 663308 -1 186290 -1 -1 -1 -1 -1 845209 -1 -1 660477
-1 -1 -1 -1 -1 174615 -1 -1 -1 -1 -1 403486 -1 -1 131742 -1 -1 -1
-1 -1 -1 -1 -1 306950 -1 628773 168956 -1 -1 -1 608422 544148 -1 -1 -1 92064
-1 -1 -1 -1 -1 -1 ...

output:

-1

result:

ok 1 number(s): "-1"

Test #64:

score: 0
Accepted
time: 2114ms
memory: 374544kb

input:

18
-1 -1 -1 795698 -1 -1 -1 60203 -1 -1 -1 418072 -1 -1 644335 -1 337977 -1
-1 -1 -1 -1 -1 -1 -1 -1 -1 920492 706538 16895 -1 501919 82934 -1 757366 -1
-1 -1 -1 -1 -1 777220 -1 -1 303426 -1 100329 729724 -1 -1 825480 -1 -1 541524
137695 -1 -1 -1 -1 36883 -1 755179 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1
-1 -1...

output:

14043798

result:

ok 1 number(s): "14043798"

Test #65:

score: 0
Accepted
time: 2087ms
memory: 374496kb

input:

18
-1 -1 -1 -1 183798 -1 -1 428034 -1 -1 -1 -1 224045 -1 -1 -1 143041 -1
-1 -1 202695 -1 -1 -1 -1 -1 790687 -1 903102 -1 -1 -1 398935 -1 -1 -1
-1 789434 -1 -1 508715 -1 -1 -1 -1 -1 -1 177351 601188 -1 -1 -1 -1 -1
-1 -1 -1 -1 -1 -1 -1 304683 344084 -1 -1 38223 38220 -1 379550 -1 -1 305901
526267 -1 5...

output:

-1

result:

ok 1 number(s): "-1"

Test #66:

score: 0
Accepted
time: 2239ms
memory: 374552kb

input:

18
-1 789392 -1 -1 -1 -1 -1 -1 -1 594849 -1 -1 -1 -1 95845 -1 -1 493853
4845 -1 -1 -1 -1 -1 990949 691184 -1 -1 -1 156648 -1 -1 -1 -1 -1 -1
-1 -1 -1 939124 -1 -1 -1 -1 590286 -1 687262 -1 582535 -1 874566 759564 -1 -1
-1 -1 934831 -1 456981 -1 -1 -1 -1 921631 828885 -1 -1 -1 -1 -1 -1 -1
-1 -1 -1 631...

output:

17373894

result:

ok 1 number(s): "17373894"

Test #67:

score: 0
Accepted
time: 2208ms
memory: 374588kb

input:

18
-1 486668 -1 181773 -1 -1 -1 -1 -1 638414 -1 -1 -1 -1 -1 443098 382975 498017
917366 -1 159766 179724 790017 181897 643801 -1 -1 -1 -1 -1 -1 262268 84773 306704 -1 368919
-1 914423 -1 -1 -1 245095 -1 -1 -1 483398 179812 299660 -1 499937 -1 -1 -1 -1
361660 933373 -1 -1 371134 -1 209815 -1 292196 -...

output:

-1

result:

ok 1 number(s): "-1"

Test #68:

score: 0
Accepted
time: 2502ms
memory: 374480kb

input:

18
-1 4622 762465 -1 -1 -1 -1 -1 189027 -1 939718 -1 -1 276161 -1 -1 -1 -1
313663 -1 -1 -1 868893 -1 -1 -1 -1 -1 778679 -1 453093 -1 617230 364410 -1 -1
858902 -1 -1 433018 41713 -1 -1 -1 -1 627964 453052 -1 -1 795003 -1 -1 443245 -1
-1 -1 144669 -1 -1 -1 -1 -1 18281 864057 -1 -1 227206 576006 61070...

output:

22775144

result:

ok 1 number(s): "22775144"

Test #69:

score: 0
Accepted
time: 2513ms
memory: 374588kb

input:

18
-1 454722 297046 -1 161221 -1 -1 -1 354093 -1 -1 -1 -1 -1 -1 631996 -1 -1
884755 -1 421464 -1 -1 -1 428414 -1 -1 181791 50742 281020 180258 232446 394816 -1 -1 45791
770951 467592 -1 73569 -1 -1 464591 -1 -1 232187 -1 176858 -1 380086 768779 -1 -1 -1
-1 -1 567677 -1 -1 -1 542212 -1 396365 -1 5712...

output:

20384474

result:

ok 1 number(s): "20384474"

Test #70:

score: 0
Accepted
time: 2749ms
memory: 374656kb

input:

18
-1 314536 542832 698685 -1 -1 -1 196887 -1 167486 845263 -1 -1 -1 -1 -1 -1 -1
288300 -1 6878 -1 367917 438836 13895 -1 -1 318970 -1 301295 -1 263187 357598 -1 161403 764318
982209 686003 -1 -1 -1 852977 745986 -1 -1 -1 -1 647678 -1 -1 -1 -1 583462 422525
412320 -1 -1 -1 -1 823970 -1 82437 572646 ...

output:

22124159

result:

ok 1 number(s): "22124159"

Test #71:

score: 0
Accepted
time: 2721ms
memory: 374516kb

input:

18
-1 204101 9318 338259 -1 -1 927051 159987 -1 -1 -1 656408 605895 86906 -1 116203 -1 668504
538797 -1 24427 48309 691348 -1 -1 -1 -1 479744 266176 -1 -1 -1 -1 -1 100582 -1
85664 700368 -1 -1 -1 369302 295632 -1 -1 -1 -1 -1 -1 -1 -1 40932 465574 -1
940848 268292 -1 -1 -1 -1 -1 -1 -1 353929 303866 2...

output:

22739303

result:

ok 1 number(s): "22739303"

Test #72:

score: 0
Accepted
time: 3078ms
memory: 374480kb

input:

18
-1 -1 -1 -1 91130 -1 -1 -1 -1 -1 868111 -1 685416 206418 338222 585476 894755 -1
-1 -1 -1 109167 732438 665554 -1 -1 -1 642620 459008 -1 -1 -1 -1 -1 -1 164592
-1 -1 -1 15926 500663 196660 247547 597563 -1 622059 -1 -1 435681 248711 255691 -1 -1 -1
-1 701602 25944 -1 -1 759436 -1 -1 268527 -1 4743...

output:

30307066

result:

ok 1 number(s): "30307066"

Test #73:

score: 0
Accepted
time: 3169ms
memory: 374552kb

input:

18
-1 -1 608106 -1 882287 -1 436528 567627 678844 -1 957702 -1 -1 138544 696573 -1 249501 847128
-1 -1 495540 110498 49042 202782 -1 500768 11058 781947 623097 -1 -1 812790 251589 -1 226308 -1
716847 843754 -1 756565 -1 -1 34776 967595 309996 2794 -1 428901 188796 12243 -1 353555 -1 285262
-1 616229...

output:

33092672

result:

ok 1 number(s): "33092672"

Test #74:

score: 0
Accepted
time: 3193ms
memory: 374472kb

input:

18
-1 -1 -1 -1 828374 374530 -1 157537 287969 218473 962329 -1 -1 220677 327974 221894 -1 -1
-1 -1 -1 -1 978363 581339 580568 334599 118604 -1 175409 -1 -1 797588 124637 -1 -1 -1
-1 -1 -1 630378 132696 453300 333129 900612 316373 211587 615044 450850 -1 717917 -1 808088 203880 -1
-1 -1 786904 -1 728...

output:

30826506

result:

ok 1 number(s): "30826506"

Test #75:

score: 0
Accepted
time: 3292ms
memory: 374456kb

input:

18
-1 -1 -1 -1 331074 703181 160717 203396 -1 100665 407281 576678 918033 18797 -1 144674 94762 96098
-1 -1 -1 257962 472898 497765 -1 620951 133174 546746 241763 -1 530430 -1 277187 332838 604788 3967
-1 -1 -1 367219 68979 -1 -1 336012 266236 184456 -1 323502 -1 592337 520104 125710 575257 64793
-1...

output:

37693146

result:

ok 1 number(s): "37693146"

Test #76:

score: 0
Accepted
time: 1755ms
memory: 374540kb

input:

18
-1 -1 691831 810017 607374 -1 -1 -1 -1 -1 -1 676065 -1 -1 -1 -1 -1 -1
-1 -1 887775 -1 -1 -1 -1 -1 -1 402267 551335 -1 -1 -1 -1 -1 -1 732856
182322 308210 -1 -1 829991 -1 -1 268831 -1 -1 -1 561325 -1 199381 -1 -1 -1 -1
373459 -1 -1 -1 -1 -1 -1 -1 94001 -1 88449 -1 -1 -1 -1 542447 6636 -1
532942 -1...

output:

-1

result:

ok 1 number(s): "-1"

Test #77:

score: 0
Accepted
time: 1729ms
memory: 374660kb

input:

18
-1 -1 348679 -1 -1 -1 -1 -1 -1 -1 -1 -1 49873 -1 -1 892840 -1 -1
-1 -1 -1 118855 -1 -1 -1 -1 212428 -1 -1 -1 -1 39974 -1 -1 -1 77352
803404 -1 -1 -1 -1 -1 -1 295370 -1 -1 -1 -1 134468 -1 -1 -1 -1 -1
-1 945483 -1 -1 739098 392515 -1 -1 -1 -1 -1 -1 -1 -1 408762 -1 -1 -1
-1 -1 -1 800682 -1 -1 442359...

output:

-1

result:

ok 1 number(s): "-1"

Test #78:

score: 0
Accepted
time: 2995ms
memory: 374488kb

input:

18
-1 231604 380622 333376 308529 508554 34955 547644 49407 785830 112050 170299 365071 318016 403533 394863 696341 342489
346377 -1 21483 471951 791878 454789 424706 696610 422690 194308 442477 483810 815562 154140 353087 252462 192300 190756
822440 399216 -1 151179 75836 332402 285112 388557 18857...

output:

55858045

result:

ok 1 number(s): "55858045"

Test #79:

score: 0
Accepted
time: 1987ms
memory: 374544kb

input:

18
-1 470462 -1 -1 -1 -1 -1 -1 495166 -1 -1 -1 871505 -1 -1 -1 -1 -1
213092 -1 571066 -1 256200 -1 -1 178288 -1 733616 -1 615473 697566 -1 488830 -1 -1 -1
-1 812952 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 689945 -1 324862 423753
-1 -1 -1 -1 846001 -1 -1 -1 526578 -1 -1 -1 -1 -1 -1 614355 -1 -1
-1 66897 ...

output:

-1

result:

ok 1 number(s): "-1"

Test #80:

score: 0
Accepted
time: 2390ms
memory: 374588kb

input:

18
-1 542758 -1 -1 600374 336490 106296 -1 -1 786027 -1 180653 -1 865808 -1 28032 -1 -1
771131 -1 -1 -1 -1 -1 -1 -1 -1 240813 113505 608574 -1 667795 -1 -1 -1 -1
-1 -1 -1 -1 804464 293603 -1 -1 -1 51432 58474 -1 51939 50178 -1 3544 -1 -1
-1 -1 -1 -1 -1 471167 524603 -1 767051 423941 -1 -1 66359 -1 -...

output:

19898678

result:

ok 1 number(s): "19898678"

Test #81:

score: 0
Accepted
time: 2531ms
memory: 374472kb

input:

18
-1 154824 -1 61061 -1 998527 -1 -1 -1 210849 -1 49662 43447 294596 -1 -1 -1 -1
380069 -1 206753 -1 659131 -1 454777 675910 -1 932270 -1 -1 666185 123684 -1 -1 753872 610348
-1 469893 -1 -1 -1 -1 64572 370050 634593 92640 101610 -1 -1 -1 259321 -1 -1 -1
954622 -1 -1 -1 -1 441147 -1 -1 830716 -1 -1...

output:

18894615

result:

ok 1 number(s): "18894615"

Test #82:

score: 0
Accepted
time: 2611ms
memory: 374496kb

input:

18
-1 11918 429518 56729 -1 511063 183436 -1 -1 -1 -1 -1 -1 -1 682589 113951 -1 -1
158163 -1 -1 86262 -1 60926 -1 285393 -1 369662 307231 622533 21979 -1 181104 -1 -1 -1
521142 -1 -1 -1 -1 -1 79645 -1 -1 -1 284244 493319 -1 -1 -1 86345 -1 -1
592075 305443 -1 -1 201645 -1 -1 616247 -1 -1 -1 608568 -1...

output:

22769943

result:

ok 1 number(s): "22769943"

Test #83:

score: 0
Accepted
time: 2363ms
memory: 374468kb

input:

18
-1 453761 -1 -1 560287 -1 -1 -1 -1 -1 6375 -1 -1 751872 -1 -1 -1 677181
514140 -1 -1 540949 913985 -1 -1 310454 -1 -1 -1 133904 -1 -1 -1 -1 -1 -1
-1 -1 -1 -1 -1 -1 -1 814826 39280 502503 -1 -1 -1 247150 -1 -1 -1 -1
-1 240508 -1 -1 -1 664402 -1 -1 -1 -1 -1 -1 980969 990614 140445 -1 -1 357173
9700...

output:

18033836

result:

ok 1 number(s): "18033836"

Test #84:

score: 0
Accepted
time: 2479ms
memory: 374588kb

input:

18
-1 -1 -1 78081 633386 427335 -1 556262 -1 173888 120134 -1 -1 -1 -1 -1 -1 -1
-1 -1 177891 14946 -1 -1 319655 -1 -1 197196 -1 -1 -1 634995 -1 -1 -1 -1
-1 524122 -1 -1 -1 -1 -1 178089 -1 -1 -1 -1 -1 530935 413189 -1 105115 265987
880889 556706 -1 -1 401708 756358 2399 -1 366638 799773 -1 434734 572...

output:

21262707

result:

ok 1 number(s): "21262707"

Test #85:

score: 0
Accepted
time: 2132ms
memory: 374588kb

input:

18
-1 472827 -1 -1 1809 -1 -1 -1 617656 969047 -1 -1 -1 -1 -1 106854 -1 -1
968128 -1 -1 -1 508826 -1 -1 -1 -1 -1 546683 860994 -1 861475 -1 863966 -1 -1
-1 -1 -1 480986 -1 -1 -1 -1 -1 -1 -1 -1 502819 -1 -1 -1 -1 759463
-1 -1 23877 -1 -1 -1 496215 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 34657
822945 678616 -1 ...

output:

16583282

result:

ok 1 number(s): "16583282"

Test #86:

score: 0
Accepted
time: 2542ms
memory: 374524kb

input:

18
-1 620854 737071 311859 239857 -1 -1 -1 198321 455719 -1 317290 571951 -1 452821 -1 917663 -1
957039 -1 -1 -1 -1 -1 -1 -1 -1 425292 -1 -1 -1 142238 -1 -1 -1 -1
903774 -1 -1 557782 -1 270772 286579 79621 327391 -1 -1 -1 -1 360358 -1 -1 -1 -1
513690 -1 653202 -1 717354 -1 -1 -1 -1 -1 -1 78981 -1 -1...

output:

21031772

result:

ok 1 number(s): "21031772"

Test #87:

score: 0
Accepted
time: 1835ms
memory: 374464kb

input:

18
-1 754524 -1 -1 -1 -1 -1 -1 992052 -1 -1 -1 -1 78693 522072 -1 -1 -1
576749 -1 702158 -1 -1 -1 -1 -1 -1 -1 729326 -1 512642 -1 -1 -1 -1 -1
-1 270754 -1 423720 -1 830243 -1 -1 -1 -1 -1 -1 -1 -1 910941 -1 -1 -1
-1 -1 381660 -1 -1 843782 -1 -1 -1 -1 604993 -1 -1 -1 -1 750305 -1 62822
-1 -1 -1 -1 -1 ...

output:

-1

result:

ok 1 number(s): "-1"

Test #88:

score: 0
Accepted
time: 1361ms
memory: 374472kb

input:

18
-1 11 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 10261
8 -1 14 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1
-1 6 -1 16 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1
-1 -1 8 -1 16 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1
-1 -1 -1 4 -1 12 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1
-1 -1 -1 -1 1 -1 11 -1 -1 -1...

output:

5662

result:

ok 1 number(s): "5662"

Extra Test:

score: 0
Extra Test Passed