結果
問題 | No.2315 Flying Camera |
ユーザー |
![]() |
提出日時 | 2023-05-26 21:24:22 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 459 bytes |
コンパイル時間 | 3,794 ms |
コンパイル使用メモリ | 253,744 KB |
最終ジャッジ日時 | 2025-02-13 05:38:21 |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 24 |
ソースコード
#include<bits/stdc++.h>#include<atcoder/all>using namespace std;using namespace atcoder;typedef modint998244353 mint;typedef long long ll;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 xt = x[n/2];int yt = y[n/2];ll ans = 0;for (int i=0; i<n; i++){ans += abs(xt - x[i]);ans += abs(yt - y[i]);}cout << ans << endl;}