Sort by

recency

|

9 Discussions

|

  • + 0 comments

    Xrange's Pancakes are a delightful fusion of flavors and textures, perfect for any brunch enthusiast. Whether you're craving something sweet or savory, their menu offers a variety that's sure to satisfy. For a firsthand look at their mouthwatering creations, check out their live cooking sessions on Twitch at https://www.twitch.tv/njmcdirectticket!

  • + 0 comments

    The rotation rule entails aggregating all values and computing the modulus with respect to 'n.' For instance, if 'n' is 6 and the values are (1,3), (1,2), and (1,5), the resultant sum (3+2+5) mod n equals 4, signifying that the rotations can be represented as (1,4). Conversely, the flip rule involves adding values with alternating signs. For example, with values (2,3), (2,1), (2,5), and (2,4), the sum (-3) + 1 + (-5) + 4 equals -3, and when considering the modulus with 'n,' it becomes +3. This aligns with the concept that the sum of all rotations signifies the number of rotations from the initial state. Additionally, the requirement for the total number of flips to be even ensures that the positions do not become mirror images of the initial state.

  • + 0 comments

    Rule for Rotation : just add all the values and do module n. This shows how many rotations are done from the initial state.

    ex ) n = 6 (1,3), (1,2), (1,5) -> (3+2+5) mod n = 4 . so (1,3), (1,2), (1,5) equals (1,4)

    Rule for Filp : Add the values but with alternating signs.

    ex) (2,3), (2,1), (2,5), (2,4) -> (-3) + 1 + (-5) + 4 = -3, -3 mod n = +3

    this means the same thing as sum of all rotations means : how many rotations are done from the initial state.

    And total number of flips should be even number. otherwise positions are mirror images of the initial state.

  • + 0 comments

    Java 8 :

    import java.util.Scanner;
    
    public class Solution {
      public static void main(final String[] args) {
        try (final Scanner in = new Scanner(System.in)) {
          int type = 0, a = 0;
          for (int n = in.nextInt(), m = in.nextInt(); m > 0; m--) {
            type ^= in.nextInt() - 1;
            a += (2 * type - 1) * in.nextInt() + n;
            a %= n;
          }
          System.out.println(type + 1 + " " + a);
        }
      }
    }
    
  • + 0 comments

    Rotation is simpler.

    As far as flip, let there be 2 * n divisions, thn new rotaion after flip can be derived as,

    (-(old_rotation - flip_rotation) + (2 * n) + flip_rotation) % (2 * n)
    
    or
    
    ((2 * flip_rotation - old_rotation) + (2 * n)) % (2 * n)
    

    where n is the number of vertices.

    Once all operations are acuumulated, it is strightforward to restore the initial orientation.