This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
/*
Mayoeba Yabureru
*/
#include<bits/stdc++.h>
using namespace std;
void solve() {
int n;
cin >> n;
assert(n == 2);
vector<int> x(n), y(n);
for (int i = 0; i < n; i ++) cin >> x[i] >> y[i];
if (x[0] == x[1] || y[0] == y[1]) cout << -1;
else cout << max(x[0], x[1]) - min(x[0], x[1]) + max(y[0], y[1]) - min(y[0], y[1]) - 2;
}
/*
5
1 3
2 1
1 3
0 10
3 5
*/
int main()
{
int T = 1;
for (int I = 0; I < T; I ++){
solve();
}
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |