cf/mirror

Appending Permutations (Easy Version)

CF
2124F12300· international master3s1024 MB⌨ stdin/stdout

Examples

Sample 1of 2multi-test • hover to link
Input
7
3 0
3 3
1 1
2 1
3 1
3 2
1 1
2 1
6 2
2 3
4 2
2 3
1 2
2 2
1 1
4 3
2 2
3 2
4 2
3 2
2 3
3 3
Output
7
0
1
65
0
4
5
Sample 2of 2multi-test • hover to link
Input
1
100 1
69 69
Output
381055417
2124F1.cpp
loading editor…
Ln 11·137 BGNU C++20 (64)