Hello Fellow Coders,

Warm and pleasant greetings from **Coding Club, IIT Ropar**.

With utmost zest, we want to announce that our club is organizing some exciting programming-driven events under our Annual Techno-Cultural Fest – **ZEITGEIST**. (zeitgeist.org.in)

The event details are as follows:

**COD-COM**: A 3-stage coding tournament with prizes worth 30k. (Team event)

Registration link: Unstop | Townscript**Algo-Unlock**: A 2-stage reverse coding-based event with prizes worth 16k. (Individual event)

Registration link: Unstop | Townscript**Code-Hunt**: A single-stage treasure hunt-based event with prizes worth 27k. (Team event)

Registration link: Unstop | Townscript

**Important:**

The 1st Stage of COD-COM is in online mode on CodeChef on 16th March’23 from 8:00 PM to 10:15 PM IST. (Note: The contest will follow ICPC rules).

The 1st Stage of Algo-Unlock is in online mode on Codeforces on 17th March’23 from 9:00 PM to 11:00 PM IST.

**NOTE:**

- Further details & rulebooks can be found and downloaded through the registration links or through the official site of Zeitgeist (https://zeitgeist.org.in/).
- Contest link will be shared with your registered email IDs. So, please make sure you register for the events.

**Update:**

- COD-COM contest link: https://www.codechef.com/CODO2023
- Algo-Unlock contest link: https://codeforces.com/contestInvitation/7e6c4114294232d26c3b268202c66324fa66f28c

Are there any prizes for online rounds?

The first round of COD-COM is clashing with the ICPC Kanpur-Mathura 2022 Qualifier Mock Round. Can you please reschedule.

Why are you so concerned about Mock Round? I think you already know the platform, as well as the problems. We have a Mock round today too. One can attempt to know the platform well.

These contests are a part of the fest. I suppose it wouldn't be easier for them to reschedule the contest this late.

it's important for those participating for the first time in ICPC. you guys should think about it

Read the comment carefully. One is supposed to attempt the Mock round to know the platform well. We have Mock rounds on two days, today as well as tomorrow. You can try today's round to know the platform well. You can attempt the practice problems available on the platform as well.

two different dates are for different regionals. practicing problems after contest is not same as participating in contest(specially in contests like ICPC, the pattern is little bit different and difficulty level is also arbitrary, not like regular codeforces contests).

Where is link of the Contest-Link of COD-COM?

Please visit the following link: https://www.codechef.com/CODO2023

How to solve Reach at the Party (Hard Version)?

Also can you guys please open others submissions

how to solve game of pwer and game of median?

For Game of power we can do sorting. We can find for each monster how many times it will attack us and then find the damage dealt by it to us. We can then remove the k monsters with maximum damage and fight the other monster. If our health remains poistive then we can win else no.

for median game we will only consider the values less than or equal to m. If the number of such values is less than ceil(n/2) then we can't make median equal to m. Else we will check among all these smaller values if we can make any of them equal to m by multiplying with k.

Thats exactly what i did in game of power and i think i did the same thing in game of median as well not sure where i went wrong

Hint — Binary Search

As the array is circular consider the whole arrangement on a circle whose perimeter is sum of elements of array. So for each index 'i' as starting point(party house) the max distance will be for index 'j' which will be closest to its diametrically opposite point. You can find the index/point easily by maintaining prefix sum and using lower bound/binary search on it and hence it will logn per index. Total complexity will O(nlogn)

You can solve it using binary search in O(nlogn). Go to each index and find out the max time taken by all others to reach that index using binary search.

Please turn on the submission for practice.

Please add all the questions in the practice section of codechef :)

Anyone, please share the approach for It Cost Zero. We tried using DSU on trees.

I was able to AC with small to large merging. I think there exists simpler solutions with only dfs.

no it was not needed. In my solution, I broke the tree at all the zero edges and for each of the trees i got i added to my answer the frequency of the most frequent weight in that tree, except for the tree whose whose root node was 1, for that tree you simply calculate the number of nodes which have cost zero. Not the very technical explanation but I hope you got the idea

Can anyone please give some hint regarding the MEX problem . thanks in advance

Segment tree. If we want the mex to be i then there should be every number from 0 to i-2,i-1 should be absent and others can occur.

Can anyone tell me the logic for "Race to White"? I believe if B is present in the last then the answer is increased by 2 if not the answer is increased by 1 if B is present in the start or between the last and the start. If there is no W and there is B then the answer is -1.

Here is my code

HintWBBWWBBWBBBOriginal:WBBWWBBWBBB

Steps:

WWBWWBBWBBB

WWWWWBBWBBB

WWWWWWBWBBB

WWWWWWWWBBB

WWWWWWWWWBB

WWWWWWWWWWB

WWWWWWWWWBW

WWWWWWWWWWW

Total steps 8

My code is also giving 8 only

first step is wrong, you converted WB to WW in one step

Got it. Thanks...

`void solve() { string s; cin >> s; int b = 0, w = 0, c = 0; for(auto x : s) { if(x == 'W')w++; else b++; } if(b == 0) cout << 0 << endl; else if(w == 0) cout << -1 << endl; else { // transform all BW into WW if BW is present.. while (s.find("BW", 0) != string::npos) { rep(i, 0, s.length() — 1) { if (s[i] == 'B' and s[i + 1] == 'W') s[i] = 'W', c++; } } //now all BW are taken care of rep(i, 0, s.length() — 1) { if(s[i] == 'W' and s[i + 1] == 'B') { c+=2; s[i + 1] = 'W'; //transforming WB to BW and then to WW ,, 2 operations } } cout << c << endl; } }`

here is my code for reference, just change each possible BW to WB and then just transform the remaining WB to WW(which will take 2 operations)

Can anyone please tell me why this code is giving a runtime error?

Will the ratings of codeforces be affected if we participate in Algo unlock?

No. It is an unrated contest held in the Codeforces gym.

Nvm but the problem DP or GREEDY and this problem are exactly same

It was fun to solve Algo-Unlock contest. Not able to solve problem B, D & G. How to solve these?

message me, i will send soln of B and D

It is over now. I think now we can discuss the solutions here.

ohh Then here we go.

Solution for Question 2Solution for Question 4B is simply a pattern base question.

In D, it is simply the sum of the multiplication of the character's position in a string and the character's position in the English alphabet. Like in first tc (1*3)+(2*15)+(3*4)+(4*9)+(5*14)+(6*7)=93.

In G, print the character ahead of 'a' by a distance of difference between first and last, second and second last, and so on the character of the string, like in the first test case difference between c and g is 4, so 'a'+4 = 5 which is 'e' character similarly difference between 'n' and 'o' is 1 so a+1=2 which is 'b' letter, and lastly difference between 'd' and 'i' is 5 so 'a'+5=6 which is 'f' so final string is ebf.

Thanks for participating in the contest and making it successful. We hope you’ve enjoyed the contests and will try to come up with more interesting rounds in future.

is there any prizes for this online round