結果
問題 |
No.2315 Flying Camera
|
ユーザー |
![]() |
提出日時 | 2023-06-13 22:10:28 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 400 bytes |
コンパイル時間 | 1,735 ms |
コンパイル使用メモリ | 172,448 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-06-22 08:47:02 |
合計ジャッジ時間 | 2,335 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 24 |
ソースコード
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<int> x(n), y(n); for (int i = 0; i < n; i++) { cin >> x[i] >> y[i]; } sort(x.begin(), x.end()); sort(y.begin(), y.end()); int ans = 0; for (int i = 0; i < n; i++) { ans += abs(x[i] - x[n / 2]); ans += abs(y[i] - y[n / 2]); } cout << ans << endl; }