Task DescriptionDiscussion (0)
Example:
Input:
Output:
Task :: sorting boxes
You are given N boxes. In each of them there is a certain number of balls, with N different colors
You need to find the minimum number of moves required to sort the balls in such a way that all the balls of the same color are in the same box, but balls of different colors don't have to be in different boxes. You need 1 move to move 1 ball
INPUT:
In the input you are given the number N (1<=N<=500), and in the next N lines you are given N integers (each one less than 1000), representing the number of balls of each color, so that the (n+1)-th line represents the n-th box
In the input you are given the number N (1<=N<=500), and in the next N lines you are given N integers (each one less than 1000), representing the number of balls of each color, so that the (n+1)-th line represents the n-th box
OUTPUT:
In the only line of output you should write the minimum number of moves
In the only line of output you should write the minimum number of moves
Example:
Input:
3
1 2 3
4 5 6
7 8 9
1 2 3
4 5 6
7 8 9
Output:
21
Submit Solution
Available Languages
Task info
| Name: | sorting boxes |
| Time: | 0.3 sec. |
| Memory: | 4 MB |
| #Tests: | 10 |
| AddedBy: | adnanbobo |
Task Ratings
| Difficulty: | 3.1 (9 votes) |
| Quality: | 3.1 (7 votes) |
Acceptance Rate
Recent Submissions
Fastest Solutions
| User | Time |
|---|---|
| PavleKZN | 0 s. |
| nikolakatic | 0.015 s. |
| ja_bre | 0.045 s. |
| bl4ck.c0d3r | 0.045 s. |
| matteo123 | 0.09 s. |
| Al3kSaNdaR | 0.105 s. |
| FilipKeri | 0.12 s. |
| The_Philosopher | 0.12 s. |
| Daniel93 | 0.13 s. |
| isego1 | 0.135 s. |
Solved By
Home
Training
Competitions
Forum
FAQ