We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 068f285 + cd1f72a commit 257443bCopy full SHA for 257443b
atcoder/abc184/C/main.cpp
@@ -0,0 +1,32 @@
1
+#include <bits/stdc++.h>
2
+
3
+using namespace std;
4
+using ll = int64_t;
5
+using ff = long double;
6
7
+int solve(ll a, ll b, ll c, ll d) {
8
+ if (a == c && b == d) return 0;
9
+ //
10
+ if (a + b == c + d) return 1;
11
+ if (a - b == c - d) return 1;
12
+ if (abs(a-c) + abs(b - d) <= 3) return 1;
13
14
+ if ((a + b) % 2 == (c + d) % 2) return 2;
15
+ if (abs(a-c) + abs(b -d) <= 6) return 2;
16
+ if (abs((a + b) - (c + d)) <= 3) return 2;
17
+ if (abs((a - b) - (c - d)) <= 3) return 2;
18
19
+ return 3;
20
21
+}
22
23
+int main() {
24
+ ios_base::sync_with_stdio(false);
25
+ cin.tie(0); cout.tie(0);
26
27
+ int r1, c1, r2, c2;
28
+ cin >> r1 >> c1 >> r2 >> c2;
29
+ cout << solve(r1, c1, r2, c2) << endl;
30
31
+ return 0;
32
0 commit comments