cf/mirror

Make It Permutation

CF
1810C1300· pupil1s256 MB⌨ stdin/stdout

Examples

Sample 1of 1multi-test • hover to link
Input
8
3 3 3
1 2 3
5 1 5
1 2 3 5 6
5 2 3
1 1 1 3 3
5 1 10
2 4 6 8 10
6 2 8
7 3 5 4 4 8
4 10 1
1 2 6 7
4 3 3
2 5 8 7
2 1000000000 1
1000000000 1
Output
0
2
8
14
20
3
12
999999998
1810C.cpp
loading editor…
Ln 11·137 BGNU C++20 (64)