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 | 4009 |
2 | jiangly | 3821 |
3 | Benq | 3736 |
4 | Radewoosh | 3631 |
5 | jqdai0815 | 3620 |
6 | orzdevinwang | 3529 |
7 | ecnerwala | 3446 |
8 | Um_nik | 3396 |
9 | ksun48 | 3388 |
10 | gamegame | 3386 |
Страны | Города | Организации | Всё → |
№ | Пользователь | Вклад |
---|---|---|
1 | cry | 164 |
1 | maomao90 | 164 |
3 | Um_nik | 163 |
4 | atcoder_official | 161 |
5 | -is-this-fft- | 158 |
6 | awoo | 157 |
7 | adamant | 156 |
8 | TheScrasse | 154 |
8 | nor | 154 |
10 | Dominater069 | 153 |
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.me/blog/entry/2154
UPD: seems like I mixed the letters up as well