problem with implementing this question of codechef

Pages: 1... 34567... 13
Jun 9, 2018 at 3:56am
closed account (DGLCfSEw)
@Wasp Which equation did you use? Are we using the correct one ?
Jun 9, 2018 at 5:38am
Yes i used dot product.And you are going corect if u follow my formula which i pasted earlier
Last edited on Jun 9, 2018 at 5:39am
Jun 9, 2018 at 5:52am
closed account (DGLCfSEw)
....
Last edited on Jun 9, 2018 at 11:29am
Jun 9, 2018 at 7:54am
There can be some mistake in ur calculationns
Jun 9, 2018 at 8:25am
i got these values of A,B,C but it passes only on case..can someone tell me the mistake?

A=pow((c3-p3)*d1-(c1-p1)*d3,2)+pow((c2-p2)*d3-(c3-p3)*d2,2)+pow((c1-p1)*d2-(c2-p2)*d1,2)-r*r*(d1*d1+d2*d2+d3*d3);


B=pow(c2-p2,2)*2*d3*(q3-p3)+pow(c3-p3,2)*2*d2*(q2-p2)-2*(c2-p2)*(c3-p3)*(q3*d2+q2*d3-p2*d3-p3*d2)+pow(c3-p3,2)*2*d1*(q1-p1)+pow(c1-p1,2)*2*d3*(q3-p3)-2*(c3-p3)*(c1-p1)*(q1*d3+q3*d1-p3*d1-p1*d3)+pow(c1-p1,2)*2*d2*(q2-p2)+pow(c2-p2,2)*2*d1*(q1-p1)-2*(c1-p1)*(c2-p2)*(q1*d2+q2*d1-d1*p2-p1*d2)-r*r*2*(q1*d1-p1*d1+q2*d2-p2*d2+q3*d3-p3*d3);


C=pow(c2-p2,2)*(q3*q3+p3*p3-2*p3*q3)+pow(c3-p3,2)*(q2*q2+p2*p2-2*p2*q2)-2*(c2-p2)*(c3-p3)*(q3*q2-q3*p2-p3*q2+p2*p3)+pow(c3-p3,2)*(q1*q1+p1*p1-2*p1*q1)+pow(c1-p1,2)*(q3*q3+p3*p3-2*p3*q3)-2*(c3-p3)*(c1-p1)*(q1*q3-q1*p3-p1*q3+p1*p3)+pow(c1-p1,2)*(q2*q2+p2*p2-2*p2*q2)+pow(c2-p2,2)*(q1*q1+p1*p1-2*q1*p1)-2*(c1-p1)*(c2-p2)*(q1*q2-q1*p2-p1*q2+p1*p2)-r*r*(q1*q1+p1*p1-2*p1*q1+q2*q2+p2*p2-2*p2*q2+q3*q3+p3*p3-2*p3*q3);
Last edited on Jun 9, 2018 at 8:26am
Jun 9, 2018 at 9:37am
@kashish why are you taking such leghty expressions you should rather break tjem in small pieces.
Jun 9, 2018 at 9:38am
Can anyone help me with this ??

http://www.cplusplus.com/forum/beginner/238075/
Jun 9, 2018 at 10:31am
closed account (43hf216C)
@imrahul could you tell your values of a,b,c
@Wasp please share your code that passed subtask 1
Jun 9, 2018 at 10:32am
@zyan actually cannot bro it may lead to plagiarism
Jun 9, 2018 at 10:37am
closed account (43hf216C)
@Wasp okay just share the values of A,B,C. Dont tell the code
Jun 9, 2018 at 10:37am
@lastchance
can u provide me a hint on the problem
https://www.codechef.com/JUNE18B/problems/TWOFL
Jun 9, 2018 at 10:39am
closed account (43hf216C)
@kashish were you able to do vsn? Please help!
Jun 9, 2018 at 10:55am
closed account (43hf216C)
@Wasp we will also change the code. dont worry. no plag
Jun 9, 2018 at 11:07am
@Monkey

you got the right equations of a,b,c. it will give AC in all the test cases definetly but be conscious while giving output ,you are too close
Jun 9, 2018 at 11:11am
I used this formula

R^2 = { | p × q | ^ 2 } / { | pq | ^ 2 }
Jun 9, 2018 at 11:24am
closed account (43hf216C)
@ffloyd could you elaborate please
Jun 9, 2018 at 11:33am
hey guys can anyone provide the correct code for this problem
https://www.codechef.com/JUNE18B/problems/VSN
Jun 9, 2018 at 11:34am
@Wasp | p × q | it is cross product right ? | pq | it is dot product right ? then why i'm getting wrong answer for sample test case.
Last edited on Jun 9, 2018 at 11:34am
Jun 9, 2018 at 11:36am
closed account (DGLCfSEw)
@ffloyd If A is 0 output is -C/B else two values of t and the smallest positive one is the answer, right? It's still giving me WA for all other cases except first subtask.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
if(A==0)
        {
            T=-(C/B);
            cout<<fixed<<setprecision(6)<<T<<"\n";
        }
        else
        {
            T1=(-B+sqrt(B*B-4*A*C))/2*A;
            T2=(-B-sqrt(B*B-4*A*C))/2*A;

            if(T1<0){cout<<fixed<<setprecision(6)<<T2<<"\n";}
            else if(T2<0){cout<<fixed<<setprecision(6)<<T1<<"\n";}
            else if(T1>=0 && T2>=0){cout<<fixed<<setprecision(6)<<min(T1,T2)<<"\n";}
        }

Don't know what else am I missing.
Last edited on Jun 9, 2018 at 11:40am
Jun 9, 2018 at 11:50am
Got AC. Very silly mistake in the output.
Sub-Task Task # Result
(time)
1 0 AC
(0.020000)
1 1 AC
(1.340000)
1 2 AC
(1.320000)
Subtask Score: 25.00% Result - AC
2 3 AC
(1.360000)
2 4 AC
(1.340000)
2 5 AC
(1.360000)
2 6 AC
(1.290000)
Subtask Score: 75.00% Result - AC
Total Score = 100.00%
Last edited on Jun 9, 2018 at 1:05pm
Pages: 1... 34567... 13