Code Invicta Discussion

Let’s make a general thread to discuss solutions and doubts of Code Invicta.

Contest Link : Contest Page | CodeChef

I was able to solve MOON and XORSEQ.

Those who have solved BCK2, can you share your approach?
Thank you!

3 Likes

For BCK2:
for every edge add 2 * weight_of_edge * min_of_number_of_nodes_on_both_side_of_edge

For fairy tales:
you just have to check if that edge is a bridge or not using timestamp based dfs

How to solve the last 2 ones??

2 Likes

question - moon
please give test cases where my code fails
code - CodeChef: Practical coding for everyone

link is not working

changed

approach for XORSEQ

@chaudhary_19 is it working for 1 0 2 0 ? answer should be NO.

yeah…it is showing NO

for XORSEQ approach ?
@chaudhary_19

There is a pattern in consecutive numbers xor.
It’s explained really well here.

And after that, you can use binary search(upper or lower bound) to find the starting and ending consecutive range of 0’s.
I used two set’s for it, one for positions of 1 and other for positions of houses which are still 0 and in neighbourhood of 1.

Solution

2 Likes

will this round effect my codechef rating?
I mean it was a rated round or not rated?

Not rated.

test case : 2 6 5 1
answer should be YES but your solution is getting NO.

not able to understand your solution

Can you explain the logic behind the conclusion of
For BCK2:
for every edge add 2 * weight_of_edge * min_of_number_of_nodes_on_both_side_of_edge

No, the round was unrated for everyone.

The approach is greedy.
In order to maximize my answer, for an edge i want all persons standing on nodes of one side of that edge to go towards other side of edge and vice versa. However only the minimum of both the sides of an edge can go passing that edge so taking minimum.

2 Likes

Great! I got it. Thanks for sharing.

1 Like

then how will you balance the sweetness in this testcase