This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <vector>
#include <cmath>
#include <set>
using namespace std;
int main()
{
int n;
cin >> n;
int m = 2;
long long res = 0;
for (int q = n << 1; q-->0; )
{
int x, y;
cin >> x >> y;
int dx = (x < 1) ? 1 - x : (x > n) ? x - n : 0;
int dy = (y < 1) ? 1 - y : (y > m) ? y - m : 0;
res += dx + dy;
}
cout << res;
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |