I dont know how to approach this problem can someone help me with the dp and recursive relation.This is a hackerrank problem. Intuition behind it.https://www.hackerrank.com/challenges/prime-xor/problem
№ | Пользователь | Рейтинг |
---|---|---|
1 | jiangly | 3976 |
2 | tourist | 3815 |
3 | jqdai0815 | 3682 |
4 | ksun48 | 3614 |
5 | orzdevinwang | 3526 |
6 | ecnerwala | 3514 |
7 | Benq | 3482 |
8 | hos.lyric | 3382 |
9 | gamegame | 3374 |
10 | heuristica | 3357 |
Страны | Города | Организации | Всё → |
№ | Пользователь | Вклад |
---|---|---|
1 | cry | 169 |
2 | -is-this-fft- | 162 |
3 | Um_nik | 161 |
4 | atcoder_official | 160 |
5 | djm03178 | 157 |
5 | Dominater069 | 157 |
7 | adamant | 154 |
8 | luogu_official | 152 |
9 | awoo | 151 |
10 | TheScrasse | 148 |
https://www.hackerrank.com/challenges/prime-xor/problem.Can anybody tell how to approach this problem.
I dont know how to approach this problem can someone help me with the dp and recursive relation.This is a hackerrank problem. Intuition behind it.https://www.hackerrank.com/challenges/prime-xor/problem
Название |
---|
There will be atmost $$${1000}$$$ distinct values. The xor of all these values will be atmost $$${2^{13} -1}$$$. So you can have a state $$${(x,y)}$$$ where x is the value you currently are and y is the xor accumulated by taking some instances of previous elements. You can take even instances of this element x with no effect on xor or odd instances of this element with xor changing to $$${y}$$$ xor $$${x}$$$. You can map values from $$${3500-4500}$$$ to $$${1-1000}$$$. Store frequency for each element. You will have to precompute factorials and inverse factorials upto $$${100000}$$$. Total states will be atmost $$${1000 * 8191 }$$$