problem with implementing this question of codechef

Pages: 1... 34567... 13
closed account (DGLCfSEw)
@Wasp Which equation did you use? Are we using the correct one ?
Yes i used dot product.And you are going corect if u follow my formula which i pasted earlier
Last edited on
closed account (DGLCfSEw)
....
Last edited on
There can be some mistake in ur calculationns
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
@kashish why are you taking such leghty expressions you should rather break tjem in small pieces.
Can anyone help me with this ??

http://www.cplusplus.com/forum/beginner/238075/
closed account (43hf216C)
@imrahul could you tell your values of a,b,c
@Wasp please share your code that passed subtask 1
@zyan actually cannot bro it may lead to plagiarism
closed account (43hf216C)
@Wasp okay just share the values of A,B,C. Dont tell the code
@lastchance
can u provide me a hint on the problem
https://www.codechef.com/JUNE18B/problems/TWOFL
closed account (43hf216C)
@kashish were you able to do vsn? Please help!
closed account (43hf216C)
@Wasp we will also change the code. dont worry. no plag
@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
I used this formula

R^2 = { | p × q | ^ 2 } / { | pq | ^ 2 }
closed account (43hf216C)
@ffloyd could you elaborate please
hey guys can anyone provide the correct code for this problem
https://www.codechef.com/JUNE18B/problems/VSN
@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
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
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
Pages: 1... 34567... 13