cf/mirror

Closest Equals

CF
522D2000· candidate master3s256 MB⌨ stdin/stdout

Examples

Sample 1of 2
Input
5 3
1 1 2 3 2
1 5
2 4
3 5
Output
1
-1
2
Sample 2of 2
Input
6 5
1 2 1 3 2 3
4 6
1 3
2 5
2 4
1 6
Output
2
2
3
-1
2
522D.cpp
loading editor…
Ln 11·137 BGNU C++20 (64)