Thnx mjf ...
0.150 seconds after that without using optimized io
Official solution uses a nonlogical algorithm, that says that you can't go from one island to another if they overlap. We're going to change the input, so that no 2 islands intersect.
And a negative island number is logical? ...
0.123 after switching to scanf/printf from cin cout ^^
10947  Bear with me, again..
Moderator: Board moderators

 Guru
 Posts: 1080
 Joined: Thu Dec 19, 2002 7:37 pm

 Guru
 Posts: 724
 Joined: Wed Dec 19, 2001 2:00 am
 Location: Germany

 New poster
 Posts: 20
 Joined: Tue Sep 20, 2005 9:20 am
 Location: Daejeon, Korea
It seems the problem is rejudged now, there are a lot more people with 6 solved, you being one of them. Still lots of TLEs though, so I guess they still have a lot more I/O than during the actual contest. Oh well.little joey wrote:This problem definitly needs rerejudging (and I want my perfect score 6 AC for 6 submissions for the contest back...).
For some reason they seem to have rejudged F as well, my solution where I accidentally typed "int isprime[10000010];" rather than "int isprime[1000010];" and (rightfully) got MLE has been rejudged to AC. Strange.
10947  Bear with me, again..
Code: Select all
#include<iostream>
#include<cstdio>
#include<cmath>
#include<climits>
using namespace std;
int xc[110],yc[110],r[110];
double a[110][110];
double min(double x,double y)
{
if(x>y)return y;
return x;
}
double max(double x,double y)
{
if(x>y)return x;
return y;
}
double distance(int x1,int y1,int x2,int y2)
{
return sqrt(((x1x2)*(x1x2))+((y1y2)*(y1y2)));
}
int main()
{
int i,j,n,sx,sy,sr,dx,dy,dr;
double k,m;
while(scanf("%lf%lf",&k,&m)==2)
{
cin>>xc[0]>>yc[0]>>r[0]>>dx>>dy>>dr;
cin>>n;
for(i=1;i<=n;i++)
scanf("%d%d%d",&xc[i],&yc[i],&r[i]);
xc[n+1]=dx;yc[n+1]=dy;r[n+1]=dr;
for(i=0;i<=n+1;i++)
{
for(j=0;j<=n+1;j++)
{
a[i][j]=INT_MAX;
}
a[i][i]=0;
}
for(i=0;i<=n+1;i++)
{
for(j=i+1;j<=n+1;j++)
{
a[i][j]=a[j][i]=distance(xc[i],yc[i],xc[j],yc[j])r[i]r[j];
}
}
for(k=0;k<=n+1;k++)
{
for(i=0;i<=n+1;i++)
{
for(j=0;j<=n+1;j++)
{
a[i][j]=min(a[i][j],max(a[i][k],a[k][j]));
}
}
}
if(a[0][n+1]>(k*m)a[0][n+1]==INT_MAX)
printf("Larry and Ryan will be eaten to death.\n");
else
printf("Larry and Ryan will escape!\n");
}
return 0;
}

 Guru
 Posts: 5947
 Joined: Thu Sep 01, 2011 9:09 am
 Location: San Jose, CA, USA
Re: 10947 : wy WA.????
Compile Error:
Code: Select all
code.cpp: In function 'int main()':
code.cpp:57:31: error: invalid types 'double [110][double]' for array subscript
code.cpp:57:36: error: invalid types 'double [110][110][double]' for array subscript
Check input and AC output for thousands of problems on uDebug!

 Experienced poster
 Posts: 145
 Joined: Thu Aug 14, 2003 8:42 am
 Location: Mountain View, California
 Contact:
Re: 10947 : wy WA.????
This problem is easy enough so you should not get W.A.
Have you ever...
 Wanted to work at best companies?
 Struggled with interview problems that could be solved in 15 minutes?
 Wished you could study realworld problems?