How Can I solve this problem!https://toph.co/p/crypto-number Will be grateful if anyone can help. Thank You. TLE-O(q*sqrt(k)) time.
# | User | Rating |
---|---|---|
1 | tourist | 3947 |
2 | jiangly | 3734 |
3 | Radewoosh | 3646 |
4 | jqdai0815 | 3620 |
4 | Benq | 3620 |
6 | orzdevinwang | 3612 |
7 | ecnerwala | 3581 |
8 | Geothermal | 3569 |
8 | cnnfls_csy | 3569 |
10 | ksun48 | 3479 |
# | User | Contrib. |
---|---|---|
1 | awoo | 162 |
2 | maomao90 | 160 |
3 | nor | 156 |
4 | adamant | 155 |
4 | -is-this-fft- | 155 |
4 | atcoder_official | 155 |
7 | cry | 153 |
7 | maroonrk | 153 |
9 | SecondThread | 147 |
10 | Petr | 146 |
How Can I solve this problem!https://toph.co/p/crypto-number Will be grateful if anyone can help. Thank You. TLE-O(q*sqrt(k)) time.
Name |
---|
It's really a nice Number Theory problem.
In the problem statement you can note that r, p -both greater than 1 from it you can conclude the following:
From the previous observations, you can find the factors which are less than or equal the cube root in for-loop then you can check if there is a prime factor above the cube root or not.
In this way you can calculate prime factors for K with time complexity O($$$\sqrt[3]{K}$$$) then from the prime factors, you can find the divisors, and then the answer will be the frequency of the divisors in Array C.
AC solution
The Time Complexity O($$$Q\times\sqrt[3]{K}$$$)