Hi, Codeforces!

Three years later, first ideas of a contest turned into this complete set of problems, so I am glad to invite you to take part in Codeforces Round #824 (Div. 2), which will take place on Oct/02/2022 17:35 (Moscow time). The round will be rated for the participants with rating lower than 2100. Participants from the first division are also welcomed to take part out of competition.

You will be given **2 hours 15 minutes** to solve **6 problems**. All the problems were created and prepared by me.

I would also like to thank:

- KAN for awesome coordination!
- Aleks5d, arzhantsev64, ChthollyNotaSeniorious, DanWallgun, flowerletter, Gegege337, Imakf, LeoRiether, mejiamejia, okwedook, PO3OBAR_Bblnb, SSerxhs, TomiokapEace, triple__a, wabadabakalakaboo for testing the round and giving significant feedback.
- mejiamejia for his help with extra testing.
- MikeMirzayanov, geranazavr555, unreal.eugene, DK318, and KAN for maintaining Codeforces and Polygon platforms!

Scoring: $$$500-750-1250-1750-2250-3000$$$.

Note that some problems have similar scores. Your sense of the scoring distribution may differ, don't forget to read further problems if you get stuck.

I look forward to seeing you on the leaderboard. I hope you'll enjoy all 6 problems and wish you good luck!

**Too many thumbs down**

**UPD1:** Editorial

**UPD2:**: Winners and First to solve

Div2

Place | Participant |
---|---|

1 | HugeWide |

2 | 9u46 |

3 | naaamte |

4 | seaneri |

5 | huweidong |

Div1 + Div2

Place | Participant |
---|---|

1 | maspy |

2 | orz |

3 | BurnedChicken |

4 | MeliodasIRA |

5 | Chenyu_Qiu |

First to solve

Task | Participant |
---|---|

A | smartnotu |

B | Chenyu_Qiu |

C | Elaina-chan |

D | Sai_t |

E | swift-zym |

F | tfg |

\ (•◡•) /I can't wait to get back

I reacted with heart on telegram

wish everyone will find something interesting in this round

I hope to cross 1000 rating mark in this contest for the first time ^_^

I think, I made it :))

Mamba Mentality Round

Its time to summon the hearts <3 army. Letss go

I am not giving any advanced vote anymore ,last round was literally disappointing with weak pretests, hope this one goes well

Finally a contest on the weekend that I can do!

Hope For a Big +ve delta to everybody in the contest

That's not actually possible because rating is not calculated like this, let's suppose everybody solved all problems then its not that everybody will have +ve delta, delta is based on the people which have higher rating than you but performed less than you, then you will have a +ve delta...like sort the registered participants by rating and then see on which number you are coming if your rank in the contest is more than that then you will have +ve delta (assuming everybody who has registered participates).

I know this but I wish max no participant in this contest get +ve delta

A round with no tester comments! That's pretty astonishing. Edit: Now there are some.

Many users(including me) would be sad as the last round had too many FSTs and Hacks due to bad testing in problem B and C! :(

hope good pretests this time, lost too much points cus of fst

What is FST?

Failed System TestingAs a tester, this contest has a couple of nice problems,

and the overall quality is much better than average!The first half gave me PTSD. Hoping for a good round ^_^

Extremely excited! hope to solve atleast A,B AND C.

Wish you all the best friendsA comment like this from the testers always gives me extra confidence!

So can you guarantee that I will go to BOI remaining purple?

[Deleted]

do you use some extension? How there is 3 extra columns in the end ?

yea, i cant find that extension, can u pls share the name

It is 'Carrot'

Thanks

I don't know then what's average for you :|

As a tester, I must say that the problems are really great and I highly recommend everyone to come.

Press X to Doubt

Hoping for interesting problems! Good luck everybody!

This gonna be my first contest ever, I'm so excited

Hopefully i dont get destroyed by the problems like the last contest :*).

Hope to become a pupil ^_^

Hopefully this contest will go a bit better for me than the last one.. good luck to all participants!

Good luck to all, I hope everyone can enjoy

~~me~~this round.Hoping for +141 delta

meme...

i wish i will get plus in this contest

.

My first competition

hope to get a positive delta from this round

Good Luck Everyone!!! Hope everyone has a fun time :)

You could find someone to teach you if you don't know how to write a problem description, and about what information shuold be emphasized.

Solution for problem D has been leaked on a discord group by a user named Instrospection. Solution is in Python

ATTENTION, please look into it coordinators and MikeMirzayanov

but how did you find that out

ahahhahahahha he was searching for it

i don't think you should comment this under the blog (where everyone can see it) in the middle of the contest :/

Strongly agree with you.

Still, he couldn't have known if it was leaked on a "discord group"

if he wasn't in that group.I'm a part of that group but didn't know that they cheat, i joined for educational purpose

The problem statements were shit.

So is my implementation skills ;-;

D is a good problem, but the problem statements are very bad.

cant agree more, i wasted more than 10 minutes trying to understand A either the statement is a puzzle or my english is shit or both

I could not understand problem B at all

For me Global round was far better than this shitty round.

I spent too much time understanding the question, which is unfair to foreigners like me. Maybe my English is too poor.

Enjoy seeing how number of upvotes falls

I appreciate illustrations to the problem statements to make them more understandable. Without them it might've been crazy

A — 24mins, still don't know what it was about, just submitted the obvious formulae from the samples after giving up on thinking.

B — 16mins,

C — 31mins, I feel like my implementation is crap but the task itself is quite decent.

D — 24mins (just like A). Surprisingly easy. I enjoyed this kind of problem but wonder if it is too straightforward. Guess could've solved it even faster.

So to me C>A>D>B . But from the number of submissions the round seems well balanced in general except E which has a very few submissions but it is fine for most people I guess.

how do you do D? Why is it easy?

I guess as always for me I either think in the right direction or not. And here I was lucky.

First think about how to find all triplets. Notice that two cards uniquely identify the third one. So you can calculate all the triplets for n*n*k. After that it becomes a basic combinatorics

1) By two cards you can determine third to be in set

2) So if two cards determine the third, then there cannot be two sets with strictly two common cards

3) It means that any meta-set is two sets with one common card

4) This gives

`O(n^2 * k)`

solution (store all meta-sets by common card and some combinatorics)lol idk why so many ppl have such weird opinions on the problem set. Sure, the statements were unclear (especially for B, where it was blatantly incomplete). Regardless, I think the ideas required for the first 3 problems were what you would expect in a Div2

ok then maybe ur better than me then. I find it's super challenging to think (even if the problem is easy) after spending 90% of brain stamina to understand the statements.

I wasn't replying to you. But I can tell you for sure that the English used for A was perfect, not sure about B. It's just that A is a difficult to understand problem in itself, maybe they could have reworded it better to make it sound less mathematically rigorous?

k. Ur an english genius then.

The gap between D and E is too big.

And WHY TIMELIMIT OF D is FOUR SECOND???

Even the most brute force $$$\mathcal{O}(n^3k)$$$ can pass??? Why???

(Submission 174397296 and My hack)

Just why 4 sec??? Is there a standard solution that can`t run in 2 sec???

a very bad round for me. not worthy of the time.

wow upvotes are dropping very fast:) expected it to happen:)

Wuf. Even my python solution passed for half a second

If $$$O(n^3k)$$$ can pass then it is the fault of the weak pretests not the loose time limit.

I'm actually very surprised that brute force would pass, even with the generous 4 second time limit, since it's like, $$$10^{10}$$$ operations. My guess is that the pretests are actually not too strong, and we might see TLE hacks and/or FST on $$$O(n^3k)$$$ approaches.

I think the standard approach would take $$$O(n^2 k \log n)$$$ time (find sum of all pairs, store them in a map; then for each card, count how many instances of its additive inverse is present as a pair sum and add the count choose 2 to the answer). Mine took 623ms, so it should comfortably fit 4 seconds with slower languages or approaches with poorer constant factors (though I don't think mine was anywhere near optimized to begin with). Maybe they wanted to disallow unordered map hacks?

n^3*k passed main tests...

I think the problems is really good and I enjoy it, but the descriptions of them is so unclear that I waste lots of time. Hope the next time the words will be much clearer.

did u have to do graphs to detect cycle in C?

well, it's just one cycle so you can check indegree and outdegree but I was too lazy so I used a DSU xd

can u show me ur submission by pasting it here or somewhere else with a link? i wanna see but submission are not viewable rn

Here you gothanks

https://codeforces.com/contest/1735/submission/174413223

No graph. I used a Map to track which character corresponds to which character (obviously empty in the beginning).

Filling that map is the crux of the problem. I used a List-array of size 26 to store all connections.

ExampleString: bafdcesigh

Lists:

thanks, thats a really smart method

I used DSU with path compression. I was about to implement union by rank, when I recalled that it's only size 26, which is definitely not worth that much effort.

flakes24 it

shouldbe enough to just store a parent array or even a map to indicate which character precedes another. Then when you want to make a new mapping, you can simply check all ancestors to make sure this new successor doesn't form a cycle,unlessyou already have a chain of all 26 letters, so the only remaining relation is to complete the cycle. I didn't actually do this (I used DSU instead), but I think this should still pass the time limit, provided that the rest of your algorithm is efficient enough.I thought about doing the second method (cycle method also striked but im not that comfortable with graphs yet), but it felt too implementation heavy to check 26 ancestors. But i had about 110 minutes after doing B and should have given it a try atleast. Thanks for the help tho.

btw, do u know any good resource to learn dsus in this context?

i dont know why youre getting downvoted tho

I just went to cp-algorithms during the competition for this

can you link that particular page / piece of code please

Here you go

5/10 for problem quality.

1/10 for problem description.

Solved D 30 seconds before the end of the contest b/c I had thought my sol was incorrect.

I did not like A at all. I liked B a lot. The hardest about C and D were understanding the problem statements. I am grateful the testcases were good, else I would not have understood anything.

The difficulty felt nice, except for A. I think A was too strange, took me 30min to write 1 correct line of code. Solved A, B, C and D

Upvotes on this blog is gonna drop faster than my rating

The problems is really good but the descriptions of these problems are not clear.

got a stroke reading/trying to understand problem C

E is a bit boring, because there are too many details to pay attention to.

In problem B, "

You want that for each pair of pieces, their sizes differ strictly less than twice."Twice of what?

In problem C, "

each letter in s was replaced with the one that follows in clockwise order",Follows what in clockwise order? should have been "replaced with one that follows it in circle in clockwise order"

Exactly ! Not specified clearly

Nice comment!

I think it is pretty clear the size of two items differ strictly less than twice means the bigger of the two is less the two times bigger than the smaller.

Idk

It definitely was not clear. My initial interpretation was that if you compare every possible pair, you would find strictly less than two instances in which the the result was that the elements were different. Of course, this would imply that all elements must be equal unless there are $$$\leq 2$$$ elements, so I was very confused at how simple this was, until I saw the test cases.

The visual explanation helped clear up my mistake, but it doesn't change the fact that the initial wording was very poor. Thankfully, a clarification was issued shortly at the start, so they at least responded properly to inquiries.

I think C is easy for people who knows graphs (dfs) and can write very hard code

I think all questions are easy for people who know how to solve it

You don't need graphs and dfs for C

Yes, but i don't say that graphs is only solution

Also come on. Stop mentioning dfs as some advanced technique that few people know

Yes, a while loop will do.

LOL who was writing problem statements. give him some money so he can write few more lines lol

All the problems were insanely good, and I especially liked C. One of the most balanced + well prepared round I have ever participated in. Congrats to authors!

Problem F is a good problem!

I misread the shit problem statements many times. My entry experience was extremely bad.

Is there anybody else who struggled in understanding problem statements today?

Unclear statement in B

I struggled a lot

Very confusing description... Had to guess the meaning based on given test cases for the first few problems :-)

Can you specify what exactly was not clear?

Perhaps "very confusing" is a bit over, but I think I do need to carefully look over every word in the description to understand them, while in previous contests just skimming over is enough. For example, "For this reason, all 26 lowercase English letters were arranged in a circle in some order, afterwards, each letter in s was replaced with the one that follows in clockwise order, in that way the string t was obtained." It seems unclear to me what each character in s is replaced with, and I had to go over the TCs to make sure what I am thinking is correct.

How to solve D?

Ok, this was the first time I solved D, and to do so I broke this problem into different parts, so the first significant observation was no 2 sets can have 2 same cards, as it will force the third card to be same and hence 2 sets to be same. So let's say card 1 was in 6 sets then I can combine any 2 sets and that will be a meta-set, so the total meta-set would be 6C2 (choose any 2 sets among all possible), so, if I am able to find in how many sets each card is in then I can sum all their results (cnt[i]C2). To find a set, for each pair of cards I found out which was the required card so that they form a set (this card will always be unique) and checked if that card existed in our n cards, to do so in log(n) I stored each card in the map. so total time complexity was O(n*n*k*log(n)).

I spent the last 20 mins in only reading and understanding problem C and its test cases.

## Make it unrated

Why? That's all legal. Statements hard to understand but you can understand

This round must be unrated because we can't understand the problems. So without understanding we can't solve.

some people are not good in english so you better use simple words/sentences.

"their sizes differ strictly less than twice." this is shit.

1.Read carefully 2.Watch at examples and notes 3.Use translator

I think, your problem isn't "understanding problem"

How much for a good problem statement, please? ,

true i was not able to solve problem B because of that

why engish in this round so hard to understand qnq

Is there anyone like me? When I'm confused about a problem statement, my brain is fried and can't think anymore for the rest of the contest.

I was super confused about A and D problem statements.

I spend about 20 minutes in understanding problem A and decided to leave the contest.

I spend around 25 min in finding a approach with wrong submission , It is more logical than B

I quickly found a solution for E, but unfortunately, because i was stuck on C for a long time because of implementation issue, i had no time to implement E. Solved A,B,C,D

Solution for D:

Firstly,let's find all "sets":

Enumerate each pair $$$(card[i],card[j])$$$,we can calculate a unique $$$card[k]$$$ according to $$$card[i],card[j]$$$.

Next, we only need to check whether $$$card[k]$$$ is in the given cards.

Time complexity:$$$O(n^2k)$$$.

Next, we notice that the intersection of two "sets" has at most one card.

$$$Proof$$$:assume the intersection of two "sets" has 2 cards $$$card[i],card[j]$$$,we can calculate a unique $$$card[k]$$$ according to $$$card[i],card[j]$$$,which leads to contradiction.

For each $$$card[i]$$$,suppose it exists in $$$k[i]$$$ sets,if $$$k[i] \geq 2$$$,we can select two from the $$$k[i]$$$ "sets" to form a "meta-set".

It can also be proved that all selected "meat-sets" are distinct.

So the answer is $$$\Sigma {C^{k[i]}_{2}}$$$.

D and E are amazing!

D ... All CPer who have played SET must think "From $$$2$$$ cards I can identify the last card" at least once, I guess.

E ... We must use matching to solve this? Nope.

Should practice CP problems topicwise or rating-wise?

rainboy and others tried doing that and most got TLE.

The problems were nice but the description and illustration of test cases.... Omg, I have no words. I'm sorry but last 2-3 rounds were really crappy. Please please improve on making problem statements more clearer.

continuously 2nd worse round, i could have done better, is it me who is failing to grasp or problems are getting better in these contests

good contest!!!

6

dag wall how eye knee

A- took some time, it was was troublesome to find out the general formula

Approach I took: Basically 'n'(now u can't choose n-1 and 1) is already off choose '2'(now u can't choose 3 and 1) as off. now if choose a number 'k' and we move k ahead of 4 and 2*k behind n-2. so we get 4+k=(n-2)-2*k => k=(n-6)/3 from here we find 3rd number= k+4 so we have 3 numbers which are days off: 2, k+4, n

now the difference can be calculated and maximum of all the minimum can be taken :)

PS: If somebody had better approach please do share :)

simple idea i could think of is:- you have to chose 3 points so first subtract these points (so you can calculate the distance from remaining points) now you have to select diff distance so the least distance is 1,2,3 which makes it 6 , so if given num is less then 9 there is no solution also since we have to selcet maximum of min funtion after every 3 addition you can increase your ans by 1( from 1,2,3 your new distance will be 2,3,4). here is my solution :-https://codeforces.com/contest/1735/submission/174379850

nice approach :)

Problem description left the chat.

i spent more time understanding problem statements than actually solving them.

CF rounds helping us practice reading comprehension as well. nice.

yes lol

"their sizes differ strictly less than twice." I bet it'll be fun to solve the "once" version of it. Twice fun in fact.

It was a weird way to write the statement ;/

I solved A by test case №3 i just divided 1033/3 and found genius formula.

Good overall,

Problem DEnglish version:"A feature for three cards is called good if it is the same for these cards or pairwise distinct."machine translation of Russian version:"For a trio of cards, a characteristic is good if it is the same for all three cards, or all three are different in pairs"Sad that I prefer the machine translation...

Can anyone please explain problem C in a clearer way?

in order to get the lexicographically smallest string you should go from left to right and try to map every character by the alphabetical order from a to z,consider it as graph where there is a directed edge from a character to the character it is mapped with, here you should take care of 3 cases

1 — you can't map a character to itself (loop edge)

2 — you can't make a cycle of length less than 26

3 — you can't map a character to an already mapped one

take a look at my code , i hope i made it clear.

where is your code?

174420886

Many many thanks for explaining the solution approach, but I was more into problem statement, what actually the problem said?

simply you initially have a string s , to obtain the string t you make your own alphabetical order of the 26 letters such that each letter in string s is replaced by the letter the goes next to it in the alphabetical order you just made

for example if your s is aqerk and your 26-string order is something like au..qw..er..rz..ko , then your t-string is uwrzo

now you have string t , you should output the lexicographically smallest string s which could lead to string t by some mapping order

Okay, Thank you very much. I think now I get it.

ReadingForces

Very intresting!I tried my best and I think I will get a good result.I really love these problems.

I really enjoyed today's contest. Although some of the problem descriptions werent the best, problem A B and C were very interesting and the pretests were very strong. keep it up!

Howard Hamlin of HHM, I sincerely agree to your opinion.

Problem description is like: Go A to B then go C then back to B, again back to A then go C finally print "Helo World".

First I thought iam not able to think about A quickly but it seems everyone has same feeling

I solved B before solving A B was in 0:17 and A was in 1:19

Had a contests filled weekend and I had a great time

The questions were really good! Thanks for good questions :)

My only possible critism is that this round was more about finding ideas....

But I really enjoyed it!

Anyway, a good contest!

Agree with you :)

can someone please help me, where am I going wrong this is solution for B

I think you need

Math.ceil(1.0*arr[i]/div)-1instead ofMath.ceil(1.0*arr[i]/div)as dividing a number in n pieces will need n-1 operationsNote:

ans+=(arr[i]+div-1)/div-1;That is mathIn problem D, I used unordered map to hash from vector of int to int and it took over 1 second to run which is longer than most submissions. Anyone know why?

hash function could be slow, there could be hash collision in your hash function, or else there is somewhere else that adds/multiplies to the time complexity.

Is there any better data structure to store the value for each card? Because editorial also suggests us to use map/hashmap.

I think map/hashmap is good enough for the question, but generally I don't recommend you using unordered_map on codeforces, as it could be vulnerable to hacks by deliberately causing hash collisions.

In the case of problem D, I think it is possible to hash the set without hash collisions using 3**k and long long int; If you used this as an hash value, I think map/hashmap is going to be near to best you can use.

Yeah, I just tried your suggestion and it still took quite long so the problem might be my implementation. Anyway, thanks a lot for detailed explanation.

I see that there are several testers. Do they only verify the accuracy of the judge data or do they proofread the problem descriptions as well?

Can Any Body explain the Solution of Problem B

174391163 if you see my code.I think you can understand this problem.

It is no good to divide further the smallest number, as it will always result in more operations caused by having to divide up other numbers further. And therefore, we can transform the question to: given n numbers, make every numbers that are not the smallest number between the range of smallest number/2+1 ~ smallest number*2-1. Dividing each number so that all numbers are between the range will take ceil(number/(smallest number*2-1))-1 operations: and so the answer is the sum of it for all numbers.

dhyang24 why you have taken ceil(number/((smallest number*2)-1))-1 rather than ceil(number/(smallest number*2))-1 this

The question states that the biggest number should be

strictlysmaller than smallest number*2; the maximum number after the division must be (smallest number*2-1)It is guaranteed that if you divide a number in ceil(number/(smallest number*-1))-1 parts, when evenly distribued, it is in the range of smallest number/2+1 ~ smallest number*2 -1

And can you tell why have take -1 after calculating ceil value

dividing a number into n parts will take (n-1) operations, as each operation increases the total number of parts by 1, and the initial number of parts is 1.

Ok I got it thanks for giving time to my Queries dhyang24 And Congrats for becoming Candidate Master

It was interesting, thanks guys for making this awesome round!!! :-D

I’m sorry that the English statements are confusing.

I tried to make them plane, but it was hard for some sentences.

We discussed the places you were confused by and these are the best formulation we eventually came to.

I would really like to see your suggestions for replacing them. I still can’t choose good options. I hope that next time I’ll be more careful and precise.

I hope you enjoyed the problem ideas after you got through the statements.

Anyway, don’t forget to check the editorial and feel free to ask me if there is something unclear there too.

Problems have pretty bad wording, otherwise it is fine I think

C, it correct when I tested but codef say... 174424830

I don't understand your approach entirely (it would help if you commented what the different arrays actually meant), but it seems like you're missing the check for when all 26 letters are linked, in which case you would need to link the endpoints to form a cycle.

Instead, I think your approach would eventually try to extend beyond the 26 letters and/or try to access an array element that was not initialized, which can lead to different results. As such, even if you saw the correct answer on your own machine, there may be undefined behavior, which can lead to different results in other machines.

I want to shorten the array so that only different characters are included, so i use dem[] to count the characters. f[c] is the character before c on the circle, for example a -> c -> d -> e so f['e'] = 'd', f['c'] = 'a',... I use letter 'a' to 'z' (from small to large) to put in the f[] and use chx[] to mark characters that have been used. After put in one, i want to check if the circle is closed (such as

d-> a -> b ->d,b-> a ->b,...) or not (if it is, it won't have room for another character and i have to use another character to precede f[s[i]]) It accepted if I use map -> 174737123I need upvote anyone can help TT.

Finally cyan!!!

Got +ve delta. Now waiting for next contest and hoping that I'll be able to Finally change my colour to Green for the very First Time :)

Ratings updated preliminarily. We will remove cheaters and update the ratings again soon!

Remove cheaters when? CC: MikeMirzayanov

speedforces

not really, at least problems up to C were definitely not the hardest problems (in the corresponding position) I've ever seen. I even thought D might have been worth a try. (though I did lack the ideas for it)

Problem F is very nice, thank you!

Congratulations to TOPPERS.

In question C: why can't

because you must always get a big loop with length 26. But in your example you have loops: a->b->a, d->c->d and so on

Oh yes....got it. Thanks

You're welcome)

`There is Codeforces Official Channel in Telegram with round announcements. For some reason, all posts get an overwhelming amount of thumbs down. Can we turn the situation around and let hearts win?`

209 hearts and 139 thumbs down at first message, 134 hearts and 137 thumbs down at second, hearts are winningI like this Score Distribution : 500 — 750 — 1250 so much

Had lot of learning and fun. Thank you

I think the problem D should add a tag named Reading Comprehension.

I don't quite understand why there are many difficult questions to read recently, such as the D question, which is difficult to understand, but I can quickly pass after understanding

D and E are very nice problems! (especially D in my opinion)

Details of the game this round I started playing this game on October 2, 2022 at 11:00 p.m. Beijing time The first question first uses the algorithm of brute force search, times out at the test point, and then obtains a universal law through mathematical calculations The second question is calculated according to the law of the sample at the scale of big data The third idea is obviously greedy, traversing the string, and then judging what the smallest letter can be taken at this position, the key to judging is not to form a ring of length not 26. The fourth question actually has only one situation, that is, c1, c2, c3, c4, c5, c6 in C1, c2, c3 meet the requirements, c1, c4, c5 meet the requirements. The condition that satisfies the requirement is that each dimension mod 3 is 0 after the addition of the three vectors.

can't find my rating; I can still see the score and rank, but not rating, I remember seeing a notification saying that my rating has updated post this contest. Was the contest made unrated or is this something that only I am facing?

yeah it's saying that I'm unrated on my profile right now, but a few hours after the contest it had shown a rating. It also says that the contest was unrated on my profile.

I can see my rating now

My solution to A was reported similar to someone else. Now, this is because we happened to use the same code template, which is available online, and the code for A was pretty short and simple. This is a mere coincidence. Why would I plagiarize problem A. Please revert back my rating changes, I have given the contest honestly

Why rating not changing ?

You are given an array nums consisting of N integers where N is even.

You have to perform the following operation N/2 times:

Select nums i, nums j from the list Take their bitwise AND, add the value of the least significant set bit to the score Delete those two numbers If the selected numbers are 5=(101)2 and 7=(111)2 then the bitwise AND of the two numbers is 5=(101)2. So, the least significant bit of 4 i.e. 4=(100)4 will be added to the current score.

find the maximum score possible

can anyone help me

For me, I had difficulties understanding the description of first 3 problems. Specially 3rd one.