How to estimate the complexity of the code needed to pass the solution by checking the constrains nd time limit ??
# | User | Rating |
---|---|---|
1 | tourist | 4009 |
2 | jiangly | 3823 |
3 | Benq | 3738 |
4 | Radewoosh | 3633 |
5 | jqdai0815 | 3620 |
6 | orzdevinwang | 3529 |
7 | ecnerwala | 3446 |
8 | Um_nik | 3396 |
9 | ksun48 | 3390 |
10 | gamegame | 3386 |
# | User | Contrib. |
---|---|---|
1 | cry | 167 |
2 | Um_nik | 163 |
3 | maomao90 | 162 |
3 | atcoder_official | 162 |
5 | adamant | 159 |
6 | -is-this-fft- | 158 |
7 | awoo | 157 |
8 | TheScrasse | 154 |
9 | Dominater069 | 153 |
9 | nor | 153 |
How to estimate the complexity of the code needed to pass the solution by checking the constrains nd time limit ??
Name |
---|
On the modern computers we can do something like 108 trivial operations per second.
Basically it depends on the architecture of the system you are running the program. In my experience, on most judges roughly 10^8 operations can run per second. It depends on the language you code. For Slower languages like java and python bring that down by two to three times. Also it depends on the operations you have. Simple operations like addition, subtraction , multiply are fast. Division, modulo are slow operations. There are many more factors involved.
But to sum it up, you can have 10^7-10^8 operations generally while submitting your code on most judges. That means if say you had a problem with array of size N = 1000 and T = 100 such test cases, then you can try out an algorithm of O(N^2) complexity (if it fails try optimizing and reducing constant factors). If N was O(10^5) then a O(N) algorithm would do. If N is very large say 10^18, then go for a O(log(N)) solution or even O(1) solution. In this way, just by seeing the constraints of the problem, you can roughly estimate what complexity it can have at max.