I am solving 181B - Сколько троек. With the constraints being $$$n <= 3000$$$ and my solution supposedly running in $$$O(n^{2})$$$. Am I missing something? 88909110.
№ | Пользователь | Рейтинг |
---|---|---|
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 |
Страны | Города | Организации | Всё → |
№ | Пользователь | Вклад |
---|---|---|
1 | cry | 166 |
2 | maomao90 | 163 |
2 | Um_nik | 163 |
4 | atcoder_official | 161 |
5 | adamant | 160 |
6 | -is-this-fft- | 158 |
7 | awoo | 157 |
8 | TheScrasse | 154 |
9 | nor | 153 |
9 | Dominater069 | 153 |
I am solving 181B - Сколько троек. With the constraints being $$$n <= 3000$$$ and my solution supposedly running in $$$O(n^{2})$$$. Am I missing something? 88909110.
Название |
---|
Map with key of pair<long double, long double> would be slow, though still surprised it TLE's (actually on second thought I'm not, it is like O(n^2lgn) with rlly bad constant factor. Plug in 3000). Don't divide coordinates by 2, just multiply all coordinates by 2, and no need to work with doubles, and try not to use map in the first place (constraints are small). In general, try to avoid doubles, they are slow, and use array when you can.
Since you are using map it's $$$O(n^2 \log n)$$$. Also float arithmetic consumes huge constant factor, that's probably why you are getting TLE.