primitive root and square decomposition problem

Revision en1, by omar_amer47, 2024-06-01 20:17:05

I'm trying to solve https://www.codechef.com/problems/COOLSBST on codechef, I tried to think of solution that involves precomuting and square decomposition or sorting the test cases based on L and R but couldn't figure it out. can somebody explain how to solve it using square decomposition? thanks in advance.

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English omar_amer47 2024-06-01 20:17:05 357 Initial revision (published)