|
|
вернуться в форумWhat is in test 9 Послано Uran 18 мар 2007 19:06 What is in test 9? Re: What is in test 9 Послано Uran 18 мар 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 long x[con],y[con] -> long long :), but you can get tle in 14 :P Re: What is in test 9 Послано anxier 13 сен 2011 17:10 I don't understand,it should be TLE. |
|
|