結果
| 問題 |
No.2315 Flying Camera
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-05-26 21:49:33 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 34 ms / 2,000 ms |
| コード長 | 885 bytes |
| コンパイル時間 | 2,325 ms |
| コンパイル使用メモリ | 197,076 KB |
| 最終ジャッジ日時 | 2025-02-13 06:25:57 |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 24 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define REP(i, n) for (int i = 0; i < (n); i++)
template<class T> using V = vector<T>;
template<class T>
ostream &operator<<(ostream &os, const V<T> &v) {
os << "[ ";
for (auto &vi: v) os << vi << ", ";
return os << "]";
}
template<class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
return os << "{ " << p.first << ", " << p.second << "}";
}
#ifdef LOCAL
#define show(x) cerr << __LINE__ << " : " << #x << " = " << x << endl;
#else
#define show(x) true
#endif
int main() {
int N;
cin >> N;
vector<int> X(N), Y(N);
REP(i, N) cin >> X[i] >> Y[i];
sort(X.begin(), X.end());
sort(Y.begin(), Y.end());
int x = X[N / 2], y = Y[N / 2];
long long ans = 0;
REP(i, N) ans += abs(X[i] - x) + abs(Y[i] - y);
cout << ans << '\n';
return 0;
}