Why would you think that
It shouldn’t pass unless its a super computer in any language.
Tcs have:rofl:((((()))))
Actually, I was so obsessed with this problem(thinking that this is the easiest one) I spent almost 2 hours for this
Presentation error and AC are equivalent, right?
Editor | Compile & Run History is what I see above. Check SUBMISSIONS, this shows result only for given/public test cases. My Work life solution was correct here and wrong in submissions section, when I fixed the bug it was correct on both the sections.
Presentation Error status comes when your program output differs from the expected output by a whitespace character.
Even If your program shows this status, your problem is considered as solved. So don’t try to get it in Accepted status and move on to next problem.
Are the results of Codevita out yet?
No. I think it takes about 10 days.
hmm…so it was not ACCEPTED in public test cases may be…
@ssrivastava990 is it ACCEPTED in SUBMISSIONS also…??
Hey do u know how to solve the VM fitment problem?
Yahhh…it is accepted
Yes i have solved aprox 12-13 different problems.
The links of the separate rank lists of zone1 & zone2 are
Zone 1 : Zone1
Zone 2 : Zone 2
Source : https://campuscommune.tcs.com/channels/codevita-season-8
Anyone who got the mail regarding invitation for a Direct Interview for a
career with TCS.
I have got an email for Call Basis Interview
anyone have taken screenshot of problem statement workbalance of tcs codevita if so please do share it or anyone remember it…pls share
Could you pls provide me the ‘life guard’ solution. I was getting runtime error ,but public test cases were passed!
//solved using binary search to prevent time exceed error you can use brute force also
#include <iostream>
#include <cmath>
using namespace std;
long double xl, yl, xw, yw, f;
long double calculate_it(long double i)
{
return sqrt(((xl - i) * (xl - i)) + (yl * yl)) / f + sqrt((xw - i) * (xw - i) + yw * yw);
}
long double search_it(long double start, long double end)
{
long double mid, current, prev, next;
long double ans = -1;
while (true)
{
mid = (start + end) / 2;
prev = calculate_it(mid - 0.000001);
current = calculate_it(mid);
next = calculate_it(mid + 0.000001);
if (prev > current && next > current)
{
ans = mid;
break;
}
else if (prev > current)
{
start = mid + 0.000001;
}
else
{
end = mid - 0.000001;
}
}
return ans;
}
int main()
{
cin >> xl >> yl >> xw >> yw >> f;
long double count;
if (xl > xw)
{
count = search_it(xw, xl);
}
else
{
count = search_it(xl, xw);
}
printf("%.6lf", (double)count);
return 0;
}
/*
Explanation
(time)
^
| * *
| * *
| * *
| * *
| * <--------(x_min )
|
(0,0)±-------------------------------------->(position)
| |
(x_l) (x_w)
|___________________________|
(x_min is between this point)
we can use binary search by using the following condition :
-
start = min(x_l,x_w) , end = min(x_l,x_w)
-
calculate middle = (start + end )/2
-
find the time taken for position (middle-0.000001) , (middle) ,(middle + 0.000001) by using the formula ;
-
let the calucated time be prev, current and next respectively.
we can find direct our binary search using following condition ;
if( time taken in middle position is smaller than both prev and next )
then this is the required position
else if( time taken in middle position is >time taken n prev postion )
then move right
else
move left
*/
(time_min)