Ropes solution codejam

Ropes codejam solution For Solution Click Here! Two scout teams are taking part in a scouting competition. It is the finals and each team is well prepared. The game is played along a river that flows west to east. There are 4N4N trees planted along the river, with exactly 2N2N of them lined up along the north bank and 2N2N lined … Read more

slide circuits solution codejam

slide circuits codejam solution For Solution Click Here! Gooli is a huge company that owns BB buildings in a hilly area. Five years ago, Gooli built slides that allowed employees to go from one building to another (they are not bidirectional), starting a tradition of building slides between buildings. Currently, SS slides exist. Melek is Gooli’s Head of Transportation and a … Read more

cutting cake solution codejam

cutting cake codejam solution For Solution Click Here! Today is your and your twin sibling’s birthday. To celebrate, you got a rectangular cake to share. The cake is decorated with NN triangular patches of icing (which may overlap). All the icing patches were created with the same triangular mold, so they have the same shape and orientation. … Read more

Alternating LG Queries codechef solution

Alternating LG Queries solution codechef For Solution Click Here! You are given an array AA consisting of NN integers. You have to answer QQ queries of the following two types: 11 LL RR (R>L)(R>L) which asks you to find gcd(AL,lcm(AL+1,gcd(AL+2,…,((R−L)mod2==1?gcd(AL,lcm(AL+1,gcd(AL+2,…,((R−L)mod2==1? gcd(AR−1,AR):lcm(AR−1,AR))…)))gcd(AR−1,AR):lcm(AR−1,AR))…))). 22 LL RR (R>L)(R>L) which asks you to find the same as above but lcmlcm swapped with gcdgcd and vice-versa. Here lcm(a,b)lcm(a,b) and gcd(a,b)gcd(a,b) denotes the least common multiple and greatest common divisor of two integers aa and bb respectively. Example: Consider the … Read more

Fat Hut codechef solution

Fat Hut solution codechef For Solution Click Here! There are NN breakfasts in the restaurant “Fat Hut” where the Chef works. The ii-th breakfast has an attractiveness AiAi and cost CiCi. The Chef has noticed that nobody takes the jthjth breakfast if there exists at least one breakfast ii such that Ai≥AjAi≥Aj and Ci<CjCi<Cj. In other words, if a breakfast is less attractive and more expensive than any of the … Read more

Chef and Digits of Large Numbers solution codechef

Chef and Digits of Large Numbers solution codechef For Solution Click Here! Chef and Abhishek are two friends. Abhishek really appreciates Chef’s skills and wants to learn the secret formula behind Chef’s tasty dishes. Chef will tell his secret formula only to a competent person. So to check Abhishek’s competency, Chef asked him to solve … Read more

Charge Scheduling codechef solution

Charge Scheduling solution codechef For Solution Click Here! There are NN people in a train and each of them gets on the train at time t=0t=0. Each person on the train wants to use the charging station on the train for some amount of time, but unfortunately, the train has only one charging station and can only be … Read more

Geometry 1 codechef solution

Geometry 1 solution codechef For Solution Click Here! You are given a convex polygon with NN sides. You have to answer QQ queries. The ithith query is described by two integers vi,tivi,ti. In this query, all sides of the polygon start moving parallel to their respective perpendicular vector away from the centroid with a constant velocity of viunitssecviunitssec. Output the final area covered … Read more

Special Triplets codechef solution

Special Triplets solution codechef For Solution Click Here! Gintoki has been very lazy recently and he hasn’t made enough money to pay the rent this month. So the old landlady has given him a problem to solve instead, if he can solve this problem the rent will be waived. The problem is as follows: A … Read more

Array Filling codechef solution

Array Filling solution codechef For Solution Click Here! You are given an array AA of size NN. Initially, the array is filled with 00-s. There are MM types of operations that you can perform on array AA. The ithith operation can be described by two integers (xi,yi)(xi,yi). In this operation, you choose a set of indices SS such that 1≤j≤N1≤j≤N, (jmodyi)≠0(jmodyi)≠0, Aj=0Aj=0, , then you set Aj=xiAj=xi for all j∈Sj∈S. … Read more