Untitled
unknown
plain_text
a year ago
659 B
8
Indexable
#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 == m) && (y2 == 1 || y2 == m)) {
ans = 2;
} else if ((x1 > 1 && x1 < n && y1 > 1 && y1 < m) &&
(x2 > 1 && x2 < n && y2 > 1 && y2 < m)) {
ans = 4;
} else {
ans = 3;
}
cout << ans << endl;
}
return 0;
}
Editor is loading...
Leave a Comment