My code for 903D - Almost Difference has got Time limits. My solution is 33798061, but I could not fix the problem. Can anyone help me? This is my code : CODE
№ | Пользователь | Рейтинг |
---|---|---|
1 | tourist | 3757 |
2 | jiangly | 3647 |
3 | Benq | 3581 |
4 | orzdevinwang | 3570 |
5 | Geothermal | 3569 |
5 | cnnfls_csy | 3569 |
7 | Radewoosh | 3509 |
8 | ecnerwala | 3486 |
9 | jqdai0815 | 3474 |
10 | gyh20 | 3447 |
Страны | Города | Организации | Всё → |
№ | Пользователь | Вклад |
---|---|---|
1 | maomao90 | 171 |
2 | awoo | 165 |
3 | adamant | 164 |
4 | TheScrasse | 159 |
5 | maroonrk | 155 |
6 | nor | 154 |
7 | -is-this-fft- | 152 |
8 | Petr | 147 |
9 | orz | 146 |
10 | pajenegod | 145 |
My code for 903D - Almost Difference has got Time limits. My solution is 33798061, but I could not fix the problem. Can anyone help me? This is my code : CODE
Название |
---|
Your solution is O(n2) and 1 ≤ n ≤ 200000. That is not nearly fast enough to run under 2 seconds. If you want, you could try reading the editorial to that problem: http://codeforces.com/blog/entry/56330.
It gives a solution. This is not a simple problem which can be brute forced. If you happen to want to do those sort of problems, look at problems A and B in Div. 2 rounds.
Best of luck!