Hello codeforces!
I need help with this problem: UVa_11754
If all Ki = 1, we can use Chinese Remainder Theorem directly, but the number of possible states is (Π Ki = 100^9)
I believe there is a brute_force solution but i couldn't find it ):
№ | Пользователь | Рейтинг |
---|---|---|
1 | tourist | 4009 |
2 | jiangly | 3823 |
3 | Benq | 3738 |
4 | Radewoosh | 3633 |
5 | jqdai0815 | 3620 |
6 | orzdevinwang | 3529 |
7 | ecnerwala | 3446 |
8 | Um_nik | 3396 |
9 | ksun48 | 3390 |
10 | gamegame | 3386 |
Страны | Города | Организации | Всё → |
№ | Пользователь | Вклад |
---|---|---|
1 | cry | 167 |
2 | Um_nik | 163 |
3 | maomao90 | 162 |
3 | atcoder_official | 162 |
5 | adamant | 159 |
6 | -is-this-fft- | 158 |
7 | awoo | 157 |
8 | TheScrasse | 154 |
9 | Dominater069 | 153 |
9 | nor | 153 |
Hello codeforces!
I need help with this problem: UVa_11754
If all Ki = 1, we can use Chinese Remainder Theorem directly, but the number of possible states is (Π Ki = 100^9)
I believe there is a brute_force solution but i couldn't find it ):
Название |
---|
Auto comment: topic has been updated by Ismail_Alrifai (previous revision, new revision, compare).
The number of possible states should actually be bounded by $$$2^{32}$$$ as the problem statement guarantees that the product of $$$X$$$s fit into a 32-bit integer. That said, I believe you should be able to partition the congruences into two disjoint sets (of roughly equal number of states, so upper bounded by $$$2^{18}$$$) and generate all possible solutions in each set and use some kind of meet in the middle technique.
But the Ki <= 100, i meant in "possible state" as all combinations of Yij, try all Yij from each clue so the total 100 ^ 9.
if i missed some thing can you please explain how (possible states should actually be bounded by 2^32)
thank you :)
k is less than x and they say "the product of the X’s will fit into a 32-bit integer"
Right, I missed that.
well done Hosen <3
it can be solved by two ways: enum the x and test whether it fits the conditions. dfs search all remainder and use chinese remainder.
luckily, there is a code by RuJia.
i will check the code, thank you