Untitled
unknown
plain_text
19 days ago
716 B
5
Indexable
Never
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; while (t--) { int n, m; cin >> n >> m; int x1, y1, x2, y2; cin >> x1 >> x2 >> y1 >> y2; int ans; if ((x1 == 1 || x1 == n) && (x2 == 1 || x2 == n) || (y1 == 1 || y1 == n || y1 == m) && (y2 == 1 || y2 == n || y2 == m)) { ans = 2; } else if (x1 == 1 || x1 == n || y1 == 1 || y1 == m || x2 == 1 || x2 == n || y2 == 1 || y2 == m) { ans = 3; } else { ans = 4; } cout << ans << endl; } return 0; }
Leave a Comment