Hi,
Can someone tell me on what basis you decide that a naive solution will cause time exceeded error ? I have faced this problem quite a few times.
# | 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 |
Hi,
Can someone tell me on what basis you decide that a naive solution will cause time exceeded error ? I have faced this problem quite a few times.
gerasimovd
|
14 years ago,
#
|
←
Rev. 2
→
+6
You should know that an average cheking system can do(should I use do or make verb in this case?) about 10000000(10^7) simple operations per second.(For example, my PC can add 30000000 integers to each other in a second). So if you want to do something like this: for (int i = 0; i < 100000; i++) for (int j = 0; j < 100000; j++) ....//do smth it will definetely get TL(10^10 operations). But if you want to sort an array of 100000 elements(100000 * log2(1000000) < 10^7), everything will be ok.
→
Reply
|
wil93
|
14 years ago,
#
^
|
0
@Dmitry: It is O(n*log2(n)), not O(n^log2(n))
→
Reply
|
gerasimovd
|
14 years ago,
#
^
|
0
yep, just a mistake :) fixed
→
Reply
|
al13n
|
14 years ago,
#
|
0
The main method for this is formal complexity estimation, the one with O() notation. There are also smaller implementaion factors affecting performance, like cache efficiency, but the time limits are usually not very strict and asymptotically good solution is usually enough.
→
Reply
|
MciprianM
|
14 years ago,
#
|
0
You can also measure the time your program takes to run on the worst case(s). Usually try the big ones.
→
Reply
|
Name |
---|