cf/mirror

Card Pairing

CF
1969F3000· legendary gm2s512 MB⌨ stdin/stdout

Examples

Sample 1of 8
Input
4 2
1 2 1 2
Output
0
Sample 2of 8
Input
8 2
2 1 2 2 1 2 1 2
Output
1
Sample 3of 8
Input
4 4
1 2 1 2
Output
2
Sample 4of 8
Input
6 4
3 2 3 1 2 1
Output
3
Sample 5of 8
Input
6 4
3 2 3 3 2 1
Output
2
Sample 6of 8
Input
18 6
5 6 1 1 6 5 4 1 5 1 1 6 2 6 2 2 6 3
Output
6
Sample 7of 8
Input
8 4
1 2 3 4 4 3 1 2
Output
2
Sample 8of 8
Input
8 4
1 2 3 4 4 3 3 2
Output
3
1969F.cpp
loading editor…
Ln 11·137 BGNU C++20 (64)