이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
using namespace std;
typedef long long Int;
int main()
{
ios::sync_with_stdio(false);
cin.tie(nullptr);
int n;
cin >> n;
vector<Int> x(n + n), y(n + n);
for (int i = 0; i < n + n; i++) cin >> x[i] >> y[i];
sort(x.begin(), x.end());
sort(y.begin(), y.end());
Int answer = 0;
for (int i = 0; i < n + n; i++) {
answer += abs(x[i] - (Int) (i / 2) - 1LL);
answer += abs(y[i] - (Int) (i / n) - 1LL);
// cerr << "x : " << x[i] << " to " << (i / 2) + 1 << '\n';
// cerr << "y : " << y[i] << " to " << (i / n) + 1 << '\n';
}
cout << answer;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |