QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#744240#2122. Wystawa [A]SimonLJK0 515ms7664kbC++173.8kb2024-11-13 21:16:372024-11-13 21:16:37

Judging History

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

  • [2024-11-13 21:16:37]
  • 评测
  • 测评结果:0
  • 用时:515ms
  • 内存:7664kb
  • [2024-11-13 21:16:37]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=1e5+999;
ll n,m,a[N],b[N];
multiset<ll> ms1,ms2;
multiset<ll>::iterator it;
bool judge(ll lim){
	ll l,r,mid,bl,br,bmid,cnt0;
	l=r=mid=bl=br=bmid=cnt0=0;
	ms1.clear(); ms2.clear();
	for(int i=1;i<=n;i++){
		if(a[i]-b[i]>0){
			ms2.insert(a[i]-b[i]);
		}
		else if(a[i]-b[i]==0){
			cnt0++;
		}
		else{
			ms1.insert(a[i]-b[i]);
			mid++;
			bmid+=a[i]-b[i];
		}
		br+=a[i]-b[i];
		r++;
		bl+=b[i]; bmid+=b[i]; br+=b[i];
		if(bmid<0){
			ll bn=bmid;
			if(bl<=0){
				bl=0;
				cnt0+=ms1.size();
				mid-=ms1.size();
				ms1.clear();
			}
			else{
				while(bn<0){
					it=ms1.end(); it--;
					if(bn-(*it)<=0){
						bn-=(*it);
						ms1.erase(it);
						mid--; cnt0++;
					}
					else{
						ll v=*it;
						ms1.erase(it);
						ms1.insert(v-bn);
						bn=0;
					}
				}
			}
			if(br<=0){
				br=0;
				cnt0+=ms2.size();
				ms2.clear();
			}
			else{
				bn=bmid;
				while(bn<0){
					it=ms2.begin();
					if(bn+(*it)<=0){
						bn+=(*it);
						ms2.erase(it);
						cnt0++;
					}
					else{
						ll v=*it;
						ms2.erase(it);
						ms2.insert(v+bn);
						bn=0;
					}
				}
			}
			bmid=0;
		}
		while(bl>lim){
			if(ms1.empty()) return false;
			bl+=*(ms1.begin());
			l++; ms1.erase(ms1.begin());
		}
		while(br>lim){
			if(ms2.empty()) return false;
			it=ms2.end(); it--;
			br-=(*it); r--; ms2.erase(it);
		}
	}
	if(l>m||r<m) return false;
	return true;
}
multiset<pair<ll,int> > Ms1,Ms2;
multiset<pair<ll,int> >::iterator It;
vector<int> z;
bool vis[N];
void solve(ll lim){
	ll l,r,mid,bl,br,bmid,cnt0;
	l=r=mid=bl=br=bmid=cnt0=0;
	for(int i=1;i<=n;i++){
		if(a[i]-b[i]>0){
			Ms2.insert(make_pair(a[i]-b[i],i));
		}
		else if(a[i]-b[i]==0){
			cnt0++;
			z.push_back(i);
		}
		else{
			Ms1.insert(make_pair(a[i]-b[i],i));
			mid++;
			bmid+=a[i]-b[i];
		}
		br+=a[i]-b[i];
		r++;
		bl+=b[i]; bmid+=b[i]; br+=b[i];
		if(bmid<0){
			ll bn=bmid;
			if(bl<=0){
				bl=0;
				mid-=Ms1.size();
				for(It=Ms1.begin();It!=Ms1.end();It++)
					z.push_back((*It).second),cnt0++;
				Ms1.clear();
			}
			else{
				while(bn<0){
					It=Ms1.end(); It--;
					if(bn-(*It).first<=0){
						bn-=(*It).first;
						z.push_back((*It).second);
						Ms1.erase(It);
						mid--; cnt0++;
					}
					else{
						ll v=(*It).first; int id=(*It).second;
						Ms1.erase(It);
						Ms1.insert(make_pair(v-bn,id));
						bn=0;
					}
				}
			}
			if(br<=0){
				br=0;
				for(It=Ms2.begin();It!=Ms2.end();It++)
					z.push_back((*It).second),cnt0++;
				Ms2.clear();
			}
			else{
				bn=bmid;
				while(bn<0){
					It=Ms2.begin();
					if(bn+(*It).first<=0){
						bn+=(*It).first;
						z.push_back((*It).second);
						Ms2.erase(It);
						cnt0++;
					}
					else{
						ll v=(*It).first; ll id=(*It).second;
						Ms2.erase(It);
						Ms2.insert(make_pair(v+bn,id));
						bn=0;
					}
				}
			}
			bmid=0;
		}
		while(bl>lim){
			bl+=(*Ms1.begin()).first;
			vis[(*Ms1.begin()).second]=1;
			l++; Ms1.erase(Ms1.begin());
		}
		while(br>lim){
			It=Ms2.end(); It--;
			br-=(*It).first; r--; Ms2.erase(It);
		}
	}
	while(l!=m){
		if(!Ms1.empty()){
			It=Ms1.begin();
			vis[(*It).second]=1;
			Ms1.erase(It);
		}
		else if(cnt0){
			cnt0--;
			vis[z.back()]=1;
			z.pop_back(); 
		}
		else{
			It=Ms2.begin();
			vis[(*It).second]=1;
			Ms2.erase(It);
		}
		l++;
	}
	for(int i=1;i<=n;i++)
		if(vis[i]) cout<<"A";
		else cout<<"B";
	return;
}
int main(){
	std::ios::sync_with_stdio(false);
	cin.tie(0);
	cin>>n>>m;
	for(int i=1;i<=n;i++) cin>>a[i];
	for(int i=1;i<=n;i++) cin>>b[i];
	ll l=0,r=1e14,mid,re=1e14;
	while(l<=r){
		mid=(l+r>>1);
		if(judge(mid)) re=mid,r=mid-1;
		else l=mid+1;
	}
	cout<<re<<endl;
	solve(re);
	return 0;
}

詳細信息

Subtask #1:

score: 0
Wrong Answer

Test #1:

score: 1
Accepted
time: 1ms
memory: 3644kb

input:

6 2
-1 7 0 2 -5 0
3 1 4 -3 -3 12

output:

4
BBABBA

result:

ok correct answer and good plan!

Test #2:

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

input:

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

output:

0
BAA

result:

ok correct answer and good plan!

Test #3:

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

input:

1 0
2
3

output:

3
B

result:

ok correct answer and good plan!

Test #4:

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

input:

1 1
2
3

output:

2
A

result:

ok correct answer and good plan!

Test #5:

score: 1
Accepted
time: 1ms
memory: 3720kb

input:

1 0
-2
-3

output:

0
B

result:

ok correct answer and good plan!

Test #6:

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

input:

1 1
-2
-3

output:

0
A

result:

ok correct answer and good plan!

Test #7:

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

input:

16 0
563531160 901961378 326222393 38801494 -547434528 171347734 -641624169 -614556786 -230653657 -623449793 218013688 125347629 776861393 -23045559 440210131 717981887
976179340 -523567563 -300519910 146448576 181573984 -770043558 -895018483 1747139 -413175024 18785014 -86727143 -416916804 -9386021...

output:

1048481948
BBBBBBBBBBBBBBBB

result:

ok correct answer and good plan!

Test #8:

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

input:

16 1
828581831 -565796065 528285292 -16209282 -446067242 74376000 -966790498 382921346 829244619 983017409 235137184 -232727302 991307649 288374377 227774026 17155366
-211384348 -253019623 955204272 393356827 -122294916 358217082 315557432 -356397900 69824283 -59471141 -928202598 594761760 432819412...

output:

1473121717
BBABBBBBBBBBBBBB

result:

ok correct answer and good plan!

Test #9:

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

input:

16 2
-442384745 -571610593 731154779 -947166494 71474477 -586253813 -95442106 504453042 765089330 25826531 225984171 -908107929 -308066512 113614729 -426306433 -509911000
918357661 -832817126 844591683 -969161483 -738583245 488648633 64190432 -766420441 15573092 348452288 768379034 -710865373 173424...

output:

930132218
BBBBBBBBBBABBBBA

result:

ok correct answer and good plan!

Test #10:

score: 1
Accepted
time: 1ms
memory: 3596kb

input:

16 4
-302856843 -704446786 598030079 505378352 -138702791 196372638 -694703850 -549621770 -750948261 874464003 -716338756 -89047132 607005584 -286975481 -416876561 773976691
201271759 445021472 -695837457 -770312273 -712657815 259121400 172922832 -900924791 904224283 140869064 57787292 509813063 262...

output:

432044232
BABBBBBBABBABBAB

result:

ok correct answer and good plan!

Test #11:

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

input:

16 6
179577748 308160828 5002304 348496637 115909283 -218322220 194384902 -63468584 244794726 -476259674 -733969266 365716734 446770096 -175916186 -771743620 57864381
608239422 -329017433 -62375369 -372101915 853364541 884150361 767834816 -207149456 -693304111 861109778 713532321 875128717 -77343687...

output:

785373271
BBBBAABBBAAABABB

result:

ok correct answer and good plan!

Test #12:

score: 0
Wrong Answer
time: 0ms
memory: 3572kb

input:

16 7
105932481 206740156 -330185295 -582460575 633451002 -367171456 892648655 -601201111 328123083 618426951 306584312 33242796 149435775 282987396 -984179725 -104905054
761411512 -32868500 -320471604 -272677310 748856789 -13865509 125894376 -79114911 -747555302 -730966794 -127943134 424864366 -4254...

output:

633451002
ABBBAABBBBABBAAA

result:

FAIL WTF you have a better plan???

Subtask #2:

score: 0
Wrong Answer

Test #28:

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

input:

80 15
-806772 -117802 266998 190197 -579000 615552 862955 -727153 870975 433653 583521 996193 563471 -615416 -924633 -296705 258551 -962057 -516030 -639148 -196720 656594 -667491 179513 98453 732582 -656179 525953 -955189 -711999 -708631 -6539 198681 -390094 611214 473002 -685751 787723 -511023 -183...

output:

1000383
ABBBBBBBBBBBABABBBBABBBBBBBBBABBBBBBBBBBBBBBBBABBBBBBBABBBBBBBBBBBABABBAABAAABAB

result:

ok correct answer and good plan!

Test #29:

score: 1
Accepted
time: 1ms
memory: 3724kb

input:

80 27
928779 -754470 -813332 -405414 -349390 -434427 705066 595688 -863781 578598 652744 850802 29480 441561 -872297 815242 353316 -355334 37328 -874346 -722719 -62461 -650942 -286428 -899854 151553 -382903 392123 -352713 721952 -552143 358498 -947110 -505541 -72903 -324323 216970 684948 715042 -738...

output:

1250993
BBBBBABBABABBBBAABBBBBBBBBBBBBBABBABBBBBBBBBBBBBBBBBABAAAAABABAAAAAAAABBAABAAABB

result:

ok correct answer and good plan!

Test #30:

score: 1
Accepted
time: 1ms
memory: 3660kb

input:

80 45
69594 17146 55793 -999416 -637207 338604 752539 428350 -677453 878359 701201 784328 -611799 -865683 -793199 417853 -329841 172472 -872731 -956337 358692 -729361 -919696 807513 75078 981786 586400 -314267 640745 5673 120163 311787 -433336 -494543 627480 -943048 -315355 -34937 -156968 161067 -17...

output:

901102
BBBAABBABBBBBBBBBABBBABBBBBBBBBBBBBBBAAAAAAAAAAAAAAAABAAAAAAAABAAAAAAAAAAAAAAAAB

result:

ok correct answer and good plan!

Test #31:

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

input:

80 60
-194856 -667050 975464 845093 -380835 -293631 156140 268617 -412208 -976697 181685 -891165 980656 317739 -196674 47226 -263447 261768 -319373 808466 -119779 551585 577818 518563 -844312 -195587 986121 -601304 -392560 -737368 276651 32952 547319 738534 -624610 338545 587366 -860501 551670 80772...

output:

1473586
BBBBBBBBBBAABAAAAAAAABBAAAAAAAABAAABBAAAABBBAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABA

result:

ok correct answer and good plan!

Test #32:

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

input:

80 72
-976733 52411 -76495 124646 -668652 577474 26622 -416148 -72673 -784224 124463 -957639 -99133 -598523 -144338 -323401 -840925 841729 849486 777021 934870 -115315 103702 -47061 648047 -749854 -123494 845514 209916 596900 -951361 -40521 884102 749532 564829 -976207 55041 -991647 -320340 944561 -...

output:

2325607
AAAAAAAAAAAAAAAAABABBAAAAAABABAAABAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAABAAA

result:

ok correct answer and good plan!

Test #33:

score: 1
Accepted
time: 1ms
memory: 3664kb

input:

79 38
-997451 -982746 -910799 -977003 -972855 -875328 -996828 -840527 -988218 -929740 -947366 -993351 -997495 -950301 -995526 -996173 -997156 -978937 -980286 -931695 -942179 -738628 -997624 -983277 -984355 -938311 -979575 -977668 -991365 -994163 -998751 -994134 -945586 -920799 -997488 -999631 -98035...

output:

0
BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBABBBAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA

result:

ok correct answer and good plan!

Test #34:

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

input:

80 31
-883544 -427936 -999936 -713933 -752328 -865112 -835016 -150430 -333936 -997725 -955747 -941748 -593709 -664824 -853061 -800153 -744894 -276232 -887385 -905481 -870777 -995270 -867813 -896756 -734738 -772199 -812570 -370881 -989617 -944617 -337 -846543 -933019 -848227 -899366 -58734 -952617 -2...

output:

0
BBBBBBABBBBBBBBABBBBBBBBBBBABBBBBBBBBBBBBBBBBBBBBBBBAAAAAAAAAAAAAAAAAAAAAAAAAAAA

result:

ok correct answer and good plan!

Test #35:

score: 1
Accepted
time: 1ms
memory: 3728kb

input:

80 38
-945162 -467444 29743 -838252 -661798 -519723 -754752 528931 -551618 462077 -459240 -739960 -738724 66478 -770642 93581 -991476 -893037 -920364 644971 -424625 -217793 -953124 -566351 -379254 349752 -416702 -131437 -683574 -480661 -187479 286136 -966012 -847004 -978180 104154 -934422 -684130 42...

output:

196627
BBBABBBBBBBBBBBBBABBBBBBBBBBBBBBBBBBBBBBBBAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAB

result:

ok correct answer and good plan!

Test #36:

score: 1
Accepted
time: 1ms
memory: 3652kb

input:

79 31
962776 982088 941969 -195515 923806 894326 856979 347050 788263 727019 467074 500116 917595 725602 141593 998246 985094 335194 840826 956183 949855 334934 922303 834512 574037 440673 -230530 740060 -241510 273324 -603592 -181997 718903 862184 960463 225391 597218 804665 630140 977673 368497 76...

output:

25814842
BBBABBBAAABBABABBBABBAABAAABAAAAAABABBBBBBBBBBBAAAABBABBBBBBAAABBABABBABBBBBBBA

result:

ok correct answer and good plan!

Test #37:

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

input:

79 33
990169 996263 933267 987763 916155 794010 899558 999864 962106 188360 966336 659551 729428 993943 886426 981355 991640 991093 994226 999446 930646 925232 863815 716303 992978 990239 991049 973362 173532 993918 992037 987378 998575 804749 967357 931613 908769 978601 939037 922886 738422 927038 ...

output:

59486245
BBBBABABBABAABABBBBBBAAABBBBABBBBABBBBBBAAABAABBABBAAABBAAAABAAABBBAAAAABABBBBB

result:

ok correct answer and good plan!

Test #38:

score: 1
Accepted
time: 1ms
memory: 3668kb

input:

80 45
999984 999998 999995 1000000 999505 999923 999991 1000000 999988 999994 999923 999615 999988 999904 999385 999984 1000000 999997 999994 999999 999995 999972 999819 1000000 999983 1000000 999982 1000000 999527 999990 999882 999998 999970 999966 999998 999996 999241 999915 1000000 999987 1000000...

output:

79963029
ABABAAABABAABAABBABBBAABABABAABBAABBAABABBAABAABAABABBAAAAABAAABAABABABBAABBBAAB

result:

ok correct answer and good plan!

Test #39:

score: 1
Accepted
time: 1ms
memory: 3596kb

input:

80 2
-1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -100000...

output:

372676
BBBBBBBBBBBBBBBBBBBBBBBBABBBBBBBBBBBBBBBBBBBBBBBBBBBABBBBBBBBBBBBBBBBBBBBBBBBBBB

result:

ok correct answer and good plan!

Test #40:

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

input:

80 3
-1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -100000...

output:

286702
BBBBBBBBBBBBBBBBBBBBABBBBBBBBBBBBBBBBBBBABBBBBBBBBBBBBBBBBBBABBBBBBBBBBBBBBBBBBB

result:

ok correct answer and good plan!

Test #41:

score: 1
Accepted
time: 1ms
memory: 3636kb

input:

80 18
-1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -10000...

output:

13365
BBBABBABABBBBAABBBBABBBBBBBBBBBABBABBABABBABBABBBABBBBBBBBBBABABABBBBBBBBBBBBABA

result:

ok correct answer and good plan!

Test #42:

score: 1
Accepted
time: 1ms
memory: 3724kb

input:

80 18
-1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -10000...

output:

9329
ABBBBABBBBAABBBBBBABBABABBBBBBBABBBBBABBBBBBBBBBBBBBBBBBBBABBABABBBBAABABBBAABAB

result:

ok correct answer and good plan!

Test #43:

score: 1
Accepted
time: 1ms
memory: 3724kb

input:

80 40
16585 13391 18094 17102 17950 12628 16236 18567 1679 14438 8357 7580 18616 16834 18298 15155 -8763 18067 17803 18733 16567 13897 15360 18284 16307 4198 17899 14570 18269 16254 15274 16984 14906 1631 12953 18746 18268 11700 18735 12309 17571 4111 18207 17767 16652 17983 18052 16774 18388 6187 1...

output:

18146
ABABABABAABABABAABABABABABABBABABAABBABABABABABABAABABABABABBABABABABBABBABABABA

result:

ok correct answer and good plan!

Test #44:

score: 1
Accepted
time: 1ms
memory: 3640kb

input:

80 40
1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1
-1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -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:

0
BABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABA

result:

ok correct answer and good plan!

Test #45:

score: 1
Accepted
time: 1ms
memory: 3652kb

input:

80 40
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 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
-1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -1000000...

output:

32
BBBBBBBBBABABABABABABABABAABAABAAABAAAAAAAAABAAAABAABAABABABABABABABABABBBBBBBBB

result:

ok correct answer and good plan!

Test #46:

score: 1
Accepted
time: 1ms
memory: 3656kb

input:

80 40
1 1 0 1 0 0 0 1 1 1 0 1 0 1 0 0 0 0 0 0 1 1 0 0 1 0 0 0 0 0 1 0 0 1 1 0 1 1 0 0 0 1 1 1 1 1 0 1 1 1 0 0 1 1 0 1 1 0 1 1 0 0 1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 1 1 0
-1 -1 1 -1 0 1 0 -1 -1 -1 -1 -1 0 -1 -1 0 -1 0 0 -1 -1 -1 1 0 -1 -1 0 -1 1 1 -1 0 -1 -1 -1 -1 -1 -1 0 0 0 -1 -1 -1 -1 -1 1 -1 -1 -1 1 ...

output:

0
BBABAAABBBABABAAAAAABBAABAAAAABAABBABBAAABBBBBABBBAABBABBABBAABBBBAAAABBBBAAABBA

result:

ok correct answer and good plan!

Test #47:

score: 0
Wrong Answer
time: 1ms
memory: 3596kb

input:

80 40
40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 -1562 1000000 -999963 1000000 -999965 1000000 -999967 1000000 -999969 1000000 -999971 1000000 -999973 1000000 -999975 1000000 -999977 1000000 -999979 1000000 -999981 1000000 ...

output:

999999
BBBBBBBBBBBBBBBBBBBAAAAAAAAAAAAAAAAAAAAABBABABABABABABABABABABABABABABABABABABAB

result:

FAIL WTF you have a better plan???

Subtask #3:

score: 0
Wrong Answer

Test #49:

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

input:

400 35
282603 437907 189144 -306523 875091 -129096 135690 959139 919604 -510810 18016 -898443 -410507 -528852 -639057 503910 461833 267527 244577 -103136 -909424 -892963 -870210 -89935 509282 -930568 808009 773531 257190 -828648 -861529 -970580 -539999 260846 -620133 -979364 640196 388456 491785 -81...

output:

1451726
BBBBBBABBBBBBBBBBBBBBABBBABBBBBBABBBBBBBBBBBBBBABBBBABBAABBBBBBBBBBBABBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBABBBBBBBBBBBBBBABBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBABBABBBBABBABBBBBBBBABBBBBBBBBBBBBBBBBBBBBBBBABBBBBBBBBBBABBBABBBBBBBBBBBBBBBBABBBBBBABBABBBBABBBBBBBBBABBBBBBBBBBBBBBBBBBBBBBBBABBBBBABB...

result:

ok correct answer and good plan!

Test #50:

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

input:

400 147
-499274 -763716 -917948 -928896 587274 -661648 85089 791801 -788390 -337494 -39206 -964917 557233 681332 -42532 133283 -15962 847488 -684639 -232655 145225 342064 655675 -555876 -515787 -107940 -713354 639701 733221 455074 -62778 750586 -26225 145399 597677 223312 -18574 284072 -282151 -1373...

output:

1573326
BBBBBABBABBBBBBBBBBABBBAABBBBBBBBBBAAABBBBBBBBBBBBBBBBBBBBBBBBBABBBBABBBBBBBBBBABABBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBABBBBBBBBABBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBABBBBBBBBBBBBBBBBBBBBBABBABABBBBABBBBBBBBBBBBBBBBBBBBBABBABBBBBBBBBBBBBBBBABBBBBBBBBBBBBBBBBBBAABBABBAAAAAAAAAAAAAAAAAAAAAAAA...

result:

ok correct answer and good plan!

Test #51:

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

input:

400 197
-664041 599617 -48823 942375 816884 111383 -590227 114641 -523145 -66104 -41295 -513964 23242 -652674 -42351 -208973 -76013 -545790 -131281 -467853 -432929 -250546 358550 -944509 485907 820367 50587 -66689 -273322 -287967 93710 677113 437003 -416163 -682784 960716 -989409 -462575 845840 -272...

output:

1292509
BBBBBBBBABBBBBBBBABBBBBBBBBBBABBBBBBBABBBBBBABBBABBBABBBBBABBBBBBABBBBBBBBBBBBAAABBBBBBBBBBABBBBBBBBBAAABBBABBBBBBBBABBBBBBBBBABBBBBABABBBBBBBBBBBBBBBABAABBABABBABBABBBABBBBBBABABBBBBBBBBBBBBBBBABBBBBBBBBBABBBAABBBABABAAAAAAAAAAAAAABAAAABAABBAAAAAAABAABAAAAAAAAAAAAAAAAAAAAABAAAAAABABAAAAAAAA...

result:

ok correct answer and good plan!

Test #52:

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

input:

400 257
475166 -630377 870848 348373 476912 -599769 -669199 -25935 -336817 107212 27928 -706883 -510749 431065 9985 -579600 -527046 108461 958661 -549844 621720 -917446 401861 687625 -460245 239338 450308 -255652 846581 -953700 221827 -931089 -708788 -610527 17599 270679 430739 -565350 -524440 72504...

output:

1266945
BBBBBBBBABBBABBBBBBBBBBBBBBBBBBBBABBBBBBBBBBBBABBBBBBBBBBAABBABAABAAABBBBBABBABBBBBBBBBBBBBBBBBBBBBBBBBBBBABBBBBBBBBBBBABBAABABABABBBAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAABAAAAAABAAABABAAAAAAABAAAABABAAAAAAAABAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABABAAAAAAAAAAAA...

result:

ok correct answer and good plan!

Test #53:

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

input:

400 372
210716 685428 -307556 -372074 706522 350253 -748171 -319718 -71572 -217742 -21689 -852274 974418 -464431 606510 532347 -558726 197757 -487982 -785042 -295261 -180689 -99017 -190064 -941125 -882902 -561233 -906909 -159962 303260 895742 868994 -293088 -599529 -843509 -526646 -745458 714766 729...

output:

2896713
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAABAAAAAAAAAAAABAABAAAAAAAAAAAAABAAAAAAAAAAAAAAAAABAAAAABAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABABAAAAAAAAABAAAAAABAAABBABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAABBAAAAAAAABABAAABAAAAAAAAAAAAAAAAAAAAAAAAA...

result:

ok correct answer and good plan!

Test #54:

score: 1
Accepted
time: 1ms
memory: 3652kb

input:

399 196
-980499 -999052 -855043 -999390 -982791 -987200 -999808 -878173 -946218 -860336 -980155 -719827 -952639 -474100 -974250 -998201 -990990 -993396 -985772 -969592 -999920 -985264 -939460 -990318 -999390 -924918 -611343 -973343 -998344 -998344 -998639 -947560 -908169 -994430 -995260 -998700 -897...

output:

0
BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA...

result:

ok correct answer and good plan!

Test #55:

score: 1
Accepted
time: 1ms
memory: 3736kb

input:

399 210
-971089 -430545 -969039 -838400 -890740 -688234 -999904 -969078 -989776 -965337 -925768 -967879 -999037 -677515 -924384 -990673 -944949 -955868 -557480 -952916 -888157 -686325 -946317 572562 -90422 -466094 -724604 -285157 -967792 -847260 -981342 -947480 -697225 -717403 -965455 -486962 -97425...

output:

317657
BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBABBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA...

result:

ok correct answer and good plan!

Test #56:

score: 1
Accepted
time: 1ms
memory: 3640kb

input:

400 190
2697 -38389 -598069 -168539 231770 -65433 -737643 -947902 -48094 130598 -840546 -954760 -715225 -698768 -13956 -652250 -889370 -499280 -949576 -906842 148338 -626952 -785731 -773340 -982028 -326373 -789204 -430922 -763976 -451701 -873539 -931773 312120 -722330 -719305 -883332 -976755 -928277...

output:

413619
BBBBBBBBBABBBBBAABBBBBBBBBBBBBBABBBBBBBBBBBBBBBBBBBBBBBBABBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBABBBABBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBABBBBBABBBBBBBABBBBBBBBBBBBBBBBBAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABBAAABAAAABAAAABAAAABBAAAAAAABAA...

result:

ok correct answer and good plan!

Test #57:

score: 1
Accepted
time: 1ms
memory: 3696kb

input:

400 208
-333302 872121 526193 -294 850068 919469 915136 -447303 558406 796458 850223 960256 988007 815008 813206 953269 974989 918495 605683 928149 909409 942496 -372461 -12439 747709 487031 254323 287024 331895 373777 975387 429819 718828 741536 911823 -167707 229992 -431523 -480719 -613316 156551 ...

output:

115308361
ABAABBBABABBBBBBBAAAABAAAABBAABBBBBABAAAAAABBBAAABAABAABABABBAAAAABABAAABBAABAAAABBBABABAABBBBAABBBBAABBBAABAAAABAAABBBBABABABBABABAABBAABABAAAAABABABBBAAAABABABBAAAABAABBBAABBAABAAAAAABABABBBBABAABABBABABBABBABAABBBAAABAABAAABBBABABAAABAABABBAABBBABBBABBABAABABAAABBAAAABBBABAABABBBABBAABA...

result:

ok correct answer and good plan!

Test #58:

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

input:

399 219
764468 996027 989977 895378 999994 985278 843485 966463 999771 992337 944189 957381 622714 961684 605989 960770 785241 972856 997123 888936 999745 871109 824514 1000000 892052 336955 995226 649009 990767 999298 985865 525909 963854 969893 380973 959961 999514 960853 999553 684950 989626 9371...

output:

318837973
ABBAAAABABBAAAABABBABAABAABABBBABAABBAAABABBABBBAAAAABAAABBBBABAABBBBBBABABBABAABABBAAAABBBABABBBBAAAAAABABABBBBBAAAAAAABABBABABBBAAABBABBABBAABBBBABABAAAAABAAAAAAABABBBBAABBBBAAABAAABBBABABAAAABBBABBBABBAAABABABBBABAAABBBAABAAAAAABABAABABAAAAABABAABBBBABBAABAABAABAAAAABAABBBAABAAABABAABBA...

result:

ok correct answer and good plan!

Test #59:

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

input:

399 202
999996 999999 999958 999992 1000000 999999 999992 999913 999966 999969 999914 1000000 999980 999995 999479 999984 999984 999977 999996 999993 999999 978254 997662 999999 999999 999977 1000000 999608 1000000 999999 1000000 999908 999999 999929 999995 999967 1000000 999859 999991 999868 999991...

output:

398840541
BBABBBBAAAABABAABBBBBAAABBBABBBBAAAABAAABABBBABBBABBAABBBABAAABBBABAAABABBAABBAABBBBBBAAABABBAABBAAAABBABBBABBBAABBBBAAAAABBBAABBABBAAABBBBBABBBBBAABABBAAABAAAABAABABBABBABAAAAABBAABAABABABBBBAABAAABBABBBBAABBABBAABBABBBBAABBBABAAAAABBABBAABBAAAABABBAAAAAABBAAABBABABAABABBABAABBABBBABABBBA...

result:

ok correct answer and good plan!

Test #60:

score: 1
Accepted
time: 1ms
memory: 3640kb

input:

400 393
458 3719 3686 3622 726 2739 3680 3615 2442 3693 2874 3269 3585 3494 3383 3603 2103 2701 2161 3233 1819 2404 1940 1200 -456 3600 3304 3268 2903 3651 3725 3533 3750 2469 3342 3667 1309 3725 1739 2667 1773 3556 3430 3750 3731 2815 3361 3553 2268 2001 3699 3742 997 2265 985 1670 3732 989 3420 67...

output:

139102
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA...

result:

ok correct answer and good plan!

Test #61:

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

input:

400 13
-1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -1000...

output:

79906
BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBABBBBBBBBBBBBBBBBBBBBBBBBBBABBBBBBBBBBBBBBBBBBBBBBBBBBBBBABBBBBBBBBBBBBBBBBBBBBBBBBABBBBBBBBBBBBBBBBBBBBBBBBBABBBBBBBBBBBBBBBBBBBBBBBBBBBBABBBBBBBBBBBBBBBBBBBBBBBBBABBBBBBBBBBBBBBBBBBBBBBBBBBBABBBBBBBBBBBBBBBBBBBBBBBBBBABBBBBBBBBBBBBBBBBBBBBBBBBBBBABBBBBBBBBBBBBB...

result:

ok correct answer and good plan!

Test #62:

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

input:

400 28
-1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -1000000 -1000...

output:

6446
BBBBBBBABBBBBBBBBBBBBABBBBBABBBBBBBBBBBABBBABBBBBBBBBBBBBBABBBBBBBBBBBBBBBBBBABBBBBBBBBBBBBABBBBBBABBBBBBBABBBBBBBBBBBBBBBBBBBBBBBABBBBBBBBBBBBBBBBBBBBBABBBBBABBABBBBBBBBBBBBBBBBBBABBABBBBBBBBBABBBBBBBBBBBBABBBBBBABBBBBBBBBBBBBABBBBBBBBBBBBBBBBBABBBBBBBBBBBBBBABBBBBBBBBABBBBBBBBBBBBBBBBBBBBBABB...

result:

ok correct answer and good plan!

Test #63:

score: 1
Accepted
time: 2ms
memory: 3660kb

input:

400 360
1857 -1543 -1232 -3274 3408 2845 -1080 3131 -3684 -2586 -1266 3412 -355 3487 -504 -1198 1522 278 -2374 1796 1259 295 -1937 -2254 856 752 3446 -778 -795 3066 -505 986 1288 1224 2177 -39 530 -2294 1163 -2360 -874 580 1502 2075 2066 -1337 3025 -3039 1367 2139 -1867 -3254 2358 2461 -978 -2671 14...

output:

4778
AAAAABAAAAAAABAAAAAAAAAAAABAAAAABAAAAAAAAAAABAAAAAAAABAAAAAABAABAAAAAAABAAAAAAAAAAAAAAABAAAAAAAAAAABAAAAAAAABAAAAAAAAAAAAAAABAAAAAAAAABABABAAAAAAAABAAAAABAAAAAAABAAAABAAAAAAABAAAAAAAAAAAAAAAAAAAABAABAAAAAAAAABAAAAAAAAAAAAAAAABAAAAAAAAAAAAABAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAABAAABAAAAA...

result:

ok correct answer and good plan!

Test #64:

score: 1
Accepted
time: 1ms
memory: 3532kb

input:

400 200
3437 3550 3695 3288 3490 3468 2108 2722 3697 -487 3745 3427 2647 3728 3134 2547 3644 2631 3186 3064 3455 3072 2785 2166 3468 2604 3629 3072 2718 3233 3625 3592 3573 3747 3224 2839 3258 3106 1454 2238 2183 3555 3735 3396 1569 2849 95 3440 699 3400 2872 3748 3711 3399 3400 2696 3266 1506 3275 ...

output:

3711
ABABABABAABABBABABABABABABABABABABABABAABABABAABABABABABABABABABABABAABABABABABAABABABABBABABABABABABABABABBABABABABABABABABAABBABBAABABABABBABABABABABABABBAABAABABABABABABABABABABABBABABABABABABABABABABABABAABABABABABABABABBABBABABABABABABABABABABAABABABABBABABBABABABABABABABABABBABABBABABBABB...

result:

ok correct answer and good plan!

Test #65:

score: 1
Accepted
time: 1ms
memory: 3596kb

input:

400 200
-1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 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:

0
ABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABAB...

result:

ok correct answer and good plan!

Test #66:

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

input:

400 200
201 200 199 198 197 196 195 194 193 192 191 190 189 188 187 186 185 184 183 182 181 180 179 178 177 176 175 174 173 172 171 170 169 168 167 166 165 164 163 162 161 160 159 158 157 156 155 154 153 152 151 150 149 148 147 146 145 144 143 142 141 140 139 138 137 136 135 134 133 132 131 130 129 ...

output:

156
BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABAABAABAABAABAABAABAABAABAABAAABAAABAAABAAAABAAAABAAAAABAAAAAAAABAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAABAAAAAABAAAAABAAAABAAABAAABAAABAABAABAABAABAABAABAABAABAABABABABABABABABABAB...

result:

ok correct answer and good plan!

Test #67:

score: 1
Accepted
time: 1ms
memory: 3576kb

input:

400 200
1 1 0 1 0 1 0 1 0 0 1 1 1 1 0 1 0 0 0 0 0 1 1 1 1 1 1 1 1 1 0 0 1 1 1 1 1 0 0 0 0 1 0 1 0 1 1 0 0 0 0 1 1 1 0 1 0 1 1 0 0 0 1 0 1 0 0 1 1 0 1 0 0 0 1 0 1 0 1 1 0 1 1 1 1 0 1 0 0 0 1 0 0 1 0 1 0 1 1 1 1 1 1 0 0 0 0 1 1 1 0 1 0 1 0 1 0 1 0 1 1 0 1 1 0 1 1 0 0 0 1 1 1 0 0 0 0 0 1 0 0 1 1 1 1 1 ...

output:

0
BBABABABAABBBBABAAAAABBBBBBBBBAABBBBBAAAABABABBAAAABBBABABBAAABABAABBABAAABABABBABBBBABAAABAABABABBBBBBAAAABBBABABABABABBABBABBAAABBBAAAAABAABBBBBABBBAABBABAABAABAABABBABAAAABAABABBABBABBAAABABBAAAABBAAABAAABBBAABAABAABAAAAABAAABBABAAAAAAAAAABAAABAABBBBBBBABBBABBBBABBBBBBBABABBBAABBAAAAAABBAAAAABB...

result:

ok correct answer and good plan!

Test #68:

score: 0
Wrong Answer
time: 1ms
memory: 3604kb

input:

400 200
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...

output:

999999
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBAABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABAB...

result:

FAIL WTF you have a better plan???

Subtask #4:

score: 0
Wrong Answer

Test #70:

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

input:

2000 196
53359475 -389458277 27443906 213187393 525501489 -563370396 -780381693 990456678 -966127727 -926000233 -208464373 99915107 429573188 471624215 -533030054 790604637 -643361957 -590004012 412092763 -856885908 -857464588 176819165 -218862254 802719311 794718647 525976558 341493086 692047249 14...

output:

2939757937
BBBBBBBBBABBBBABBBBBBBBBBBBBBBBBBBBBBBBBBBBBABBBBBBBBBBBBBBBBBBBBBBABBBBBBBBBBABBBBBBBBBBBABBBBBBBBBBBBBBBBBBBBBABBBBBBBBBABBABBBBBABBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBABBBBBBBBBBBBBBBBBBBBBBBBBBBBBBABBBBBBBBBBBBBBBBBBBBBBABBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBABBBBBBBBBBBBBBBBBBBBBBBBBBB...

result:

ok correct answer and good plan!

Test #71:

score: 0
Wrong Answer
time: 8ms
memory: 3624kb

input:

2000 620
-440775853 475665691 380498790 -481751408 -681829352 -466284677 -329805774 912951785 -482165317 -129240263 849212701 580279966 -707232219 -293262926 600453383 74492327 -864164800 440292860 46322716 240344970 -288767901 834253329 830096007 -858195654 -758714746 -146011182 709555860 -33174157...

output:

3090280208
BBBBBBBBBBBBBBBBABBBBBBABABBBABBBBBBBBBBBBBBBABBBBBBBBBBBBBBBBBBBBBBBBBBBBBABBBBBBBBBBBBBBBBBBBABBBBBBBBBBBBBBBABBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBABBBBBBBBBBBBBBBBBBBBBBBABBBBBBBBABBBBABBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBABBBBBBBBBBBBBBBBBBBBBABBBBBBAABBBBBBBBBBBBBBBBBBBBBBABBBBB...

result:

FAIL WTF you have a better plan???

Subtask #5:

score: 0
Wrong Answer

Test #91:

score: 1
Accepted
time: 37ms
memory: 3896kb

input:

8000 819
-80520 58858 -66529 -89399 -29326 -30844 -11574 101653 -19630 11590 -82857 -41398 47160 -103616 -72194 58679 39849 -58831 -74715 -21618 -42309 -108923 -62472 88514 82625 -38663 17205 -19790 -88376 -108625 67220 -93508 72195 72062 55863 118603 -58888 75786 -113297 -53630 -24366 119300 19571 ...

output:

323537
BBBBBBBBBBBBBBBBBABBBBABBBBBAABABBBBABBBBBBBBBBBBBBBBBBBBBABBBBBBBBBBBBBBBBBBBBBBBBABBBBBBBBBBBBBBBBBABBBBBBBBBBBBBBBBABBBBBBBABBBBBBBBBBBBBBBABBBABBBBBBBBABABBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBABBBABBABBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBABBBBABBBBBBBBBBBBBBBBBBBBBBBBBBB...

result:

ok correct answer and good plan!

Test #92:

score: 1
Accepted
time: 37ms
memory: 3868kb

input:

8000 2647
38642 46138 36494 -42389 -95522 81653 -95362 21680 -951 93428 -67784 99778 117299 27429 -86811 -57996 70448 116447 10946 86304 38209 102184 3975 52506 -87847 68023 103894 101483 18155 -3659 -107034 -52931 79264 -23536 -86613 -109688 95333 116658 54939 115102 -50734 -18122 89517 -116770 -77...

output:

312702
BBBBBBBBBBABBBBABBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBAABBBBBBBBBBBBBBBBBBBBBBBBBBBBABBBBABBBBABBBBBABBBABBBBBBBBBBBBBAABABBABBBBABBBBBBBBBBBABBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBABBBBBBBBBBBBBBABBBBBBABBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBABBBBBAABBBBBBBBBBBABBBABBBBBBBBBBBBABB...

result:

ok correct answer and good plan!

Test #93:

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

input:

8000 3920
-25589 85223 -62150 42955 15143 56075 -27583 98101 -16238 -51236 -43551 41451 -25564 -104186 -83589 -111531 -80154 -56717 37807 69198 91728 -51738 -38479 -40110 -109380 -19991 -67257 -76505 -115315 -109520 81113 -114280 11869 107368 -36553 112849 -110212 25970 110377 -87727 35696 -37943 11...

output:

324354
BBBBBBBBBBBBBBBBBBBBBBABBBBBBBBBABABABBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBABBBBBBBBBBBBBBBBBABBBBBBBBBBABBBBBBBABBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBABBABBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBABBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBABBABBBBBBBBBABBBBABBAA...

result:

ok correct answer and good plan!

Test #94:

score: 0
Wrong Answer
time: 34ms
memory: 3780kb

input:

8000 5410
114040 106469 40873 -32435 -5752 871 53695 -90313 2441 -41698 103082 -50842 -71293 26859 107829 97594 9245 21455 3703 -83348 23307 -80632 -10366 -3818 -5885 -10411 98699 107908 31714 -38520 26624 -55864 -66861 61411 -61428 61419 -14791 -96520 83913 33540 -69939 73796 -105534 -12097 -59890 ...

output:

334609
BBBBBBBBBBBBABBBBBBABBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBABBBBBBBBBBBBBBBBBBBABBBBBBBBBBBABBBBBBBBBBBBBBABBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBABBBBBBBBBBBBBBBBBABBBBBBBBBBBBBBBBBBABBABBBBBBBABBBBBBBABBBBBBBBBBBBBBBBBBBBBBBABBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBABBBBBBBBBBBA...

result:

FAIL WTF you have a better plan???

Subtask #6:

score: 0
Wrong Answer

Test #113:

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

input:

25000 2601
684640294 598432913 -623227598 -736881259 -283494811 310898894 999454243 606030163 480256573 -699956166 388593535 -71688332 824098087 -969996868 53222581 730834964 -294074303 -949074306 -245586236 -170646877 -543582352 -466099725 -422182532 218666222 -822502298 -448284895 465111319 550729...

output:

2987102435
BBBBBBBBBBBBBBBBBBBBBBBBBBBBABBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBABBBBBBBBBBBBBBBBBBBBABBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBABBBBBBBBBBBBBBAABBBBBBBABBBBBBBBBBBBBBBBBBABBBBBBABBBABBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBABBBBBBBABBBBBBBBBBBB...

result:

ok correct answer and good plan!

Test #114:

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

input:

25000 8178
190504966 -875139058 -756352298 568179941 -641155725 581744768 -454363695 189829332 14056645 -50679842 -41948815 -762237201 -312707320 -833336580 210136099 552779740 -514877146 -66261080 -73299197 978461503 -899578082 191334439 678653231 384666619 -913186188 367946789 -823919219 -17449193...

output:

3628981392
BBBBBBBBBBBBBBBBBBBBBBBBABBBBBBBBBBBBBBBBBBBBBBBBBABABBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBABBBBBBBBBABABBBBABBBBBABBBBBBBBBBBBBABBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBABBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBABBBBBBBBBBBBBBBABBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB...

result:

ok correct answer and good plan!

Test #115:

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

input:

25000 12436
308642626 992024750 -715716843 -929568624 -386543651 -297739432 -77055520 -352464903 -990200369 650473984 477671173 -307473335 90584199 766073211 219565971 -163332570 266359851 -671667278 -74772313 -362820453 -183397749 848768603 -272388509 -400301910 995323335 -104679803 55924132 467430...

output:

3335489399
BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBABBBBBBBBBBBBBBBBBBBABBBBBBBABBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBABBBABBBAABBABBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBABABABBBABBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBABBBABBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBABBBBBBBBBBBB...

result:

ok correct answer and good plan!

Test #116:

score: 1
Accepted
time: 105ms
memory: 4252kb

input:

25000 16625
448170528 4632363 -848841543 -938966693 232365354 -78771060 373520399 645337788 -506237959 -700249693 460040663 511587462 -994343706 -975383849 -646950593 -879444880 244918156 870410171 609295303 -701931497 411575447 -958586576 316797749 -34940365 930240438 394246185 -746926822 718778536...

output:

5381096765
BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBABBBBBBBBBBBBBBBBBBBBBBBBABBBBBBBBBBBBBBBBBBABBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB...

result:

ok correct answer and good plan!

Test #117:

score: 1
Accepted
time: 86ms
memory: 4128kb

input:

25000 22634
-45964800 -128203830 -930088741 -948364762 22188086 703855391 -78257699 -772902883 -487064891 96510277 -968461848 -521868096 845420807 624025942 -490037075 -618987271 24115313 -758426109 582221194 -43213452 151185861 -301152412 -729850135 -819908894 -137013371 -789522132 -916921134 -1539...

output:

3290020876
BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBABBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBABABBBBBBBBBABBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBAAB...

result:

ok correct answer and good plan!

Test #118:

score: 1
Accepted
time: 36ms
memory: 4192kb

input:

24999 12408
-993066398 -987759073 -999901870 -995785850 -875145805 -766067687 -999707968 -894861639 -696682722 -998045392 -826166859 -968710512 -999816719 -685173934 -999121677 -995313954 -949380754 -989299930 -980780197 -840322612 -532029014 -998333596 -937707721 -915864264 -988285928 -990188170 -9...

output:

0
BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBABBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB...

result:

ok correct answer and good plan!

Test #119:

score: 1
Accepted
time: 38ms
memory: 4112kb

input:

25000 12539
-727972901 -851608779 -933105013 -275480356 -999287616 -978078421 -430540880 -992530808 -972015370 -773634867 -756008837 -990039771 -142519650 -920359567 -677967801 591108502 -913364467 -139506456 -954264137 -733797735 -382350097 -909975031 -614703516 -785003206 -872563571 -904378628 -73...

output:

384141552
BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBABBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB...

result:

ok correct answer and good plan!

Test #120:

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

input:

25000 12436
-355223944 -575730090 -305452013 -665504745 -785292463 -561924245 -888715633 -990008725 498923871 502409603 -892241876 -973768961 -688496090 -268068453 -208931014 -244510056 256178727 -224081567 -287430116 -928229595 945827160 -57439084 123667054 363110885 -521107697 -568757096 -31086149...

output:

897993941
BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBABBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB...

result:

ok correct answer and good plan!

Test #121:

score: 1
Accepted
time: 162ms
memory: 5352kb

input:

24999 12552
373139630 725242427 527905085 589889636 968438081 864884212 261504404 395657290 -543042745 999490637 947710697 454412713 764282458 766171518 -53787628 398037847 956562977 790234029 82653098 526425509 975932718 -250487319 -14299315 939558961 970857100 289703588 476255484 981659434 -491918...

output:

6471359470036
ABBBBBABABBABAABAABABAABBAABAABABABAAABBBABABABBABABBABAABBAABAABAAABAABBAABABBAABABBBBAABBABBAAABABABAABBABBABABAAABBABABABABAABBAAAABBBBABABBBBABAABABAAABABABBBBABABAAABBBBBAAABBBABBAABABABBBBABBAABBBABABAAABBABABABAAABABBBBAAABABBABBABBABABABBBABABBABAABBAABBBABAABBBAABBABAABBBBABBB...

result:

ok correct answer and good plan!

Test #122:

score: 1
Accepted
time: 171ms
memory: 5416kb

input:

25000 12547
980511092 902571756 999942249 999972546 999055301 982371638 990884041 992267466 995688241 805782714 710265851 998531113 500922480 995618651 970286608 945785302 950793916 971949705 481776903 992974881 990767615 985904861 936001969 999379830 938761510 985408646 965315450 998352740 89775725...

output:

19817644427572
BBBBBBBABABBABAAABABABABAAABBBABABAAABBBABAAAABABABBAAABABBBBAAABBAAABBAABAAABBBABBABAAAABAABABBBBBAAABBBBBBAABAAAAABABBBBABBBAABBBAABBBBBBAAAABAAABBBABAAAAABBBBABBBAABBABAABBABBBAAABABBBBAAAABAABAABBAABAABABABABBABABBABAAABBBAAABBBBABAAAAAABABABBBBBBBAAAABBAABAAABAAAABBBABAABABBBBBAB...

result:

ok correct answer and good plan!

Test #123:

score: 1
Accepted
time: 164ms
memory: 5636kb

input:

25000 12597
999998558 999999997 999951567 999943935 999960382 999986304 999998351 999999711 999973595 999950673 999996527 999676685 999999158 999999979 999999792 999997666 999993464 999986109 999997048 996066757 999998848 999983341 999854359 999999808 999981180 999417247 999999957 999996583 99999490...

output:

24988324195761
BBBBABBABBBBBBBAABBABBAAABBABBAABBBABABABAABBBABBAAAABAABBAABABAABBBBAAAAABAAAAABBABABBAAAAABABBABAAAABABAABABAABBBBAABABBAABABAABAABABBAAAAAABAAABAABBBABBABBAAABAAABBBAAABBABAAABBBBBAABBBBAAAABBBBBAAAABAAAABAABBBBBAAABABBBBAAAABBABBBABBBABBABABAABBBBBBBBABABAAABBABABBBABBBBAAABABBBAB...

result:

ok correct answer and good plan!

Test #124:

score: 1
Accepted
time: 64ms
memory: 4112kb

input:

25000 11
-1000000000 -1000000000 -1000000000 -1000000000 -1000000000 -1000000000 -1000000000 -1000000000 -1000000000 -1000000000 -1000000000 -1000000000 -1000000000 -1000000000 -1000000000 -1000000000 -1000000000 -1000000000 -1000000000 -1000000000 -1000000000 -1000000000 -1000000000 -1000000000 -10...

output:

93316587
BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB...

result:

ok correct answer and good plan!

Test #125:

score: 1
Accepted
time: 63ms
memory: 4176kb

input:

25000 24929
38981 59245 58398 49246 57765 32623 45062 59991 46174 48856 56683 57851 46854 47131 58551 46843 56657 43887 42589 34052 54350 1586 59480 -7725 49377 58910 55578 44702 55454 24462 32678 38273 46162 -15104 20848 43410 48018 44960 46090 57711 23072 47401 -5122 57810 55013 55658 34709 57323 ...

output:

15601198
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA...

result:

ok correct answer and good plan!

Test #126:

score: 1
Accepted
time: 68ms
memory: 4116kb

input:

25000 216
-1000000000 -1000000000 -1000000000 -1000000000 -1000000000 -1000000000 -1000000000 -1000000000 -1000000000 -1000000000 -1000000000 -1000000000 -1000000000 -1000000000 -1000000000 -1000000000 -1000000000 -1000000000 -1000000000 -1000000000 -1000000000 -1000000000 -1000000000 -1000000000 -1...

output:

331939
BBBBBBBBBBBBBBBBBBBBBBBBBBBBBABBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBABBBBB...

result:

ok correct answer and good plan!

Test #127:

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

input:

25000 335
-1000000000 -1000000000 -1000000000 -1000000000 -1000000000 -1000000000 -1000000000 -1000000000 -1000000000 -1000000000 -1000000000 -1000000000 -1000000000 -1000000000 -1000000000 -1000000000 -1000000000 -1000000000 -1000000000 -1000000000 -1000000000 -1000000000 -1000000000 -1000000000 -1...

output:

252377
BBBBBBBBBBBBABBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBABBBBBBBBBBBBBBBABBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBABBBBBBBBBBBBBBBBBBBBBBBBBBBBBABBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB...

result:

ok correct answer and good plan!

Test #128:

score: 1
Accepted
time: 69ms
memory: 4232kb

input:

25000 12500
57766 53440 59977 57541 58046 53191 54586 47953 5770 26252 57730 38670 -5748 59559 54179 47760 -13943 59533 50864 52802 53918 41409 52183 40794 59467 43699 56296 36336 16072 20189 40518 54331 58195 33034 58610 52846 54071 57545 20255 49154 59671 37286 53649 -19732 36583 56710 20837 44085...

output:

59045
BBBABABAABABABABABABABABBABAABABABABABABBABAABABABBABABABABBABAABABABABABAABAABABABABBABABABABABABABABBABABABABABABABAABABABABABAABABABABABABABABABABABABABBABABBABABABABABAABAAABABAAABABABBABAABABAABABABABABABABBABABBBABABABAABBAAABABABABABABABABABAAABABABABABBABAABABAABABABABABABABABABABABABA...

result:

ok correct answer and good plan!

Test #129:

score: 1
Accepted
time: 56ms
memory: 4076kb

input:

25000 12500
1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -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:

0
BABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABA...

result:

ok correct answer and good plan!

Test #130:

score: 1
Accepted
time: 66ms
memory: 4192kb

input:

25000 12500
12501 12500 12499 12498 12497 12496 12495 12494 12493 12492 12491 12490 12489 12488 12487 12486 12485 12484 12483 12482 12481 12480 12479 12478 12477 12476 12475 12474 12473 12472 12471 12470 12469 12468 12467 12466 12465 12464 12463 12462 12461 12460 12459 12458 12457 12456 12455 12454 ...

output:

9692
BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB...

result:

ok correct answer and good plan!

Test #131:

score: 1
Accepted
time: 81ms
memory: 4364kb

input:

25000 12500
1 0 1 0 1 1 0 1 0 1 0 0 1 1 1 1 0 0 1 0 1 0 1 1 1 0 1 1 1 0 1 0 0 1 1 1 1 0 0 1 0 0 0 0 1 1 1 1 1 1 0 0 1 0 0 1 1 0 1 1 0 1 0 1 1 0 1 0 0 0 1 1 0 0 1 0 1 0 0 1 0 0 0 1 1 0 1 1 1 0 0 1 1 0 1 1 1 0 0 1 0 1 1 1 0 0 0 0 0 1 1 0 1 1 1 1 0 1 0 1 0 0 0 0 0 0 1 1 0 0 1 0 1 1 0 0 1 1 1 1 0 0 0 0 ...

output:

0
BABABBABABAABBBBAABABABBBABBBABAABBBBAABAAAABBBBBBAABAABBABBABABBABAAABBAABABAABAAABBABBBAABBABBBAABABBBAAAAABBABBBBABABAAAAAABBAABABBAABBBBAAAABABABABABABABABBBBAABABABBBAAABBBABBAAAABBBAAAAAAAABAABABABBBBBBBAABAAABBABBBBBAABBBBBBBABAAABABABAAAAABABBAAAABABAABBABBABAABABBAABAAAAAABABABBBBBBAAABAA...

result:

ok correct answer and good plan!

Test #132:

score: 0
Wrong Answer
time: 91ms
memory: 4900kb

input:

25000 12500
12500 12500 12500 12500 12500 12500 12500 12500 12500 12500 12500 12500 12500 12500 12500 12500 12500 12500 12500 12500 12500 12500 12500 12500 12500 12500 12500 12500 12500 12500 12500 12500 12500 12500 12500 12500 12500 12500 12500 12500 12500 12500 12500 12500 12500 12500 12500 12500 ...

output:

999999999
BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB...

result:

FAIL WTF you have a better plan???

Subtask #7:

score: 0
Wrong Answer

Test #134:

score: 1
Accepted
time: 182ms
memory: 4604kb

input:

50000 5073
401620049 252597114 638998890 -773942367 -994194991 773972290 755430111 -523539687 -749222285 70295502 406924746 -866460865 -321006536 -20842814 -717101098 238603919 -973981419 -263358138 341137321 -595132691 346299278 -897934865 -155536848 753555039 -925676770 -262539063 -447140814 22418...

output:

4159789614
BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBABBBBBBBBBBBBBBBBBBABBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBABBBBBBBBABBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBABBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB...

result:

ok correct answer and good plan!

Test #135:

score: 1
Accepted
time: 191ms
memory: 4696kb

input:

50000 16491
54968367 631541498 992053774 166821902 -227802340 68248245 667948944 -89264003 -265259875 -594887443 926544734 -411696999 30407481 -421433024 416382339 -477508391 805215739 255289229 -974795064 89186347 -425870885 -240500701 -277492315 -907359926 -479110162 236386925 -738211191 -64852475...

output:

3518512257
BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBABBBBBBABBBBBBBBBBBBBABBBABBBBBBBBBABBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBABBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBAABBBBBABBBBBBBBBBBBBBBABBBBB...

result:

ok correct answer and good plan!

Test #136:

score: 1
Accepted
time: 228ms
memory: 4568kb

input:

50000 24828
537402958 -867631466 399025999 157423833 391106665 312817610 580467777 -943977667 -731459803 -431790703 908914224 554847444 945479577 201406848 573295857 806379300 783774044 -350116969 998130828 -275525690 194703304 -47855879 823343448 845728632 944026365 -947381392 -908205503 89003346 -...

output:

3866929582
BBBBBBBBBBBBBBBBBBBABBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBABBBBBABBBBBBBBBBBABBBBBBBBBBBBBABABBBBBABABBBBBBBBBBABBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBABBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBABBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBABBBBBBBBBABABBBBBBBB...

result:

ok correct answer and good plan!

Test #137:

score: 1
Accepted
time: 243ms
memory: 4676kb

input:

50000 33421
676930860 -488687082 413384945 -976027801 180929397 384302336 614869263 -509701983 -247497393 217485621 478371874 -626091760 -139448328 177786 70945152 -446983508 76791617 -981124160 -317801557 -102987229 910883637 609578285 435959787 525549445 -634876949 -448455404 288943544 244745715 -...

output:

3596500550
BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBABBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBABBBBABABBBBBBBBBBBABBBBBBBBBBBBABBBBBBBBBABBBBBBBBBBABBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBABBABBBBBBBBBBBBABBBBBBBBBBBABB...

result:

ok correct answer and good plan!

Test #138:

score: 1
Accepted
time: 222ms
memory: 4600kb

input:

50000 45093
-181501399 -985689134 818317331 -985425870 799838402 190358868 579265598 635584354 748245594 918639447 -25438220 340452683 359449335 623017658 -795571412 836904183 3472420 560953289 -319274673 -953878850 -811448864 949706753 -515081953 -259419084 -188310341 -434902412 657006318 -48047569...

output:

3289387874
BBBBBBBBBBBBBBBBBBBBABBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBABABABBBBBBBBBBBBBBABBABBBABBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBABBBAABBBABBBBBBBBBBBBBBBBBBBBBBABBBBABBABBBBBABBBBBBBBBBBBBBBBBBBABBBBBBBBBBAABBBBBABBABABBBABBBABBBBBBBBBBBBABBBBBBABBB...

result:

ok correct answer and good plan!

Test #139:

score: 1
Accepted
time: 79ms
memory: 4592kb

input:

49999 24856
-988302792 -981126735 -993911777 -998932503 -990601597 -996725127 -852773701 -972654283 -998555823 -973007443 -928635102 -980439418 -946974943 -914074387 -414843676 -995721020 -999424024 -998729927 -999854642 -679951444 -984732844 -957580390 -795011482 -986081370 -962325749 -938740055 -9...

output:

0
BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBABBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB...

result:

ok correct answer and good plan!

Test #140:

score: 1
Accepted
time: 68ms
memory: 4684kb

input:

49999 25071
-981236939 -482874649 -882394403 -844745427 -899214011 38091729 -928209316 -959916063 -907370298 126998636 -902557684 -913822692 -659272760 -840812191 -823395423 -478443811 -983289846 -904734085 -650302540 -848829760 398396981 -956361221 -544686396 -714945377 -960650412 -887381984 -88847...

output:

496110550
BBBBBBBBBBBBBBBBBBBBBBBBBBBABBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB...

result:

ok correct answer and good plan!

Test #141:

score: 1
Accepted
time: 94ms
memory: 4540kb

input:

50000 25003
-315785577 -972450445 -883496956 -807952825 -865349961 -373486477 -996804487 -122121346 -961680960 -996638935 -634600134 -909746783 -105790480 -970467848 -613552691 281146822 -839175048 -931417510 -989870583 61387672 159562116 -79180666 -714552894 -309335761 -382355236 -411209329 -935500...

output:

862142636
BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB...

result:

ok correct answer and good plan!

Test #142:

score: 1
Accepted
time: 389ms
memory: 6900kb

input:

49999 25048
-148770102 822009433 903725720 830766607 360950186 866164115 728017623 718323599 -440591967 432940684 471765398 656316534 528813416 485636389 313126215 635031247 963977484 481103144 330738987 954824424 164155939 854309519 227042306 -434861233 165100450 999803920 -19459025 872476496 98789...

output:

13136959272726
ABBBABBAABABAAABBBAAABAABBAABBBBAABAABAABABAABAAABAABABBBAABABAAAABBAABBABBABABABBBBBABAAAABBBBBAABAABBABBAABABAAAABBAABAABBAABABABBBBABABAABAABABABABABAAAABABAABBBBBBAAABAAAABBABABBABAABBBBBBAAAAABBABABBBAAAABABABBABBBBABABABBAABBABABABBABAABAABAAAABBBABABBAABBAABBABABAABAABBAABABABA...

result:

ok correct answer and good plan!

Test #143:

score: 1
Accepted
time: 406ms
memory: 7312kb

input:

49999 24980
839583600 929326507 963755389 692370328 989855422 719769260 933496792 983032933 994789300 997643370 -106307963 992737344 998876281 926234381 614546823 998647410 970200776 978576605 910293053 956191138 859700494 663366223 989976111 587714478 854609336 986819617 553404661 952183350 9912528...

output:

39704902325442
AAAABABBABABBBABAAAAAABAABABBAAABBBABABBBBABBABBAABAABABAABABBABAAAAABBABABAABBAABBABBBAAABBAABAAAABBBBAABAAAAABBBBABBAABABAAABABABAAABBBAABBBBBBAABABBBBABAAABBABAAAAABAABBBBAABABABBABBABABAABAAAABBBBABBBBAAABABBAABBBBAABABBAAABAAAAABABAABAAAABABAABBBBBBAAABBAABBBABABABABAABBBBBAAAABA...

result:

ok correct answer and good plan!

Test #144:

score: 1
Accepted
time: 399ms
memory: 7664kb

input:

50000 25195
999924881 999992689 999894044 999979922 999994702 999997671 999941598 999992659 999959047 999978240 999022246 999657511 999991717 999999999 999999471 999971144 999997083 999881262 999999934 999999942 999990738 999999995 999999947 999999404 999992458 999826689 999945388 999996661 99999844...

output:

49976768196969
AABBABAAAAAAABBAAABBABBBBAAABBBBBBBABAAAAAABAABBABAAAABAAABABABBBBBBBAABBAABAAAAAAABBBBBBBBABBAABBBABBBAAABABABABAABABBBBBBABAAAAAABABABABABAAABBBBBABABAAABAABAAABBAAAABABAAAABBABAABBABAAAABBBBBAAAAABBBAABAABBABBBBABABAABBAAAABBAABBBBAAABBABBABBAABABBAABBBBBBAABBBAABBABABBAABBBABABBBB...

result:

ok correct answer and good plan!

Test #145:

score: 1
Accepted
time: 130ms
memory: 4536kb

input:

50000 23
-1000000000 -1000000000 -1000000000 -1000000000 -1000000000 -1000000000 -1000000000 -1000000000 -1000000000 -1000000000 -1000000000 -1000000000 -1000000000 -1000000000 -1000000000 -1000000000 -1000000000 -1000000000 -1000000000 -1000000000 -1000000000 -1000000000 -1000000000 -1000000000 -10...

output:

46843654
BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB...

result:

ok correct answer and good plan!

Test #146:

score: 1
Accepted
time: 135ms
memory: 4552kb

input:

50000 49956
8150 29903 29182 27069 13423 26356 8371 29810 29977 20175 26073 26586 29037 19918 28484 15078 26633 28658 29339 5982 7444 26612 27849 -2115 15685 5666 29147 22857 29133 3295 29137 28601 1036 15446 26571 23153 28059 27159 14820 24185 23480 28779 27845 18928 27754 26746 27379 22753 25815 2...

output:

25028859
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA...

result:

ok correct answer and good plan!

Test #147:

score: 1
Accepted
time: 121ms
memory: 4604kb

input:

50000 6677
-1000000000 -1000000000 -1000000000 -1000000000 -1000000000 -1000000000 -1000000000 -1000000000 -1000000000 -1000000000 -1000000000 -1000000000 -1000000000 -1000000000 -1000000000 -1000000000 -1000000000 -1000000000 -1000000000 -1000000000 -1000000000 -1000000000 -1000000000 -1000000000 -...

output:

29115
BBBBBBABBBBBBBBABBBBBBBBBBBABBBABBBABBBBBBBBBBABABBBABBBBABABBBBBABBBBBBBBBBBBBBBABBBBBBBBBBBBBBBABBABABBBBBBBBBBBBBBABBBBBBBBABBBABBBBBABABBBBBBBBBBBABABBBBBBBBBABABBBBBBABBBBBBBBABBBBBABBBBBABBABBBBBBBBBBBBBBBBBBBABBBBBBBBBBABBABBBBBBBBBBABBBABBBABBBBBABBBABBBBABABABBBBBBABBBBBBABABBBBBBBBBA...

result:

ok correct answer and good plan!

Test #148:

score: 1
Accepted
time: 131ms
memory: 4524kb

input:

50000 47638
2157 -23738 -29921 25094 -6992 -21638 23802 8566 -24055 25581 -22184 -2984 28516 -20222 16885 -18971 21541 18130 -3745 -23496 -23405 19454 -15177 -20270 14533 -26652 -20613 21897 5773 -17358 14825 -6664 8635 -22558 6160 824 -27894 27203 -9077 13147 23632 -14057 8968 -8681 -22904 3839 186...

output:

62926
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAA...

result:

ok correct answer and good plan!

Test #149:

score: 1
Accepted
time: 131ms
memory: 4556kb

input:

50000 25000
-1000000000 -1000000000 -1000000000 -1000000000 -1000000000 -1000000000 -1000000000 -1000000000 -1000000000 -1000000000 -1000000000 -1000000000 -1000000000 -1000000000 -1000000000 -1000000000 -1000000000 -1000000000 -1000000000 -1000000000 -1000000000 -1000000000 -1000000000 -1000000000 ...

output:

29580
BABBABABAAABABABBABABABAABBABABABBABABABABABABABBABABAABBABBABAABABABABAABABABABABABABABABABABABABABABABABBABABAABABBABABABBABABABABABABABABABABAABABABABABABABABAABABABABABABABABABABBABABABABAABABAABABABABABABABABABBABABABABABBAAAABABABABABAABABABABABBABABBABAABABABABABABABAABBBBAABAAABABABAAB...

result:

ok correct answer and good plan!

Test #150:

score: 1
Accepted
time: 112ms
memory: 4412kb

input:

50000 25000
1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -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:

0
BABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABA...

result:

ok correct answer and good plan!

Test #151:

score: 1
Accepted
time: 128ms
memory: 4548kb

input:

50000 25000
25001 25000 24999 24998 24997 24996 24995 24994 24993 24992 24991 24990 24989 24988 24987 24986 24985 24984 24983 24982 24981 24980 24979 24978 24977 24976 24975 24974 24973 24972 24971 24970 24969 24968 24967 24966 24965 24964 24963 24962 24961 24960 24959 24958 24957 24956 24955 24954 ...

output:

19383
BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB...

result:

ok correct answer and good plan!

Test #152:

score: 1
Accepted
time: 166ms
memory: 5060kb

input:

50000 25000
1 0 1 1 0 1 0 1 1 0 0 0 0 1 0 1 0 1 1 0 0 0 1 0 0 0 0 0 1 1 0 0 0 1 1 1 1 0 0 1 0 1 1 1 0 1 0 1 0 0 0 0 0 1 1 1 0 0 0 0 1 0 1 0 0 1 0 0 1 0 1 1 0 1 0 1 0 1 0 1 0 1 0 1 0 0 1 0 1 0 0 1 1 1 0 1 0 1 0 1 1 1 1 1 1 1 0 0 1 0 0 0 1 1 0 0 0 0 1 0 1 1 0 0 0 1 0 0 1 0 1 0 1 0 1 1 1 1 0 1 0 1 1 0 ...

output:

0
BABBABABBAAAABABABBAAABAAAAABBAAABBBBAABABBBABABAAAAABBBAAAABABAABAABABBABABABABABABAABABAABBBABABABBBBBBBAABAAABBAAAABABBAAABAABABABABBBBABABBABBBBABAABBBBAABBBABAAAAABBBBAABBABABBABABBAABBBAAAAABAAAAAAABBBBABAAAABABAAABABAAABABAAAABAABBAABBBBABBBAAABBBAABABBBABBBBABBBAAAAAAAAABBAAAABBBABABBBAABA...

result:

ok correct answer and good plan!

Test #153:

score: 0
Wrong Answer
time: 204ms
memory: 5988kb

input:

50000 25000
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...

output:

999999999
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA...

result:

FAIL WTF you have a better plan???

Subtask #8:

score: 0
Wrong Answer

Test #156:

score: 1
Accepted
time: 304ms
memory: 5152kb

input:

80000 7878
777864027 -240722331 387404961 -663519829 -216544675 -615470669 389523326 -655149376 147392262 -473912099 -138402122 -464043161 559358763 -559101596 -823274287 110669805 -604050872 544371755 -438475893 567469656 820006475 817713642 888317607 -538471506 971148759 -445976429 128957549 -1023...

output:

3874967607
BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBABABBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBABBBAABBBBBBBBBBBBBBBBBABBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBABBBBABBBABBBBBABAAABBBBBBBBBBBBBBBBABBBBBBBBBBBBBBBBBBBBBABBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB...

result:

ok correct answer and good plan!

Test #157:

score: 0
Wrong Answer
time: 376ms
memory: 5192kb

input:

80000 26630
-228051878 771885283 254280261 763424024 549847976 479444139 -209738418 -680776767 -856864752 175364225 -130431639 502501282 -429962998 -422441308 -813844415 345526421 836450348 -425331374 98108077 202757619 -611296839 -989641537 475332953 -346870116 -582284634 -606314664 -188520409 -975...

output:

3801583361
BBBBBBBBBBBBBBBBBBBBBABBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBABBBBBBBBBBBBBBBBBBBBBBBBBBABBBBBBBBBBBBBBBBBBBBBBBBBBBBABBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBABBBBBBBBBBBBBBB...

result:

FAIL WTF you have a better plan???

Subtask #9:

score: 0
Wrong Answer

Test #178:

score: 0
Wrong Answer
time: 515ms
memory: 5468kb

input:

100000 10047
-5502 -308 7976 6352 -3142 -4377 528 1970 944 2448 8449 -4615 2083 4754 4525 -679 9798 -441 3115 5770 9575 6992 90 6051 -5122 70 -7052 2254 8847 2273 9231 9556 -8342 7092 -8287 -5179 -7231 -5016 4408 -4634 -1591 -6752 2148 2256 -9048 7607 553 -2994 -3081 -1207 3352 -578 8193 9903 7113 -...

output:

39002
BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBABBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBABBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBABBBBBBBBBBABBBBBBBBBBBBBBBBBBBBBBBBBBBBBBABBBBBBBABBBBABBBBBBBBABBBBABBAABABABBABBBBBBABBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB...

result:

FAIL WTF you have a better plan???

Subtask #10:

score: 0
Wrong Answer

Test #198:

score: 0
Wrong Answer
time: 415ms
memory: 5540kb

input:

100000 10184
897364269 894652505 421467601 -125369057 974459026 -179714212 582271101 448643533 643614224 628078404 484256779 -635646600 -559936755 337166672 300228846 50900132 -792820304 -300878123 -67707471 -746291314 157318792 -311384832 -239695088 218211183 -159892602 67981542 252575782 580382287...

output:

3372235692
BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBABBBBABBBBBABBABBBABBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBABBBBBBBBBBBBBBBAABBBBBBBBBBBBBBBBBBBBBBBBBB...

result:

FAIL WTF you have a better plan???