Editorial for DMPG '18 B2 - Mimi and Modulus
Remember to use this editorial only when stuck, and not to copy-paste code from it. Please be respectful to the problem author and editorialist.
Submitting an official solution before solving the problem yourself is a bannable offence.
Submitting an official solution before solving the problem yourself is a bannable offence.
Author:
For the first subtask, it suffices to iterate through all of the numbers , and print the maximum residue mod .
Time Complexity:
For the second subtask, we can observe that the answer is upper bounded by and , as the result of any integer mod will be less than . Thus the answer is .
Time Complexity:
Bonus: When is the answer and when is it ?
Comments