QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#423217#8370. T3Diu100 ✓139ms6032kbC++14857b2024-05-27 21:35:102024-05-27 21:35:11

Judging History

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

  • [2024-05-27 21:35:11]
  • 评测
  • 测评结果:100
  • 用时:139ms
  • 内存:6032kb
  • [2024-05-27 21:35:10]
  • 提交

answer

#include<bits/stdc++.h>
#define ll long long
using namespace std;
const int N=2e5+10;
int n,m,px,py,a[N],b[N],c[N];
bool check(int s){
	ll s1=0,s2=0,res=0;
	int x=0,y=0;
	while(x<n&&a[x+1]+b[m]<=s)++x;
	for(int i=n-1,j=m;i>=0;i--){
		while(y<m&&a[i+1]+b[y+1]<=s)++y;
		res+=m-y-j;
		while(j&&n-x-i>0){
			res+=n-x-i,--j;
			if(j)while(x<n&&a[x+1]+b[j]<=s)++x;
		}
		s1=max(s1,res);
		if(px<=i||py<=j)s2=max(s2,res);
	}
	return s1==s2;
}
signed main(){
	scanf("%d%d",&n,&m);
	for(int i=1;i<=n;i++)scanf("%d",&a[i]);
	for(int j=1;j<=m;j++)scanf("%d",&b[j]);
	px=a[1],py=b[1];
	sort(a+1,a+n+1),sort(b+1,b+m+1);
	for(int i=1;i<=n;i++)if(a[i]==px){px=i;break;}
	for(int j=1;j<=m;j++)if(b[j]==py){py=j;break;}
	int l=0,r=a[px]+b[py];
	while(l+1<r){
		int mid=l+r>>1;
		if(check(mid))r=mid;
		else l=mid;
	}
	printf("%d\n",r);
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 14
Accepted

Test #1:

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

input:

3 4
5793102 5457652 10631669
14037022 24564522 19828638 16740187

output:

19830124

result:

ok 1 number(s): "19830124"

Test #2:

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

input:

4 4
24461545 7466923 15331834 20936291
21465585 2271163 23099576 8980678

output:

29916969

result:

ok 1 number(s): "29916969"

Test #3:

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

input:

4 1
46521231 59300629 47833220 9231226
69485861

output:

116007092

result:

ok 1 number(s): "116007092"

Test #4:

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

input:

4 1
4956725 7458189 2245373 5089414
71658100

output:

76614825

result:

ok 1 number(s): "76614825"

Test #5:

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

input:

4 1
4140322 4479566 40826591 29747993
34463254

output:

38603576

result:

ok 1 number(s): "38603576"

Test #6:

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

input:

3 3
8632467 13707438 3309699
48647378 18658100 26245660

output:

34878127

result:

ok 1 number(s): "34878127"

Test #7:

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

input:

4 4
15678597 4645170 12200683 25429499
28590191 25995901 22163115 9233748

output:

37841712

result:

ok 1 number(s): "37841712"

Test #8:

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

input:

3 4
26636342 7115004 14212520
9334410 15565174 17372159 12106004

output:

24487163

result:

ok 1 number(s): "24487163"

Test #9:

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

input:

3 3
10 2 17
3 31 15

output:

13

result:

ok 1 number(s): "13"

Test #10:

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

input:

4 4
65885624 22146258 41938127 18282402
32301586 37262702 3915699 8887588

output:

54447844

result:

ok 1 number(s): "54447844"

Subtask #2:

score: 11
Accepted

Test #11:

score: 11
Accepted
time: 16ms
memory: 4412kb

input:

58907 56480
44575563 540879 28467036 43621838 25515388 10048620 4501896 38628765 39419406 29497118 41954017 917402 20191987 40236908 12585166 22986979 1764011 21587278 32837245 20261107 20671792 37064770 22652008 6411880 34950023 5163325 17409659 46335787 11065741 6440463 44544150 13934453 19477226 ...

output:

23107969

result:

ok 1 number(s): "23107969"

Test #12:

score: 0
Accepted
time: 39ms
memory: 4792kb

input:

189469 57603
28875640 6205004 21110951 23480849 10442288 1789266 29632233 2628015 1177308 14489813 11239759 18891059 18357357 30758696 25588314 22649200 22717678 14167578 9873586 28217823 17553393 22985060 22126753 15538086 23430634 14333822 29323385 6702484 18708803 24043666 22202322 14747587 38164...

output:

15556246

result:

ok 1 number(s): "15556246"

Test #13:

score: 0
Accepted
time: 36ms
memory: 5072kb

input:

99777 187389
19763944 21503578 41516016 21554274 9822891 567461 38237030 4371484 31707886 31971273 11497457 37719395 38945202 19636623 35568861 12534068 42265227 44615432 22929766 25841774 9050837 17516300 1345745 29756960 15389514 40185177 477641 47018456 41868553 31966448 22785241 19288642 1998459...

output:

19763945

result:

ok 1 number(s): "19763945"

Test #14:

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

input:

113160 47525
1276933 22789424 8557545 24124072 5673143 19349986 6068519 24223576 19109679 18298197 16972903 5167574 14125432 23729490 13713930 2121302 754829 7698084 24601313 7612890 25983767 326845 13635128 7986662 19461362 430983 2015164 5552620 13672574 18313257 22573688 13289557 23248995 6111760...

output:

1276934

result:

ok 1 number(s): "1276934"

Test #15:

score: 0
Accepted
time: 52ms
memory: 6032kb

input:

194299 192720
11471195 17731923 28848736 20668135 21536730 19400122 14601810 2411273 15025095 13041786 2589289 14081383 9010694 25808670 16152489 27645649 5945099 4742052 6345608 10888556 27404345 888365 23499757 12483915 20348368 18362060 29583766 21929309 24663619 24190963 28967536 8747238 2345400...

output:

11471196

result:

ok 1 number(s): "11471196"

Test #16:

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

input:

193880 185453
79780189 32196116 13230026 20507797 73926538 17558792 31362493 71730754 3553784 68854833 24295672 17980905 8513267 70310779 61865777 53321876 8319154 2363610 75415155 75664646 74507662 81624645 55926408 23802257 48216702 24208145 24680172 57518874 799354 69525528 80525431 61239653 3199...

output:

41244548

result:

ok 1 number(s): "41244548"

Test #17:

score: 0
Accepted
time: 52ms
memory: 5496kb

input:

199509 196173
76819693 6001416 38675337 26574800 65693385 71887748 68966336 66961014 38686305 16698977 6384723 7970176 15667622 63907722 68921778 59778161 17837085 64013178 40230571 57187419 28336911 54349850 28825359 31883802 13981396 24672020 74114713 74597265 65433802 13002830 12801750 56964670 4...

output:

41896792

result:

ok 1 number(s): "41896792"

Test #18:

score: 0
Accepted
time: 28ms
memory: 5420kb

input:

190423 197347
54 46 8 43 2 42 4 54 60 40 36 56 38 31 18 7 14 32 42 32 37 6 41 31 12 30 48 43 29 36 31 53 38 51 39 47 51 60 48 18 43 33 1 38 56 59 11 49 53 44 21 60 42 24 49 43 1 45 19 26 33 55 20 11 11 36 23 4 3 19 31 56 53 27 41 36 22 8 60 13 58 35 15 21 54 57 53 43 54 8 29 56 52 60 18 21 55 58 17 ...

output:

32

result:

ok 1 number(s): "32"

Test #19:

score: 0
Accepted
time: 54ms
memory: 5332kb

input:

194522 195000
62071029 43865048 26267497 3905375 49244519 87362029 1407250 9637827 5279514 2376215 68376435 29472925 51497228 60308217 57325853 79704463 80653694 14098513 4549378 35008395 38597349 16827966 80493967 63448301 12631171 62857 76061937 33308915 57069618 6234363 73265515 80191500 60912489...

output:

43945085

result:

ok 1 number(s): "43945085"

Test #20:

score: 0
Accepted
time: 50ms
memory: 5956kb

input:

187417 194003
8405638 77105297 25566654 17758001 38339497 46536914 78507135 54302236 561280 58442113 45951883 47131131 19225639 23759327 56115386 16577425 68551695 86222622 75348727 29628027 77913322 2487406 79014793 55586652 46984320 20213167 87040338 57314257 51426353 19171567 79733971 64682558 27...

output:

8405639

result:

ok 1 number(s): "8405639"

Subtask #3:

score: 15
Accepted

Test #21:

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

input:

3 10
24332538 25602471 54833728
7466852 20176810 23770883 13240181 15036268 16178071 19850557 11751859 12686516 11159532

output:

31799390

result:

ok 1 number(s): "31799390"

Test #22:

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

input:

4 9
14880669 10667567 7977836 1882967
80951479 5481207 15459896 52525030 28052486 14797866 34391066 58754229 27619130

output:

38286697

result:

ok 1 number(s): "38286697"

Test #23:

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

input:

6 5
1410209 331777 605947 756537 156780 131599
28694381 10823646 29868509 9541258 22217924

output:

22549701

result:

ok 1 number(s): "22549701"

Test #24:

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

input:

3 5
33150575 18966713 53782786
75149226 71799373 74419028 54775540 74124930

output:

107275505

result:

ok 1 number(s): "107275505"

Test #25:

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

input:

9 10
19770622 8756949 16056411 11314884 23189424 1141953 12422403 37892 22866723
42545625 10308121 21601490 30152072 2098306 10621367 15283148 17471310 27597062 53676957

output:

33527721

result:

ok 1 number(s): "33527721"

Test #26:

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

input:

10 9
3611512 3233156 3377069 553994 113187 2503076 1914585 2356051 1587266 2721722
11741545 3095423 1962742 4767129 9529924 11878991 5227734 15138953 3007732

output:

8378641

result:

ok 1 number(s): "8378641"

Test #27:

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

input:

9 10
5208009 9307010 2051682 4944638 17253966 9060047 19420506 10885128 3584042
16054166 12616174 35594631 103757 37681867 39254477 25977857 44547227 50538254 6630288

output:

21262175

result:

ok 1 number(s): "21262175"

Test #28:

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

input:

9 10
3 17 49 58 16 31 7 62 43
19 47 49 31 33 36 52 13 32 44

output:

22

result:

ok 1 number(s): "22"

Test #29:

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

input:

9 10
8235397 9325953 11216895 4616889 8560844 14202210 10104201 13954632 7794372
20670318 16550660 5200352 31139238 32768253 22690749 25415388 9254412 881680 13370610

output:

28464690

result:

ok 1 number(s): "28464690"

Test #30:

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

input:

10 9
24697067 21457756 38095506 26523468 44942109 31126405 23522874 39525059 26821990 2776456
15950738 1504993 60088818 11198974 24536388 29884150 52179341 14555976 41813504

output:

40647805

result:

ok 1 number(s): "40647805"

Test #31:

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

input:

3 3
8632467 13707438 3309699
48647378 18658100 26245660

output:

34878127

result:

ok 1 number(s): "34878127"

Test #32:

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

input:

4 4
15678597 4645170 12200683 25429499
28590191 25995901 22163115 9233748

output:

37841712

result:

ok 1 number(s): "37841712"

Test #33:

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

input:

3 4
26636342 7115004 14212520
9334410 15565174 17372159 12106004

output:

24487163

result:

ok 1 number(s): "24487163"

Subtask #4:

score: 16
Accepted

Test #34:

score: 16
Accepted
time: 1ms
memory: 5996kb

input:

557 24
944055 6651285 6872647 7501680 6728901 5684173 78312 872911 5349349 5834868 1104965 5034609 943636 6298640 4862332 6874311 4925018 7027588 6656184 1303888 1092633 6129416 3629195 5717171 4703294 6929327 6147793 2666674 4531679 3785633 7473654 274978 7723474 1969517 3520566 5338238 380308 7691...

output:

41467742

result:

ok 1 number(s): "41467742"

Test #35:

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

input:

567 859
38383240 46193322 40182866 33762222 44047850 23926558 17598009 44722025 26550401 17236954 29412862 14135415 26816589 1678549 19566264 1263766 13511794 38334130 12737758 11771096 17658397 4009382 4587810 2571864 11534568 39192791 16371821 2280664 1288448 15669234 2548205 43763911 43466353 368...

output:

36288319

result:

ok 1 number(s): "36288319"

Test #36:

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

input:

69 357
1269739 17176184 22557739 4037132 4743472 10732531 27908109 15094934 27332973 20805113 28173508 23643115 4057434 25739113 13735743 26905322 10342229 23369674 15296871 23748635 14425333 11972598 28776319 8469028 13489089 22340603 9456883 5775448 18096892 13689430 10619283 3759774 11587920 4857...

output:

3712589

result:

ok 1 number(s): "3712589"

Test #37:

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

input:

529 234
82148789 59487331 48418723 38013479 27463471 81016797 76240030 57706340 28778665 77838715 35104345 35410726 78331535 27506120 51899558 19948552 2204925 75871306 23181747 57505768 708045 83220194 63136315 2106168 18447809 72841759 61781649 46378984 27706915 48484998 72974388 72981417 17190794...

output:

49297663

result:

ok 1 number(s): "49297663"

Test #38:

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

input:

979 978
194863 115310 132435 186482 100642 81036 226661 223067 62318 203033 4777 192018 62580 230537 158852 183287 34969 206311 185856 201863 113236 221727 168685 151823 221620 129400 150017 145720 128574 53219 82859 164616 130848 217735 144467 192350 66396 141072 223399 49806 28402 164615 82628 224...

output:

791468

result:

ok 1 number(s): "791468"

Test #39:

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

input:

954 985
79683 3480063 8355526 1539643 10549127 731568 2753778 8051227 9397849 1228458 2437309 6078015 5503499 5913735 1320184 12803115 649610 10390168 6915676 8908328 8373357 6825256 4979639 5683068 2835316 2259394 4942204 5529635 37760 9823525 6480059 4480039 9190877 2184012 5860832 11040737 373997...

output:

12110604

result:

ok 1 number(s): "12110604"

Test #40:

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

input:

995 980
2570030 6661364 804750 4035309 7722654 2383865 6724133 4959765 5028469 6509750 4006046 6369204 5707594 2060914 3627697 4156222 6268828 2428619 5622520 1120622 3244193 7338861 3813106 5185072 7993923 6267096 3793613 5829991 5992123 2538414 1307850 6327917 4107848 2097965 6947023 6729589 13897...

output:

25001790

result:

ok 1 number(s): "25001790"

Test #41:

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

input:

932 964
52 6 4 19 68 36 41 13 27 60 23 59 40 19 77 19 44 79 3 22 59 28 24 53 68 24 62 35 30 71 49 37 33 63 72 2 8 64 77 42 5 26 55 8 10 31 11 29 4 73 65 68 39 76 62 27 9 76 26 19 74 53 27 32 59 22 15 39 48 28 20 37 11 57 23 31 45 14 7 3 12 69 56 3 40 34 42 52 10 13 22 71 6 52 9 50 31 76 30 69 28 63 ...

output:

73

result:

ok 1 number(s): "73"

Test #42:

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

input:

927 916
44651298 31853144 43333049 16094651 13035674 30734170 5181034 3013774 19577219 49728334 21219656 7339382 33863658 66266839 4537532 28704735 37186201 53287698 21561544 21263558 50638539 65925389 22601381 37700655 52277578 40078366 34637119 66505313 28097295 377425 7877943 49099693 42299109 67...

output:

46016466

result:

ok 1 number(s): "46016466"

Test #43:

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

input:

927 958
28738257 14919587 51848685 51485022 67082524 51720386 31687442 10257061 32497995 79359482 5206060 25485836 8884872 32990574 74016583 18815078 2355766 38244311 29461884 50889489 17216601 46821416 23228551 12802237 56661782 52020010 61877621 55750250 55552792 70117397 31383793 46661583 1402594...

output:

47232224

result:

ok 1 number(s): "47232224"

Test #44:

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

input:

3 3
8632467 13707438 3309699
48647378 18658100 26245660

output:

34878127

result:

ok 1 number(s): "34878127"

Test #45:

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

input:

4 4
15678597 4645170 12200683 25429499
28590191 25995901 22163115 9233748

output:

37841712

result:

ok 1 number(s): "37841712"

Test #46:

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

input:

3 4
26636342 7115004 14212520
9334410 15565174 17372159 12106004

output:

24487163

result:

ok 1 number(s): "24487163"

Subtask #5:

score: 19
Accepted

Test #47:

score: 19
Accepted
time: 1ms
memory: 5996kb

input:

557 24
944055 6651285 6872647 7501680 6728901 5684173 78312 872911 5349349 5834868 1104965 5034609 943636 6298640 4862332 6874311 4925018 7027588 6656184 1303888 1092633 6129416 3629195 5717171 4703294 6929327 6147793 2666674 4531679 3785633 7473654 274978 7723474 1969517 3520566 5338238 380308 7691...

output:

41467742

result:

ok 1 number(s): "41467742"

Test #48:

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

input:

567 859
38383240 46193322 40182866 33762222 44047850 23926558 17598009 44722025 26550401 17236954 29412862 14135415 26816589 1678549 19566264 1263766 13511794 38334130 12737758 11771096 17658397 4009382 4587810 2571864 11534568 39192791 16371821 2280664 1288448 15669234 2548205 43763911 43466353 368...

output:

36288319

result:

ok 1 number(s): "36288319"

Test #49:

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

input:

69 357
1269739 17176184 22557739 4037132 4743472 10732531 27908109 15094934 27332973 20805113 28173508 23643115 4057434 25739113 13735743 26905322 10342229 23369674 15296871 23748635 14425333 11972598 28776319 8469028 13489089 22340603 9456883 5775448 18096892 13689430 10619283 3759774 11587920 4857...

output:

3712589

result:

ok 1 number(s): "3712589"

Test #50:

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

input:

529 234
82148789 59487331 48418723 38013479 27463471 81016797 76240030 57706340 28778665 77838715 35104345 35410726 78331535 27506120 51899558 19948552 2204925 75871306 23181747 57505768 708045 83220194 63136315 2106168 18447809 72841759 61781649 46378984 27706915 48484998 72974388 72981417 17190794...

output:

49297663

result:

ok 1 number(s): "49297663"

Test #51:

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

input:

43820 33501
4839936 7368281 9029178 6222839 2207959 7323339 9407001 2607469 5155927 4731617 2227689 321964 832880 7373451 4847768 9838355 978642 2084609 10322495 9283323 7423510 6887978 9904928 5903584 1632193 4172628 8432812 3672817 4632875 498594 1610635 6765897 5215075 7195941 10315480 6973021 72...

output:

13926194

result:

ok 1 number(s): "13926194"

Test #52:

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

input:

15153 13698
5479944 5629328 2399352 3671168 1236654 4075781 3980827 5987029 998331 2104987 6256607 551858 5776887 1053517 4393049 4234695 5856389 2309418 6267129 325221 4141587 2083327 4003309 1359539 1491845 1699143 1304365 352944 4162366 5152487 1250429 4202750 3758234 1236794 4038241 887707 29271...

output:

24851571

result:

ok 1 number(s): "24851571"

Test #53:

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

input:

27561 17248
12552319 12676955 1452553 12668107 2217197 6017824 11595749 5642297 11798028 11661313 7303799 6021625 3723668 5633698 8474324 2327590 4164639 8093305 9962596 8936171 6276848 3450913 1055593 2477183 13455050 6936075 6793664 11521834 6493910 12779348 1613958 11993694 13103266 8488145 81683...

output:

19063048

result:

ok 1 number(s): "19063048"

Test #54:

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

input:

34502 37051
39529780 56941242 59190179 13710554 17841847 39822797 61226115 20989758 39547197 23635212 58986772 40329804 58606401 24102763 8002732 28731908 1297108 21832508 11802483 18707059 53519429 59353513 54557986 7999954 19826398 58086431 41727816 40948525 26791913 43056315 37910630 44040229 121...

output:

80087728

result:

ok 1 number(s): "80087728"

Test #55:

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

input:

49903 45598
11802624 4198859 4285304 11088293 16440415 2478578 2314320 9160943 14389913 9561295 1080239 6056870 5097645 6701964 8482641 280029 564284 10442544 11762599 7151291 16501326 7632547 8778262 6590993 12489187 15542204 13019821 2858458 10423447 13365030 3078337 14234481 13280942 6778084 7887...

output:

8684612

result:

ok 1 number(s): "8684612"

Test #56:

score: 0
Accepted
time: 37ms
memory: 5892kb

input:

48501 48109
53220467 37832836 52137316 62871164 30294912 1386341 60101037 59005759 9159135 44842549 22838937 56732029 6846521 58235272 4096480 16277009 14607141 57952018 17871027 15488641 47223449 43237604 15732494 2904106 21874949 8211098 28839136 42926732 39647983 65164267 30761407 50001006 546681...

output:

67437587

result:

ok 1 number(s): "67437587"

Test #57:

score: 0
Accepted
time: 31ms
memory: 5848kb

input:

46014 48362
33446412 19227647 17217385 50527617 52512717 23543417 27179219 48873286 4246355 54359128 506960 53288182 5380500 46461076 20441880 22334687 10236354 40234054 47901452 11283414 44981245 25371342 52823302 25572908 7922984 339959 47298467 21921525 10647987 3421574 32722135 36995529 13663454...

output:

47662358

result:

ok 1 number(s): "47662358"

Test #58:

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

input:

45057 48802
50 6 67 33 41 32 16 44 22 50 8 5 16 17 9 31 49 55 54 43 30 61 37 36 30 3 48 45 66 44 15 56 49 7 37 17 65 2 34 49 19 12 68 53 40 28 53 58 69 41 17 10 16 6 19 15 56 1 27 49 13 63 34 13 64 29 7 70 35 67 12 43 25 12 27 30 20 8 28 13 7 54 40 62 71 65 70 57 49 71 50 53 67 71 42 2 44 44 24 28 2...

output:

64

result:

ok 1 number(s): "64"

Test #59:

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

input:

47429 46196
47570385 37066338 41411208 46482348 55196064 16338492 39432095 51796669 7322680 74585758 43088913 33835304 30331157 26505315 71234831 19450999 19771340 68030966 12647752 8943193 75641916 58541793 54930182 24232376 5218845 74032495 15054090 59340223 29770077 29391843 61072187 68362828 183...

output:

84064388

result:

ok 1 number(s): "84064388"

Test #60:

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

input:

3 3
8632467 13707438 3309699
48647378 18658100 26245660

output:

34878127

result:

ok 1 number(s): "34878127"

Test #61:

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

input:

46973 45585
21878283 47301879 49688355 52107545 25844850 27788898 15969632 6719338 27837120 1572838 37891346 5603861 17660814 30614467 11782428 8246648 40640400 12083809 45662154 7741760 19508870 4753280 22020589 27593707 38558559 6739321 51639097 24121330 40755466 31322649 337962 48413526 15115824 ...

output:

21949314

result:

ok 1 number(s): "21949314"

Test #62:

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

input:

4 4
15678597 4645170 12200683 25429499
28590191 25995901 22163115 9233748

output:

37841712

result:

ok 1 number(s): "37841712"

Test #63:

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

input:

3 4
26636342 7115004 14212520
9334410 15565174 17372159 12106004

output:

24487163

result:

ok 1 number(s): "24487163"

Subtask #6:

score: 25
Accepted

Test #64:

score: 25
Accepted
time: 1ms
memory: 5960kb

input:

557 24
944055 6651285 6872647 7501680 6728901 5684173 78312 872911 5349349 5834868 1104965 5034609 943636 6298640 4862332 6874311 4925018 7027588 6656184 1303888 1092633 6129416 3629195 5717171 4703294 6929327 6147793 2666674 4531679 3785633 7473654 274978 7723474 1969517 3520566 5338238 380308 7691...

output:

41467742

result:

ok 1 number(s): "41467742"

Test #65:

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

input:

567 859
38383240 46193322 40182866 33762222 44047850 23926558 17598009 44722025 26550401 17236954 29412862 14135415 26816589 1678549 19566264 1263766 13511794 38334130 12737758 11771096 17658397 4009382 4587810 2571864 11534568 39192791 16371821 2280664 1288448 15669234 2548205 43763911 43466353 368...

output:

36288319

result:

ok 1 number(s): "36288319"

Test #66:

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

input:

69 357
1269739 17176184 22557739 4037132 4743472 10732531 27908109 15094934 27332973 20805113 28173508 23643115 4057434 25739113 13735743 26905322 10342229 23369674 15296871 23748635 14425333 11972598 28776319 8469028 13489089 22340603 9456883 5775448 18096892 13689430 10619283 3759774 11587920 4857...

output:

3712589

result:

ok 1 number(s): "3712589"

Test #67:

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

input:

529 234
82148789 59487331 48418723 38013479 27463471 81016797 76240030 57706340 28778665 77838715 35104345 35410726 78331535 27506120 51899558 19948552 2204925 75871306 23181747 57505768 708045 83220194 63136315 2106168 18447809 72841759 61781649 46378984 27706915 48484998 72974388 72981417 17190794...

output:

49297663

result:

ok 1 number(s): "49297663"

Test #68:

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

input:

3 3
8632467 13707438 3309699
48647378 18658100 26245660

output:

34878127

result:

ok 1 number(s): "34878127"

Test #69:

score: 0
Accepted
time: 53ms
memory: 4588kb

input:

70489 90979
36789827 9598650 21884702 51395016 47680849 12995278 18035168 5397383 25864590 25477435 41887245 26606098 47714926 33406820 4189587 8765425 30655724 52251369 3761638 4873590 7535416 18520198 7780408 15109359 36348145 48772579 51120766 13239082 32219340 34097599 20872784 20015534 1416918 ...

output:

46726252

result:

ok 1 number(s): "46726252"

Test #70:

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

input:

112591 7885
17425934 71092 18796395 16737481 22051530 27375855 384505 17910820 35147138 15548782 11450335 37244702 9912055 27816504 31369678 1513955 1156346 28082449 16075711 12617857 43926667 2970223 9194647 11967481 13823418 6868165 39833888 30165535 33846427 22301220 10260903 8094633 33111449 188...

output:

17728164

result:

ok 1 number(s): "17728164"

Test #71:

score: 0
Accepted
time: 42ms
memory: 4668kb

input:

69332 126141
12420631 38854514 13986800 11637105 14625549 6190621 40115583 19763780 9255461 8340710 10788644 27028464 4130727 4007042 39590981 29019981 14262820 38536799 31051134 17865564 12153682 2051375 20666857 36585835 4728759 24324969 14369768 12857651 41775634 19692035 26854055 32546717 164768...

output:

13636411

result:

ok 1 number(s): "13636411"

Test #72:

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

input:

132131 68572
54389165 36380620 52353943 34185574 17297100 4096856 60541320 8187955 51591159 33251283 46885220 55565272 39817819 12068444 49886351 62884155 23080164 3702165 36715089 41042394 1162120 62563237 59925099 48947379 43419442 40313429 245277 26282446 9986842 29237224 18029138 33218121 224735...

output:

76106018

result:

ok 1 number(s): "76106018"

Test #73:

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

input:

196842 180757
1202681 1634270 1399510 2984032 1186235 1996145 2146292 1728168 1468432 3094151 428665 1746896 3116425 2333725 2067750 1826444 1163269 2390823 1922417 2126709 2192916 34403 2582576 2322901 1681722 1557731 1826112 3040391 2486584 629795 401703 826587 1302266 2933042 2596720 3026170 2732...

output:

12538081

result:

ok 1 number(s): "12538081"

Test #74:

score: 0
Accepted
time: 59ms
memory: 5312kb

input:

196815 196589
211194 150218 202172 206685 216813 173750 154403 100694 78056 54551 218145 247281 157440 196163 160256 188677 159157 158651 6896 57988 226395 84742 218961 39006 94493 176584 172883 194903 225478 62346 54260 74610 82546 49980 38027 41644 237690 100822 72749 246015 150162 150927 176082 2...

output:

1718617

result:

ok 1 number(s): "1718617"

Test #75:

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

input:

183006 197130
36433344 22536002 31822523 29563664 361983 20525245 4384636 20413716 29501393 7815414 30661179 866347 38922899 9148870 30634772 27519195 20551618 16080644 29784649 3674513 38092578 16242044 20608422 30248394 45162114 35425454 571787 37587389 35865726 31950963 7875924 46555003 33182661 ...

output:

48931547

result:

ok 1 number(s): "48931547"

Test #76:

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

input:

186396 180321
54 56 31 14 47 83 44 74 75 19 55 25 35 35 76 15 68 33 55 80 34 2 8 62 41 55 76 80 19 34 6 51 18 30 13 2 58 57 10 70 17 47 12 29 14 35 12 10 41 10 27 4 42 1 63 54 22 44 18 55 48 5 77 25 38 60 27 2 28 4 48 45 58 41 80 73 67 28 84 29 5 57 59 49 18 51 65 25 7 16 5 17 76 60 85 83 9 71 80 34...

output:

73

result:

ok 1 number(s): "73"

Test #77:

score: 0
Accepted
time: 96ms
memory: 5364kb

input:

199008 199303
8755339 11254165 2639581 12297836 9426807 96149 10366700 8494405 13768553 2948727 1154708 13981793 6631607 13576998 9766470 14435157 6819698 13477337 7153743 11307769 10578100 12843687 9000618 3664005 2244599 1307161 11289122 5543495 12197145 11167255 14041389 9227340 11271489 12931114...

output:

25965231

result:

ok 1 number(s): "25965231"

Test #78:

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

input:

4 4
15678597 4645170 12200683 25429499
28590191 25995901 22163115 9233748

output:

37841712

result:

ok 1 number(s): "37841712"

Test #79:

score: 0
Accepted
time: 139ms
memory: 5400kb

input:

198063 182380
36156857 9182691 4010568 30530733 42673698 19586577 32781593 15853343 25415665 25239916 34326500 40471002 4084737 4421836 41975937 29326380 24238151 3709468 42474113 23366524 1868342 16028242 1596297 11897601 48193430 15512730 43498352 2845143 41279121 19896401 20104802 7990023 2065737...

output:

60402116

result:

ok 1 number(s): "60402116"

Test #80:

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

input:

3 4
26636342 7115004 14212520
9334410 15565174 17372159 12106004

output:

24487163

result:

ok 1 number(s): "24487163"