Hi Codeforces! I was wondering if we could compute a ^ (a + b) ^ (a + 2b) ^ ... ^ (a + kb) in O(1) or such. Thought about it a lot but still I have no solutions :( Do you have any idea? Thank you!
№ | Пользователь | Рейтинг |
---|---|---|
1 | tourist | 3880 |
2 | jiangly | 3669 |
3 | ecnerwala | 3654 |
4 | Benq | 3627 |
5 | orzdevinwang | 3612 |
6 | Geothermal | 3569 |
6 | cnnfls_csy | 3569 |
8 | jqdai0815 | 3532 |
9 | Radewoosh | 3522 |
10 | gyh20 | 3447 |
Страны | Города | Организации | Всё → |
№ | Пользователь | Вклад |
---|---|---|
1 | awoo | 161 |
2 | maomao90 | 160 |
3 | adamant | 156 |
4 | maroonrk | 153 |
5 | -is-this-fft- | 148 |
5 | atcoder_official | 148 |
5 | SecondThread | 148 |
8 | Petr | 147 |
9 | nor | 144 |
9 | TheScrasse | 144 |
Hi Codeforces! I was wondering if we could compute a ^ (a + b) ^ (a + 2b) ^ ... ^ (a + kb) in O(1) or such. Thought about it a lot but still I have no solutions :( Do you have any idea? Thank you!
Название |
---|
I didn't quite get the idea. Can you explain it more detailed?
Fine, here you go.
There are three parameters:
a
,b
andk
. Let us first learn how to solve simpler problems by fixing some of the parameters to some small values.With
a = 1
,k = 1
, solve the problemf (b) = a ^ (a + b) ^ (a + 2b) ^ ... ^ (a + kb)
. Output the first few values and observe.Once you have the solution for the simpler problem, you can return
a
andk
as parameters. Fora
, it is justg (a, b) = f (b) - f (a - 1)
. Fork
, it is perhapsh (a, b, k) = g (a, b) * k
or something similar.If
a = 1
,k = 1
then obviouslyf(b) = 1 ^ (b + 1)
, I guess?If so then g(a, b) as provided by you is wrong, I suppose.
Ow, sorry, I mixed up the letters
b
andk
. The interesting problem reduction isf (k)
fora = 1
,b = 1
, notf (b)
fora = 1
,k = 1
. Then returna
andb
into the picture.I could not figure out any way to restore
b
. It seems even witha = 1
it has no pattern at all?http://codeforces.com/blog/entry/2154
UPD: seems like I mixed the letters up as well