Editorial for LCC '23 Contest 1 J4 - Candy Plan
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:
This problem wants you to rotate an by grid by K degrees clockwise and print it. Knowing that K is a multiple of 90, we simply need to rotate the array by 90 degrees clockwise K / 90 times. If we want to rotate the array by 270, we rotate it by 90 degrees 3 times. Notice that when an array is rotated, every element will also be moved.
Let be an element in . The following directions assume that the array is 0-indexed:
When K = 0, there is no rotation.
When K = 90, or when the array is rotated once, every element will go to .
When K = 180, every element will go to .
When K = 270, every element will go to .
Comments