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!
# | User | Rating |
---|---|---|
1 | tourist | 3985 |
2 | jiangly | 3814 |
3 | jqdai0815 | 3682 |
4 | Benq | 3529 |
5 | orzdevinwang | 3526 |
6 | ksun48 | 3517 |
7 | Radewoosh | 3410 |
8 | hos.lyric | 3399 |
9 | ecnerwala | 3392 |
9 | Um_nik | 3392 |
# | User | Contrib. |
---|---|---|
1 | cry | 169 |
2 | maomao90 | 162 |
2 | Um_nik | 162 |
4 | atcoder_official | 161 |
5 | djm03178 | 158 |
6 | -is-this-fft- | 157 |
7 | adamant | 155 |
8 | awoo | 154 |
8 | Dominater069 | 154 |
10 | luogu_official | 150 |
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!
Name |
---|
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://mirror.codeforces.com/blog/entry/2154
UPD: seems like I mixed the letters up as well