ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1207. Median on the Plane

why WA text 3???help me
Posted by skyming 30 Oct 2011 08:06
mycode:
#include<stdio.h>
#include<math.h>
#include<algorithm>
using namespace std;
#define N 10002
struct node
{
    double  x,y;
    int num;
}point[N];
int n;
int cmp(node a,node b)
{
    double pp=atan2(a.y-point[0].y,a.x-point[0].x);
    double qq=atan2(b.y-point[0].y,b.x-point[0].x);
    //double pp=(a.x-point[0].x)*(b.y-point[0].y)-(a.y-point[0].y)*(b.x-point[0].x);
    return pp>qq;
}
int main()
{
    scanf("%d",&n);
    for(int i=0;i<n;i++)
    {
        scanf("%lf%lf",&point[i].x,&point[i].y);
        point[i].num=i+1;
    }
    int pos=0;
    /*for(int i=1;i<n;i++)
    {
        if(point[i].x<point[pos].x||(point[i].x==point[pos].x)&&point[i].y<point[pos].y)
        pos=i;
    }
    swap(point[0],point[pos]);*/
    sort(point+1,point+n,cmp);
    printf("%d %d\n",point[0].num ,point[n/2].num);
    return 0;
}
what it`s function in /*  */