1 2 3 4 5 6 7 8 9 10 11 12 13
| #include <iostream> #include <algorithm> using namespace std; int T; int n, m, r, c; int main() { cin >> T; while (T--) { cin >> n >> m >> r >> c; cout << max({r + c - 2, n - r + c - 1, r + m - c - 1, n - r + m - c}) << endl; } return 0; }
|