Swap Balls
Time limit1sMemory limit256 MB
Swap the balls in the given basket pairs M times and print the final ball in each of the N baskets.
- Level
Easy1 of 10
- Topics
- Simulation, Array
- Solved
- No attempts yet
Problem
Swap balls in baskets according to the given operations.
Input
N, M, and M swap pairs.
Output
Print the ball number in each basket.