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 | 3757 |
2 | jiangly | 3647 |
3 | Benq | 3581 |
4 | orzdevinwang | 3570 |
5 | Geothermal | 3569 |
5 | cnnfls_csy | 3569 |
7 | Radewoosh | 3509 |
8 | ecnerwala | 3486 |
9 | jqdai0815 | 3474 |
10 | gyh20 | 3447 |
# | User | Contrib. |
---|---|---|
1 | maomao90 | 171 |
2 | awoo | 165 |
3 | adamant | 164 |
4 | TheScrasse | 159 |
5 | nor | 155 |
5 | maroonrk | 155 |
7 | -is-this-fft- | 152 |
8 | Petr | 147 |
9 | orz | 146 |
10 | pajenegod | 145 |
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}$$$)