cf/mirror

Another Puzzle from Papyrus

CF
2238A800· newbie1s256 MB⌨ stdin/stdout

Examples

Sample 1of 1multi-test • hover to link
Input
6
3 5
5 2 3
2 3 4
3 3
1 2 3
4 5 6
4 4
4 5 2 3
3 5 1 2
6 4
2 4 5 3 6 8
5 8 3 1 2 5
5 11
5 8 11 14 17
16 12 10 10 6
3 5
20 14 20
12 18 17
Output
6
-1
3
8
-1
12
2238A.cpp
loading editor…
Ln 11·137 BGNU C++20 (64)