hi all,

does anyone know how to find out the time taken in the program execution in ms visual c++ express 2010 ???

i have a feeling that a lot of my submissions are being rejected due to excess time taken by my source code…!!!

hi all,

does anyone know how to find out the time taken in the program execution in ms visual c++ express 2010 ???

i have a feeling that a lot of my submissions are being rejected due to excess time taken by my source code…!!!

In fact you don’t need this, you do not need exact amount of time

- server is slower than your PC
- you still have to find worst case

Analyze your code and try to find out complexity of your algorithm. So if you find out, that your code complexity is O(N*M), you can assume that for 10.000.000 “operations” it will pass (for 1s timelimit). So if your max. N is 100.000 and max M is also 100.000 it won’t. The number of “operations” per second is not guarantied, but I believe that for 1s ~10.000.000 “operations” is ok.

For easier problems you can easily see, that if you use one inner loop

```
for ( int i = 0; i < N; ++i )
for ( int j = 0; i < M; ++j )
...
```

the complexity is O(N*M).

Be aware that we are talking about asymptotic complexity (it means that we are interested in huge N) so

if your loops are

```
for ( int i = 0; i < N; ++i )
for ( int j = i+1; i < M; ++j )
...
```

the complexity is O(N*M/2), but typically such constants are ignored and we are talking about O(N*M) complexity.

For more difficult problems you have to know something about data structures you are using or algorithms used for some problem classes…