cf/mirror

Monotone Monochrome Matrices (Hard Version)

CF
2201F22800· international gm4s512 MB⌨ stdin/stdout

Examples

Sample 1of 1multi-test • hover to link
Input
2
3 9
2 2
3 3
2 3
3 1
3 2
1 1
1 2
2 1
1 3
5 17
2 1
4 5
4 1
3 3
3 1
3 5
1 3
1 5
1 1
5 3
5 5
5 1
1 4
5 2
5 4
1 2
2 5
Output
YES
NO
YES
NO
YES
NO
NO
YES
YES
YES
NO
YES
NO
NO
YES
NO
NO
YES
NO
NO
YES
YES
NO
YES
YES
YES
2201F2.cpp
loading editor…
Ln 11·137 BGNU C++20 (64)