http://mirror.codeforces.com/contest/127/problem/C i have solved this problem. solution :http://mirror.codeforces.com/contest/127/submission/11415525
in my solution code..i find y1 and y2 as follows code;
for(i64 i=0;i<=x2;i++)
{
y2=i;
y1=min(y2*(t2-t0)/(t0-t1),x1);
// if(i==99)cout<<y2<<" "<<ans<<" "<<ans_x<<" "<<ans_y<<endl;
if(y1+y2==0)continue;
if(((t1*y1+t2*y2)*(ans_x+ans_y))<(ans*(y1+y2)) || ((((t1*y1+t2*y2)*(ans_x+ans_y))==(ans*(y1+y2))) && (y1+y2)>(ans_x+ans_y)))
{
ans=t1*y1+t2*y2;
ans_x=y1;
ans_y=y2;
}
}
it gives correct output..
i also find y1 and y2 another way..but it does not gives correct output..
for(i64 i=0;i<=x1;i++)
{
y1=i;
y2=min(y1*(t1-t0)/(t0-t2),x2);
// if(i==99)cout<<y2<<" "<<ans<<" "<<ans_x<<" "<<ans_y<<endl;
if(y1+y2==0)continue;
if(((t1*y1+t2*y2)*(ans_x+ans_y))<(ans*(y1+y2)) || ((((t1*y1+t2*y2)*(ans_x+ans_y))==(ans*(y1+y2))) && (y1+y2)>(ans_x+ans_y)))
{
ans=t1*y1+t2*y2;
ans_x=y1;
ans_y=y2;
}
}
where is my wrong in second procedure