How to estimate the complexity of the code needed to pass the solution by checking the constrains nd time limit ??
# | User | Rating |
---|---|---|
1 | tourist | 3985 |
2 | jiangly | 3814 |
3 | jqdai0815 | 3682 |
4 | Benq | 3529 |
5 | orzdevinwang | 3526 |
6 | ksun48 | 3517 |
7 | Radewoosh | 3410 |
8 | hos.lyric | 3399 |
9 | ecnerwala | 3392 |
9 | Um_nik | 3392 |
# | User | Contrib. |
---|---|---|
1 | cry | 169 |
2 | maomao90 | 162 |
2 | Um_nik | 162 |
4 | atcoder_official | 161 |
5 | djm03178 | 158 |
6 | -is-this-fft- | 157 |
7 | adamant | 155 |
8 | awoo | 154 |
8 | Dominater069 | 154 |
10 | luogu_official | 151 |
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.