Magic multisets
981G2500· grandmaster4s256 MB⌨ stdin/stdout
Examples
Sample 1of 2
Input
4 41 1 2 11 1 2 21 1 4 12 1 4
Output
10
Sample 2of 2
Input
3 71 1 1 31 1 1 31 1 1 21 1 1 12 1 11 1 1 22 1 1
Output
48
58%
981G.cpp
loading editor…
Ln 11·137 BGNU C++20 (64)