cf/mirror

Seating Arrangements (hard version)

CF
1566D21600· expert1s256 MB⌨ stdin/stdout

Examples

Sample 1of 1
Input
7
1 2
1 2
3 2
1 1 2 2 3 3
3 3
3 4 4 1 1 1 1 1 2
2 2
1 1 2 1
4 2
50 50 50 50 3 50 50 50
4 2
6 6 6 6 2 2 9 6
2 9
1 3 3 3 3 3 1 1 3 1 3 1 1 3 3 1 1 3
Output
1
0
4
0
0
0
1
1566D2.cpp
loading editor…
Ln 11·137 BGNU C++20 (64)