David has several containers, each with a number of balls in it. He has just enough containers to sort each type of ball he has into its own container. David wants to sort the balls using his sort method. As an example, David has containers and different types of balls, both of which are numbered from to . The distribution of ball types per container are described by an matrix of integers, . For example, consider the following diagram for : In a single operation, David can swap two balls located in different containers. The diagram below depicts a single swap operation: David wants to perform some number of swap operations such that: Each container contains only balls of the same type. No two balls of the same type are located in different containers. You must perform queries where each query is in the form of a matrix, . For each query, print Possible on a new line if Davi...
Comments
Post a Comment