Where can I see how much time my code needs?

I have written a code and I got TLE. Where can I see how much time my code needs?

it is available in the problem statement page itself.
Below the Example test cases we can see the maximum time limit field.

No, that’s not what I’am asking. Suppose time limit is 3 seconds and my code needs (for example) 10.32 seconds for all tests, so I got TLE. Where can I see the number 10.32?

@petkomat : You cannot know how much time your could would have taken . If time limit is 3 seconds and your program does not terminate by 3.01 seconds your program is killed and core is dumped , so there is no way to know how much time it would have taken since the server never let your program run beyond time limit . You can test and measure the time taken by your program locally on large and extreme data sets and then compare your machine specifications with SPOJ machines specifications and get an idea whether your program is likely to terminate in time limit or not .


@petkomat : agreed with what @vineetpaliwal said. i dont think you can see EXACTLY how much time your code takes. because that also depends on the input, doesnt it? And we don’t know system cases obviously. so maybe the only way to see if your code will pass is to compute the time complexity and see if it can work in the given limit with given constraints, though it doesn’t give you a very exact idea but helps you select the algorithm you can use for a particular problem.

And, just in case you don’t know, you can try using online IDEs, like www.ideone.com. There, after you write your code, you can view how much time it took for the input that you gave. helpful many times(specially in case of pre computations like say prime numbers, you can see how much time the pre computing itself takes). hope this helps :slight_smile:


true… ideone.com is helpful… happy coding