Problem
№ | Пользователь | Рейтинг |
---|---|---|
1 | tourist | 4009 |
2 | jiangly | 3839 |
3 | Radewoosh | 3646 |
4 | jqdai0815 | 3620 |
4 | Benq | 3620 |
6 | orzdevinwang | 3612 |
7 | Geothermal | 3569 |
7 | cnnfls_csy | 3569 |
9 | ecnerwala | 3494 |
10 | Um_nik | 3396 |
Страны | Города | Организации | Всё → |
№ | Пользователь | Вклад |
---|---|---|
1 | Um_nik | 164 |
2 | maomao90 | 160 |
3 | -is-this-fft- | 159 |
4 | atcoder_official | 158 |
4 | awoo | 158 |
4 | cry | 158 |
7 | adamant | 155 |
8 | nor | 154 |
9 | Dominater069 | 151 |
9 | maroonrk | 151 |
Название |
---|
hmmm... i think if you could give us the link to the problems judge, it would've been a lot easier... :)
An efficient way of solving this problem(instead of O(n)). Can you provide the link to the ques so that i can verify my ans?
My Code
Sorry, this problem appears in the OA of ByteDance So, I don't have a link. But Could you PLz Explain your Approach Thanks.
Instead of allocating memory for each second i.e O(n) we can directly make a jump of i seconds. we choose that value of i after which the maxm(m1,m2) changes.
we will remove i' units i.e sum of n natural numbers upto i — (already removed units upto prev. seconds).
i is calculated using quadratic equation i*(i+1)/2=difference reqd.