cf/mirror

A Good Problem

CF
2119C1300· pupil2s256 MB⌨ stdin/stdout

Examples

Sample 1of 1multi-test • hover to link
Input
9
1 4 4 1
3 1 3 3
4 6 9 2
4 6 9 3
4 6 7 4
2 5 5 1
2 3 6 2
999999999999999999 1000000000000000000 1000000000000000000 999999999999999999
1000000000000000000 1 999999999999999999 1000000000000000000
Output
4
1
6
8
-1
-1
-1
1000000000000000000
2
2119C.cpp
loading editor…
Ln 11·137 BGNU C++20 (64)