Pages: 12

ChefX showed ChefY his new pizza slice design. The design is a planar figure that can be drawn in the following way:

Draw a point A0 and two rays from this point such that the angle between them is α<π/2.

Mark N points A_{1},A_{2},A_{3},…,A_{N} on one ray in this order (A_{1} is closest to A_{0}).

Mark N points B_{1},B_{2},B_{3},…,B_{N} on the other ray in this order (B_{1} is closest to A_{0}).

For each valid i, draw a line segment between points A_{i} and B_{i+1}.

For each valid i, draw a line segment between points B_{i} and A_{i+1}.

Finally, draw a line segment between points A_{N} and B_{N}.

All these 2N−1 line segments must have equal lengths, which must also be equal to |A_{0}A_{1}|=|A_{0}B_{1}|.

The result should look roughly like this:

ChefY wants to show ChefX that he does not know his own design very well. He asks ChefX to compute the angle between three of the marked points in this figure. It is clear that there are only four types of angles:

∠A_{x}A_{y}B_{z}

∠A_{x}B_{y}A_{z}

∠A_{x}B_{y}B_{z}

∠B_{x}A_{y}B_{z}

Can you help ChefX find the angle ChefY asks for? It can be proved that under the given constraints, each angle can be written as π⋅m/n, where m and n are coprime integers; you should find m and n.

Example Input

1

175456798 1 151163203 151163204 151163205

Example Output

66583464 116971199

Explanation

Example case 1: The type is 1, so the angle we want is A_{151163203}A_{151163204}B_{151163205}. The angle is (66583464/116971199)π≐1.7883.

Problem Link : https://www.codechef.com/JAN19A/problems/XYPIZQ

Draw a point A0 and two rays from this point such that the angle between them is α<π/2.

Mark N points A

Mark N points B

For each valid i, draw a line segment between points A

For each valid i, draw a line segment between points B

Finally, draw a line segment between points A

All these 2N−1 line segments must have equal lengths, which must also be equal to |A

The result should look roughly like this:

ChefY wants to show ChefX that he does not know his own design very well. He asks ChefX to compute the angle between three of the marked points in this figure. It is clear that there are only four types of angles:

∠A

∠A

∠A

∠B

Can you help ChefX find the angle ChefY asks for? It can be proved that under the given constraints, each angle can be written as π⋅m/n, where m and n are coprime integers; you should find m and n.

Example Input

1

175456798 1 151163203 151163204 151163205

Example Output

66583464 116971199

Explanation

Example case 1: The type is 1, so the angle we want is A

Problem Link : https://www.codechef.com/JAN19A/problems/XYPIZQ

Last edited on

My approach is :

First, calculate the angle made by two rays by using the given value of N . I think the angles are following some pattern and the base angle of that pattern is given by angle made by two rays.

Is my approach is in the right direction ??

First, calculate the angle made by two rays by using the given value of N . I think the angles are following some pattern and the base angle of that pattern is given by angle made by two rays.

Is my approach is in the right direction ??

Explanation of the given test case contains the whole solution.

Just use your brains.

It is pure geometry.

And to thos who have done these problems, it is a kind request please stop assisting these cheaters. If u are stuck somewhere then u can get help bit u just cannot expect someone to tell u the whole logic for a problem.

If u want to learn then just apply your brains and see explanation from codechef after the contest is over.

Just use your brains.

It is pure geometry.

And to thos who have done these problems, it is a kind request please stop assisting these cheaters. If u are stuck somewhere then u can get help bit u just cannot expect someone to tell u the whole logic for a problem.

If u want to learn then just apply your brains and see explanation from codechef after the contest is over.

I agree with @blackmamba.

I have solved it and it is just an observation based question(geometry).

But I am getting wrong answer, if somebody have solved it can provide any test cases please.

please tell me the solution of this:-

4

1000000000 1 999999998 999999999 1000000000

1000000000 1 100000000 100000001 100000002

1000000000 1 199999998 199999999 200000000

1000000000 1 100000000 100000001 100000002

I have solved it and it is just an observation based question(geometry).

But I am getting wrong answer, if somebody have solved it can provide any test cases please.

please tell me the solution of this:-

4

1000000000 1 999999998 999999999 1000000000

1000000000 1 100000000 100000001 100000002

1000000000 1 199999998 199999999 200000000

1000000000 1 100000000 100000001 100000002

Last edited on

@lazybot i solved the question and supplying the inputs this is my answer

1000000001 2000000001

633333333 666666667

1800000001 2000000001

633333333 666666667

PS:i dont understand why this answer is reported this is just a help Im not providing the code or something common!

1000000001 2000000001

633333333 666666667

1800000001 2000000001

633333333 666666667

PS:i dont understand why this answer is reported this is just a help Im not providing the code or something common!

Last edited on

@LordRiddle

jaahghai@gmail.com

Please mail me the answer to this solution or I am gonna lose bet I made with my friend. Thing is I was supposedly good at DSA but am ridiculous in geometry, and that is the thing I hate about these long challenges. Please help

jaahghai@gmail.com

Please mail me the answer to this solution or I am gonna lose bet I made with my friend. Thing is I was supposedly good at DSA but am ridiculous in geometry, and that is the thing I hate about these long challenges. Please help

i am getting a wrong answer eve after solving it ? are there any trick or base cases i cant get through?

Post your solution here, will compare it and tell. Also are you getting it right for the given cases in the ques description?

honeybuzz wrote: |
---|

Is A1A2 = A2A3 = B1B2 = B2B3 and so on... |

Not according to the problem description. Some of those may be equal length as a consequence of the given parameters, but they are not defined to be.

No base cases are there test cases arent that tricky just build the sequence and the notice the pattern.

Btw can any body give me hint for EARTHSEQ?i can onl solve the subtask.

Btw can any body give me hint for EARTHSEQ?i can onl solve the subtask.

yeah it would be good if someone gives hint for EARTSEQ I dont have any idea on how to start And for the solution of this question is pretty much straight forward just build the sequence as said above and notice the pattern

Explaining further find angle alpha for each case that is when n=1,n=2,n=3 u will notice a pattern there and find the type1 type2 type3 type4 angles they will again have a relationship with angle alpha and follow a pattern.

Try again this is just basic geometry give it a try it is a cakewalk trust me.

cheers:)

Explaining further find angle alpha for each case that is when n=1,n=2,n=3 u will notice a pattern there and find the type1 type2 type3 type4 angles they will again have a relationship with angle alpha and follow a pattern.

Try again this is just basic geometry give it a try it is a cakewalk trust me.

cheers:)

Is alpha=180/7 and for AAB x=0;y=1;z=2 180-2(alpha)

But after some time the angle becomes negative how to correct that or am i going the correct way

But after some time the angle becomes negative how to correct that or am i going the correct way

Pages: 12