 # POINTMEE - Editorial

Can someone help, why am I getting WA for the second test case, my submission

this point too ?!

2 points that initially needed 2 operations each to coincide with the meeting location now only need 1 operation each if we consider the suggested points as meeting locations, thus reducing the total operations. As it says the number of operations are reduced from 2 to 1 so the 0 later on is a mistype that is intended to be 1, @cherry0697 do make the change.

1 Like

i guess is it the overall final explanation behind the approach ?

In the editorial solution can someone please explain why only half of the intersection points were added to x and y vectors instead of 12 as tabulated? @cherry0697, please clarify this.

if you have your loop as

``````for(int i=0;i<n;i++){
for(int j=i+1;j<n;j++){
}
}
``````

then you would have had to add all 12 points but according to the editorial solution the two points will encounter again in a reverse manner hence the other 6 will be included.

Ahh…i see now! Thanks a lot @tyagi2000 ``````> int Calc_OP(fl p,fl q,vector<fl> x1,vector<fl> y1){
>
>     int i,sum=0;
>
>     for(i=0;i<x1.size();i++){
>
>         fl bh,lo;
>
>         bh=p-x1[i];
>
>         lo=q-y1[i];
>
>
>
>         if(x1[i]==p){
>
>             if(fabs(y1[i]-q)>0){
>
>                sum+=1;
>
>             }
>         }
>
>         else if(y1[i]==q){
>
>             if(fabs(x1[i]-p)>0){
>
>                 sum+=1;
>
>             }
>         }
>
>         else if(fabs(bh)==abs(lo)){
>
>             sum+=1;
>
>         }
>
>         else{
>
>             sum+=2;
>
>         }
>
>
>     return sum;
>
> }
``````

This is the function i am using for calculating operations for a particular intersecting point (p,q) for a pair of points

Is these are the only conditions for which i have to check for calculating operation ? Or i have to add more in it , as i am getting wa in second and third test case while submitting

Could anyone help me to figure it out ?

Hey, @david_s I was doing the same thing can you please help me with my code Code.

Much as I would like to help, I cannot do so when there are no comments in your code, not even explaining what the various functions do. Note that by doubling all the coordinates you can work entirely in integers, avoiding any possible rounding problems with floating-point numbers. As a matter of practice I always add comments as I go - a few extra minutes while writing the code saves much trouble later. If I look at uncommented code I have written a while ago I cannot understand it, and certainly do not expect anyone else to.

Hey, @david_s thanks for your tip, from now on I’ll write the comments. I have already figured out my mistake in this question.