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

What is in test 9
Posted by Uran 18 Mar 2007 19:06
What is in test 9?
Re: What is in test 9
Posted by Uran 18 Mar 2007 21:53
there is my code, its get WA on 9th test:

#include <iostream.h>
__int64 inline linea(long x1i,long y1i,long x2i,long y2i)
{return y2i-y1i;}
__int64 inline lineb(long x1i,long y1i,long x2i,long y2i)
{return x1i-x2i;}
__int64 inline linec(long x1i,long y1i,long x2i,long y2i)
{return y1i*x2i-x1i*y2i;}
int main()
{
    const long con=20000;
    long n,i,j,k,p1,p2;
    long x[con],y[con];
    __int64 a,b,c;
    cin>>n;
    p1=0;p2=1;
    for (i=1;i<n+1;i++){cin>>x[i]>>y[i];}
    for (i=1;i<n+1;i++)
    {
        if (p1==p2){break;}
        for (j=i+1;j<n+1;j++)
        {
        p1=0;p2=0;
        a=linea(x[i],y[i],x[j],y[j]);
        b=lineb(x[i],y[i],x[j],y[j]);
        c=linec(x[i],y[i],x[j],y[j]);
        for (k=1;k<i;k++)
        {
            if (-b*y[k]>=a*x[k]+c){p1++;}
            if (-b*y[k]<=a*x[k]+c){p2++;}
        }
        for (k=i+1;k<j;k++)
        {
            if (-b*y[k]>=a*x[k]+c){p1++;}
            if (-b*y[k]<=a*x[k]+c){p2++;}
        }
        for (k=j+1;k<n+1;k++)
        {
            if (-b*y[k]>=a*x[k]+c){p1++;}
            if (-b*y[k]<=a*x[k]+c){p2++;}
        }
        if (p1==p2) {cout<<i<<" "<<j;break;}
        }
    }
    return 0;
}
Can anybody help me?
Re: What is in test 9
Posted by Nguyễn Cảnh Toàn 31 Dec 2008 18:54
long x[con],y[con] -> long long :), but you can get tle in 14 :P
Re: What is in test 9
Posted by anxier 13 Sep 2011 17:10
I don't understand,it should be TLE.