結果
問題 | No.2315 Flying Camera |
ユーザー |
|
提出日時 | 2023-06-29 19:15:57 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 495 bytes |
コンパイル時間 | 1,910 ms |
コンパイル使用メモリ | 194,800 KB |
最終ジャッジ日時 | 2025-02-15 03:08:46 |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 24 |
ソースコード
#include<bits/stdc++.h> using namespace std; using ll=long long; using pii=pair<int,int>; #define all(a) a.begin(),a.end() #define pb push_back #define sz(a) ((int)a.size()) const int N=305; int n,a[N],b[N]; signed main(){ ios_base::sync_with_stdio(0),cin.tie(0); cin >> n; for(int i=0; i<n; ++i) cin >> a[i] >> b[i]; sort(a,a+n),sort(b,b+n); int x=a[(n-1)/2],y=b[(n-1)/2]; int res=0; for(int i=0; i<n; ++i) res+=abs(x-a[i])+abs(y-b[i]); cout << res << "\n"; }