結果

問題 No.2315 Flying Camera
ユーザー shobonvipshobonvip
提出日時 2023-05-26 21:24:22
言語 C++17(gcc12)
(gcc 12.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 459 bytes
コンパイル時間 4,302 ms
コンパイル使用メモリ 263,188 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-12-25 04:33:47
合計ジャッジ時間 5,164 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 24
権限があれば一括ダウンロードができます

ソースコード

diff #

#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;
}
0