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 | 3993 |
2 | jiangly | 3743 |
3 | orzdevinwang | 3707 |
4 | Radewoosh | 3627 |
5 | jqdai0815 | 3620 |
6 | Benq | 3564 |
7 | Kevin114514 | 3443 |
8 | ksun48 | 3434 |
9 | Rewinding | 3397 |
10 | Um_nik | 3396 |
# | User | Contrib. |
---|---|---|
1 | cry | 167 |
2 | Um_nik | 163 |
3 | maomao90 | 162 |
3 | atcoder_official | 162 |
5 | adamant | 159 |
6 | -is-this-fft- | 158 |
7 | awoo | 156 |
8 | TheScrasse | 154 |
9 | Dominater069 | 153 |
10 | nor | 152 |
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://codeforces.net/blog/entry/2154
UPD: seems like I mixed the letters up as well