Large data set of codejam problem bullseye

How to handle the large data set of the following problem of codejam 2013.?

what i did was just using this function for discrete binary search, thinking it would pass :

bool check(int x)
 return ((2*x + 2*r -1)<=(t/x));

where x is the mid we calculate in binary function.

1 Like

t/x there would return an integer , I think there might be the problem.

bool(int x)
     return (((2*x +2*r -1)*x) <= t);

It worked :slight_smile:

This code works for short data set, not running for large input file.

@c0d3_k1ra Using
bool(int x)
return (((2x +2r -1)*x) <= t);

gives wrong answer for the test cases given but if i change that too my definition of check(), it gives correct (for small data input).

You need to prevent overflow of ‘x’ and ‘t’.
Convert ‘x’ to double and check if ‘t’ never exceeds 1e18.

My solution As per your solution and the input i have entered there, it is the same input file for which i am supposed to submit my output file and that is not running.

I’ll just check again in a while and come back to you regarding that.

@wittyceaser Did u check…?

Yes, my solution got accepted.

But how’ll i submit the o/p file when m not getting the output??